r13374 mono - /trunk/netsurf/atari/plot/plotter_vdi.c
by netsurf@semichrome.net
Author: mono
Date: Thu Jan 5 16:38:02 2012
New Revision: 13374
URL: http://source.netsurf-browser.org?rev=13374&view=rev
Log:
Fix rectangle fill, only add/subtract stroke_width when the rectangle has an outline.
Modified:
trunk/netsurf/atari/plot/plotter_vdi.c
Modified: trunk/netsurf/atari/plot/plotter_vdi.c
URL: http://source.netsurf-browser.org/trunk/netsurf/atari/plot/plotter_vdi.c?...
==============================================================================
--- trunk/netsurf/atari/plot/plotter_vdi.c (original)
+++ trunk/netsurf/atari/plot/plotter_vdi.c Thu Jan 5 16:38:02 2012
@@ -641,15 +641,21 @@
v_pline(self->vdi_handle, 2, (short *)&pxy );
}
}
+
if( pstyle->fill_type != PLOT_OP_TYPE_NONE ){
+
+ short stroke_width = (short)(pstyle->stroke_type != PLOT_OP_TYPE_NONE) ?
+ pstyle->stroke_width : 0;
+
vsf_rgbcolor( self->vdi_handle, pstyle->fill_colour );
vsf_perimeter( self->vdi_handle, 0);
vsf_interior( self->vdi_handle, FIS_SOLID );
- pxy[0] = CURFB(self).x + r.g_x+pstyle->stroke_width;
- pxy[1] = CURFB(self).y + r.g_y+pstyle->stroke_width;
- pxy[2] = CURFB(self).x + r.g_x + r.g_w -1 - pstyle->stroke_width ;
- pxy[3] = CURFB(self).y + r.g_y + r.g_h -1 - pstyle->stroke_width;
+
+ pxy[0] = CURFB(self).x + r.g_x + stroke_width;
+ pxy[1] = CURFB(self).y + r.g_y + stroke_width;
+ pxy[2] = CURFB(self).x + r.g_x + r.g_w -1 - stroke_width ;
+ pxy[3] = CURFB(self).y + r.g_y + r.g_h -1 - stroke_width;
vsf_style( self->vdi_handle, 1);
v_bar( self->vdi_handle, (short*)&pxy );
11 years, 5 months
r13372 mono - /trunk/netsurf/atari/plot/font_freetype.c
by netsurf@semichrome.net
Author: mono
Date: Tue Jan 3 17:29:25 2012
New Revision: 13372
URL: http://source.netsurf-browser.org?rev=13372&view=rev
Log:
Fix clipping and only apply color conversion for hicolor systems.
Modified:
trunk/netsurf/atari/plot/font_freetype.c
Modified: trunk/netsurf/atari/plot/font_freetype.c
URL: http://source.netsurf-browser.org/trunk/netsurf/atari/plot/font_freetype....
==============================================================================
--- trunk/netsurf/atari/plot/font_freetype.c (original)
+++ trunk/netsurf/atari/plot/font_freetype.c Tue Jan 3 17:29:25 2012
@@ -386,8 +386,8 @@
clip.g_x = self->plotter->clipping.x0;
clip.g_y = self->plotter->clipping.y0;
- clip.g_w = self->plotter->clipping.x1 - self->plotter->clipping.x0;
- clip.g_h = self->plotter->clipping.y1 - self->plotter->clipping.y0;
+ clip.g_w = (self->plotter->clipping.x1 - self->plotter->clipping.x0)+1;
+ clip.g_h = (self->plotter->clipping.y1 - self->plotter->clipping.y0)+1;
if( !rc_intersect( &clip, loc ) ){
return;
@@ -434,8 +434,8 @@
clip.g_x = self->plotter->clipping.x0;
clip.g_y = self->plotter->clipping.y0;
- clip.g_w = self->plotter->clipping.x1 - self->plotter->clipping.x0;
- clip.g_h = self->plotter->clipping.y1 - self->plotter->clipping.y0;
+ clip.g_w = (self->plotter->clipping.x1 - self->plotter->clipping.x0)+1;
+ clip.g_h = (self->plotter->clipping.y1 - self->plotter->clipping.y0)+1;
if( !rc_intersect( &clip, loc ) ){
return;
@@ -503,7 +503,8 @@
uint32_t c = fstyle->foreground ;
/* in -> BGR */
/* out -> ARGB */
- c = ABGR_TO_RGB(c);
+ if( app.nplanes > 8 )
+ c = ABGR_TO_RGB(c);
while (nxtchr < length) {
ucs4 = utf8_to_ucs4(text + nxtchr, length - nxtchr);
@@ -526,7 +527,7 @@
&loc,
bglyph->bitmap.buffer,
bglyph->bitmap.pitch,
- fstyle->foreground
+ c
);
}
}
11 years, 5 months
r13371 mono - /trunk/netsurf/atari/plot/font_freetype.c
by netsurf@semichrome.net
Author: mono
Date: Tue Jan 3 17:05:27 2012
New Revision: 13371
URL: http://source.netsurf-browser.org?rev=13371&view=rev
Log:
It's now possible to render fonts in monochrom mode.
Modified:
trunk/netsurf/atari/plot/font_freetype.c
Modified: trunk/netsurf/atari/plot/font_freetype.c
URL: http://source.netsurf-browser.org/trunk/netsurf/atari/plot/font_freetype....
==============================================================================
--- trunk/netsurf/atari/plot/font_freetype.c (original)
+++ trunk/netsurf/atari/plot/font_freetype.c Tue Jan 3 17:05:27 2012
@@ -56,7 +56,14 @@
size_t *char_offset, int *actual_x );
static int text( FONT_PLOTTER self, int x, int y, const char *text,
size_t length, const plot_font_style_t *fstyle );
-
+
+static void draw_glyph8(FONT_PLOTTER self, GRECT * loc, uint8_t * pixdata,
+ int pitch, uint32_t colour);
+static void draw_glyph1(FONT_PLOTTER self, GRECT * loc, uint8_t * pixdata,
+ int pitch, uint32_t colour);
+
+static MFDB tmp;
+static int tmp_mfdb_size;
static bool init = false;
@@ -152,7 +159,7 @@
}
srec->face_id = (FTC_FaceID)font_faces[selected_face];
- srec->width = srec->height = (fstyle->size * 64) / FONT_SIZE_SCALE;
+ srec->width = srec->height = (fstyle->size * 64) / FONT_SIZE_SCALE;
srec->pixel = 0;
srec->x_res = srec->y_res = 72;
}
@@ -176,7 +183,6 @@
glyph_index,
&glyph,
NULL);
-
return glyph;
}
@@ -273,12 +279,6 @@
"fonts/fantasy.ttf",
DEJAVU_PATH"DejaVuSerifCondensed-Bold.ttf");
- /* set the default render mode */
- if (option_atari_font_monochrom == true)
- ft_load_type = FT_LOAD_MONOCHROME;
- else
- ft_load_type = 0;
-
return true;
}
@@ -368,6 +368,7 @@
*char_offset = nxtchr;
return ( 1 );
}
+
static void draw_glyph8(FONT_PLOTTER self, GRECT * loc, uint8_t * pixdata, int pitch, uint32_t colour)
{
@@ -416,7 +417,80 @@
}
}
self->plotter->bitmap( self->plotter, fontbmp, loc->g_x, loc->g_y, 0, 0);
-}
+}
+
+static void draw_glyph1(FONT_PLOTTER self, GRECT * loc, uint8_t * pixdata, int pitch, uint32_t colour)
+{
+ GRECT clip;
+ int xloop,yloop,xoff,yoff;
+ int x,y,w,h;
+ uint8_t bitm;
+ const uint8_t *fntd;
+
+ x = loc->g_x;
+ y = loc->g_y;
+ w = loc->g_w;
+ h = loc->g_h;
+
+ clip.g_x = self->plotter->clipping.x0;
+ clip.g_y = self->plotter->clipping.y0;
+ clip.g_w = self->plotter->clipping.x1 - self->plotter->clipping.x0;
+ clip.g_h = self->plotter->clipping.y1 - self->plotter->clipping.y0;
+
+ if( !rc_intersect( &clip, loc ) ){
+ return;
+ }
+
+ assert( loc->g_w > 0 );
+ assert( loc->g_h > 0 );
+ xoff = loc->g_x - x;
+ yoff = loc->g_y - y;
+
+ if (h > loc->g_h)
+ h = loc->g_h;
+
+ if (w > loc->g_w)
+ w = loc->g_w;
+
+ int stride = MFDB_STRIDE( w );
+ if( tmp.fd_addr == NULL || tmp_mfdb_size < MFDB_SIZE( 1, stride, h) ){
+ tmp_mfdb_size = init_mfdb( 1, w, h, MFDB_FLAG_STAND | MFDB_FLAG_ZEROMEM, &tmp );
+ } else {
+ void * buf = tmp.fd_addr;
+ int size = init_mfdb( 1, w, h, MFDB_FLAG_STAND | MFDB_FLAG_NOALLOC, &tmp );
+ tmp.fd_addr = buf;
+ memset( tmp.fd_addr, 0, size );
+ }
+ short * buf;
+ for( yloop = 0; yloop < h; yloop++) {
+ fntd = pixdata + (pitch * (yloop+yoff))+(xoff>>3);
+ buf = tmp.fd_addr;
+ buf += (tmp.fd_wdwidth*yloop);
+ for ( xloop = 0, bitm = (1<<(7-(xoff%8))); xloop < w; xloop++, bitm=(bitm>>1) ) {
+ if( (*fntd & bitm) != 0 ){
+ short whichbit = (1<<(15-(xloop%16)));
+ buf[xloop>>4] = ((buf[xloop>>4])|(whichbit));
+ }
+ if( bitm == 1 ) {
+ fntd++;
+ bitm = 128;
+ }
+ }
+ }
+ if( app.nplanes > 8 ){
+ unsigned short out[4];
+ rgb_to_vdi1000( (unsigned char*)&colour, (unsigned short*)&out );
+ vs_color( self->plotter->vdi_handle, OFFSET_CUSTOM_COLOR, (unsigned short*)&out[0] );
+ self->plotter->plot_mfdb( self->plotter, loc, &tmp, OFFSET_CUSTOM_COLOR, PLOT_FLAG_TRANS );
+ } else {
+ unsigned char c = RGB_TO_VDI(colour);
+ self->plotter->plot_mfdb( self->plotter, loc, &tmp, c, PLOT_FLAG_TRANS );
+ }
+
+}
+
+
+
static int text( FONT_PLOTTER self, int x, int y, const char *text, size_t length,
const plot_font_style_t *fstyle )
@@ -427,17 +501,18 @@
FT_BitmapGlyph bglyph;
GRECT loc;
uint32_t c = fstyle->foreground ;
- /* in -> BGR */
- /* out -> ARGB */
+ /* in -> BGR */
+ /* out -> ARGB */
c = ABGR_TO_RGB(c);
-
+
while (nxtchr < length) {
ucs4 = utf8_to_ucs4(text + nxtchr, length - nxtchr);
nxtchr = utf8_next(text, length, nxtchr);
glyph = ft_getglyph(fstyle, ucs4);
- if (glyph == NULL)
- continue;
+ if (glyph == NULL){
+ continue;
+ }
if (glyph->format == FT_GLYPH_FORMAT_BITMAP) {
bglyph = (FT_BitmapGlyph)glyph;
@@ -446,24 +521,20 @@
loc.g_w = bglyph->bitmap.width;
loc.g_h = bglyph->bitmap.rows;
- if (bglyph->bitmap.pixel_mode == FT_PIXEL_MODE_MONO) {
- assert( 1 == 0 );
- } else {
- if( loc.g_w > 0) {
- draw_glyph8( self,
- &loc,
- bglyph->bitmap.buffer,
- bglyph->bitmap.pitch,
- c
- );
- }
+ if( loc.g_w > 0) {
+ self->draw_glyph( self,
+ &loc,
+ bglyph->bitmap.buffer,
+ bglyph->bitmap.pitch,
+ fstyle->foreground
+ );
}
}
x += glyph->advance.x >> 16;
}
return( 0 );
-}
+}
int ctor_font_plotter_freetype( FONT_PLOTTER self )
@@ -472,7 +543,18 @@
self->str_width = str_width;
self->str_split = str_split;
self->pixel_pos = pixel_pos;
- self->text = text;
+ self->text = text;
+
+ /* set the default render mode */
+ if( (self->flags & FONTPLOT_FLAG_MONOGLYPH) != 0 ){
+ ft_load_type = FT_LOAD_MONOCHROME;
+ self->draw_glyph = draw_glyph1;
+ }
+ else{
+ ft_load_type = 0;
+ self->draw_glyph = draw_glyph8;
+ }
+
LOG(("%s: %s\n", (char*)__FILE__, __FUNCTION__));
if( !init ) {
ft_font_init();
@@ -488,7 +570,11 @@
{
ft_font_finalise();
if( fontbmp == NULL )
- bitmap_destroy( fontbmp );
+ bitmap_destroy( fontbmp );
+
+ if( tmp.fd_addr != NULL ){
+ free( tmp.fd_addr );
+ }
return( 1 );
}
11 years, 5 months
r13370 mono - /trunk/netsurf/atari/plot/plotter_vdi.c
by netsurf@semichrome.net
Author: mono
Date: Tue Jan 3 17:03:09 2012
New Revision: 13370
URL: http://source.netsurf-browser.org?rev=13370&view=rev
Log:
removed comment.
Modified:
trunk/netsurf/atari/plot/plotter_vdi.c
Modified: trunk/netsurf/atari/plot/plotter_vdi.c
URL: http://source.netsurf-browser.org/trunk/netsurf/atari/plot/plotter_vdi.c?...
==============================================================================
--- trunk/netsurf/atari/plot/plotter_vdi.c (original)
+++ trunk/netsurf/atari/plot/plotter_vdi.c Tue Jan 3 17:03:09 2012
@@ -977,12 +977,7 @@
*buf = (val&(1<<6)) ? ((*buf)|(whichbit)) : ((*buf)&~(whichbit));
buf += wdplanesz;
- *buf = (val&(1<<7)) ? ((*buf)|(whichbit)) : ((*buf)&~(whichbit));
-
- /*for( p=0; p<=dst->fd_nplanes-1; p++) {
- *buf = (val&(1<<p)) ? ((*buf)|(whichbit)) : ((*buf)&~(whichbit));
- buf += wdplanesz;
- }*/
+ *buf = (val&(1<<7)) ? ((*buf)|(whichbit)) : ((*buf)&~(whichbit));
}
inline unsigned char get_stdpx(MFDB * dst, int wdplanesz, int x, int y )
11 years, 5 months
r13369 mono - in /trunk/netsurf/atari/plot: plotter.c plotter.h
by netsurf@semichrome.net
Author: mono
Date: Tue Jan 3 17:02:38 2012
New Revision: 13369
URL: http://source.netsurf-browser.org?rev=13369&view=rev
Log:
Fixed font plotter init and added flag for monochrom glyph rendering.
Modified:
trunk/netsurf/atari/plot/plotter.c
trunk/netsurf/atari/plot/plotter.h
Modified: trunk/netsurf/atari/plot/plotter.c
URL: http://source.netsurf-browser.org/trunk/netsurf/atari/plot/plotter.c?rev=...
==============================================================================
--- trunk/netsurf/atari/plot/plotter.c (original)
+++ trunk/netsurf/atari/plot/plotter.c Tue Jan 3 17:02:38 2012
@@ -325,10 +325,12 @@
if( fplotter == NULL ) {
*error = 0-ERR_NO_MEM;
return( NULL );
- }
+ }
+ memset( fplotter, 0, sizeof(FONT_PLOTTER));
fplotter->vdi_handle = vdihandle;
- fplotter->name = name;
- fplotter->flags |= flags;
+ fplotter->name = name;
+ fplotter->flags = 0;
+ fplotter->flags |= flags;
for( i = 0; ; i++) {
if( font_driver_table[i].name == NULL ) {
res = 0-ERR_PLOTTER_NOT_AVAILABLE;
Modified: trunk/netsurf/atari/plot/plotter.h
URL: http://source.netsurf-browser.org/trunk/netsurf/atari/plot/plotter.h?rev=...
==============================================================================
--- trunk/netsurf/atari/plot/plotter.h (original)
+++ trunk/netsurf/atari/plot/plotter.h Tue Jan 3 17:02:38 2012
@@ -55,7 +55,10 @@
#define PLOT_FLAG_OFFSCREEN 0x01 /* offsreen plotter should set/accept this flag */
#define PLOT_FLAG_LOCKED 0x02 /* plotter should set this flag during screen updates */
#define PLOT_FLAG_DITHER 0x04 /* true if the plotter shall dither images */
-#define PLOT_FLAG_TRANS 0x08 /* true if the plotter supports transparent operations */
+#define PLOT_FLAG_TRANS 0x08 /* true if the plotter supports transparent operations */
+
+/* Font Plotter flags: */
+#define FONTPLOT_FLAG_MONOGLYPH 0x01
/* Flags for init_mfdb function: */
#define MFDB_FLAG_STAND 0x01
@@ -84,7 +87,11 @@
int x, size_t *char_offset, int *actual_x);
typedef int (*_fpmf_text)( FONT_PLOTTER self, int x, int y, const char *text,
size_t length, const plot_font_style_t *fstyle);
+
+typedef void (*_fpmf_draw_glyph)(FONT_PLOTTER self, GRECT * loc, uint8_t * pixdata,
+ int pitch, uint32_t colour);
typedef int (*_fpmf_dtor)( FONT_PLOTTER self );
+
/* prototype of the font plotter "object" */
struct s_font_plotter
@@ -98,7 +105,8 @@
_fpmf_str_width str_width;
_fpmf_str_split str_split;
_fpmf_pixel_pos pixel_pos;
- _fpmf_text text;
+ _fpmf_text text;
+ _fpmf_draw_glyph draw_glyph;
_fpmf_dtor dtor;
};
11 years, 5 months
r13368 jmb - /trunk/tools/buildsystem/makefiles/Makefile.tools
by netsurf@semichrome.net
Author: jmb
Date: Mon Jan 2 10:59:33 2012
New Revision: 13368
URL: http://source.netsurf-browser.org?rev=13368&view=rev
Log:
Add -N to LDFLAGS for AmigaOS native and cross compilation
Modified:
trunk/tools/buildsystem/makefiles/Makefile.tools
Modified: trunk/tools/buildsystem/makefiles/Makefile.tools
URL: http://source.netsurf-browser.org/trunk/tools/buildsystem/makefiles/Makef...
==============================================================================
--- trunk/tools/buildsystem/makefiles/Makefile.tools (original)
+++ trunk/tools/buildsystem/makefiles/Makefile.tools Mon Jan 2 10:59:33 2012
@@ -268,10 +268,13 @@
# TODO: this assumes GCC
CFLAGS := $(CFLAGS) -U__STRICT_ANSI__ -I$(GCCSDK_INSTALL_ENV)/include
CXXFLAGS := $(CXXFLAGS) -U__STRICT_ANSI__ -I$(GCCSDK_INSTALL_ENV)/include
- LDFLAGS := $(LDFLAGS) -N -L$(GCCSDK_INSTALL_ENV)/lib
+ LDFLAGS := $(LDFLAGS) -L$(GCCSDK_INSTALL_ENV)/lib
PREFIX ?= $(GCCSDK_INSTALL_ENV)
endif
+
+ # TODO: this assumes GCC
+ LDFLAGS := $(LDFLAGS) -N
endif
# Default prefix
11 years, 5 months
r13367 mono - in /trunk/netsurf/atari/plot: font_internal.c plotter.h plotter_vdi.c
by netsurf@semichrome.net
Author: mono
Date: Mon Jan 2 08:29:16 2012
New Revision: 13367
URL: http://source.netsurf-browser.org?rev=13367&view=rev
Log:
Made internal font plotter compatible with 256 colors.
Modified:
trunk/netsurf/atari/plot/font_internal.c
trunk/netsurf/atari/plot/plotter.h
trunk/netsurf/atari/plot/plotter_vdi.c
Modified: trunk/netsurf/atari/plot/font_internal.c
URL: http://source.netsurf-browser.org/trunk/netsurf/atari/plot/font_internal....
==============================================================================
--- trunk/netsurf/atari/plot/font_internal.c (original)
+++ trunk/netsurf/atari/plot/font_internal.c Mon Jan 2 08:29:16 2012
@@ -239,11 +239,16 @@
*d = (unsigned char)*pp++;
d += rowsize;
}
- }
- unsigned short out[4];
- rgb_to_vdi1000( (unsigned char*)&fstyle->foreground, (unsigned short*)&out );
- vs_color( self->plotter->vdi_handle, OFFSET_CUSTOM_COLOR, (unsigned short*)&out[0] );
- self->plotter->plot_mfdb( self->plotter, &loc, &tmp, PLOT_FLAG_TRANS );
+ }
+ if( app.nplanes > 8 ){
+ unsigned short out[4];
+ rgb_to_vdi1000( (unsigned char*)&fstyle->foreground, (unsigned short*)&out );
+ vs_color( self->plotter->vdi_handle, OFFSET_CUSTOM_COLOR, (unsigned short*)&out[0] );
+ self->plotter->plot_mfdb( self->plotter, &loc, &tmp, OFFSET_CUSTOM_COLOR, PLOT_FLAG_TRANS );
+ } else {
+ unsigned char c = RGB_TO_VDI(fstyle->foreground);
+ self->plotter->plot_mfdb( self->plotter, &loc, &tmp, c, PLOT_FLAG_TRANS );
+ }
}
free(buffer);
Modified: trunk/netsurf/atari/plot/plotter.h
URL: http://source.netsurf-browser.org/trunk/netsurf/atari/plot/plotter.h?rev=...
==============================================================================
--- trunk/netsurf/atari/plot/plotter.h (original)
+++ trunk/netsurf/atari/plot/plotter.h Mon Jan 2 08:29:16 2012
@@ -168,7 +168,7 @@
GRECT * clip, uint32_t bg, uint32_t flags, MFDB *out );
typedef int (*_pmf_bitmap)(GEM_PLOTTER self, struct bitmap * bmp, int x, int y,
unsigned long bg, unsigned long flags );
-typedef int (*_pmf_plot_mfdb)(GEM_PLOTTER self, GRECT * loc, MFDB * mfdb, uint32_t flags);
+typedef int (*_pmf_plot_mfdb)(GEM_PLOTTER self, GRECT * loc, MFDB * mfdb, unsigned char fgcolor, uint32_t flags);
typedef int (*_pmf_text)(GEM_PLOTTER self, int x, int y, const char *text, size_t length, const plot_font_style_t *fstyle);
typedef int (*_pmf_dtor)(GEM_PLOTTER self);
Modified: trunk/netsurf/atari/plot/plotter_vdi.c
URL: http://source.netsurf-browser.org/trunk/netsurf/atari/plot/plotter_vdi.c?...
==============================================================================
--- trunk/netsurf/atari/plot/plotter_vdi.c (original)
+++ trunk/netsurf/atari/plot/plotter_vdi.c Mon Jan 2 08:29:16 2012
@@ -68,7 +68,7 @@
GRECT * clip,uint32_t bg,uint32_t flags, MFDB *out );
static int bitmap( GEM_PLOTTER self, struct bitmap * bmp, int x, int y,
unsigned long bg, unsigned long flags );
-static int plot_mfdb( GEM_PLOTTER self, GRECT * where, MFDB * mfdb, uint32_t flags);
+static int plot_mfdb( GEM_PLOTTER self, GRECT * where, MFDB * mfdb, unsigned char fgcolor, uint32_t flags);
static int text(GEM_PLOTTER self, int x, int y, const char *text,size_t length, const plot_font_style_t *fstyle);
@@ -948,36 +948,83 @@
}
-inline void set_stdpx( MFDB * dst, int x, int y, unsigned char val )
+inline void set_stdpx( MFDB * dst, int wdplanesz, int x, int y, unsigned char val )
{
- int p;
short * buf;
- int wdplanesz = dst->fd_wdwidth*dst->fd_h;
short whichbit = (1<<(15-(x%16)));
buf = dst->fd_addr;
- buf += ((dst->fd_wdwidth*(y))+(x>>4));
- for( p=0; p<=dst->fd_nplanes-1; p++) {
+ buf += ((dst->fd_wdwidth*(y))+(x>>4));
+
+ *buf = (val&1) ? ((*buf)|(whichbit)) : ((*buf)&~(whichbit));
+
+ buf += wdplanesz;
+ *buf = (val&(1<<1)) ? ((*buf)|(whichbit)) : ((*buf)&~(whichbit));
+
+ buf += wdplanesz;
+ *buf = (val&(1<<2)) ? ((*buf)|(whichbit)) : ((*buf)&~(whichbit));
+
+ buf += wdplanesz;
+ *buf = (val&(1<<3)) ? ((*buf)|(whichbit)) : ((*buf)&~(whichbit));
+
+ buf += wdplanesz;
+ *buf = (val&(1<<4)) ? ((*buf)|(whichbit)) : ((*buf)&~(whichbit));
+
+ buf += wdplanesz;
+ *buf = (val&(1<<5)) ? ((*buf)|(whichbit)) : ((*buf)&~(whichbit));
+
+ buf += wdplanesz;
+ *buf = (val&(1<<6)) ? ((*buf)|(whichbit)) : ((*buf)&~(whichbit));
+
+ buf += wdplanesz;
+ *buf = (val&(1<<7)) ? ((*buf)|(whichbit)) : ((*buf)&~(whichbit));
+
+ /*for( p=0; p<=dst->fd_nplanes-1; p++) {
*buf = (val&(1<<p)) ? ((*buf)|(whichbit)) : ((*buf)&~(whichbit));
buf += wdplanesz;
- }
-}
-
-inline unsigned char get_stdpx(MFDB * dst, int x, int y )
+ }*/
+}
+
+inline unsigned char get_stdpx(MFDB * dst, int wdplanesz, int x, int y )
{
unsigned char ret=0;
- int p;
short * buf;
- int wdplanesz = dst->fd_wdwidth*dst->fd_h;
short whichbit = (1<<(15-(x%16)));
buf = dst->fd_addr;
- buf += ((dst->fd_wdwidth*(y))+(x>>4));
- for( p=0; p<=dst->fd_nplanes-1; p++) {
- if( *buf & whichbit )
- ret |= (01<<p);
- buf += wdplanesz;
- }
+ buf += ((dst->fd_wdwidth*(y))+(x>>4));
+
+ if( *buf & whichbit )
+ ret |= 1;
+
+ buf += wdplanesz;
+ if( *buf & whichbit )
+ ret |= 2;
+
+ buf += wdplanesz;
+ if( *buf & whichbit )
+ ret |= 4;
+
+ buf += wdplanesz;
+ if( *buf & whichbit )
+ ret |= 8;
+
+ buf += wdplanesz;
+ if( *buf & whichbit )
+ ret |= 16;
+
+ buf += wdplanesz;
+ if( *buf & whichbit )
+ ret |= 32;
+
+ buf += wdplanesz;
+ if( *buf & whichbit )
+ ret |= 64;
+
+ buf += wdplanesz;
+ if( *buf & whichbit )
+ ret |= 128;
+
return( ret );
}
@@ -997,6 +1044,8 @@
int bw;
struct bitmap * scrbuf = NULL;
struct bitmap * bm;
+ bool transp = ( ( (img->opaque == false) || ( (flags & BITMAP_MONOGLYPH) != 0) )
+ && ((self->flags & PLOT_FLAG_TRANS) != 0) );
assert( clip->g_h > 0 );
assert( clip->g_w > 0 );
@@ -1035,27 +1084,29 @@
// realloc mem for stdform
MFDB stdform;
- if( ((self->flags & PLOT_FLAG_TRANS) != 0) || ( (flags & BITMAP_MONOGLYPH) != 0) ) {
- // point image to snapshot buffer, otherwise allocate mem
- MFDB * bg = snapshot_create_std_mfdb( self, x+clip->g_x,y+clip->g_y, clip->g_w, clip->g_h );
- stdform.fd_addr = bg->fd_addr;
- } else {
- if( dstsize > DUMMY_PRIV(self)->size_buf_planar) {
- int blocks = (dstsize / (CONV_BLOCK_SIZE-1))+1;
- if( DUMMY_PRIV(self)->buf_planar == NULL )
- DUMMY_PRIV(self)->buf_planar =(void*)malloc( blocks * CONV_BLOCK_SIZE );
- else
- DUMMY_PRIV(self)->buf_planar =(void*)realloc(
- DUMMY_PRIV(self)->buf_planar,
- blocks * CONV_BLOCK_SIZE
- );
- assert( DUMMY_PRIV(self)->buf_planar );
- if( DUMMY_PRIV(self)->buf_planar == NULL ) {
- return( 0-ERR_NO_MEM );
+ if( transp ){
+ if( ((self->flags & PLOT_FLAG_TRANS) != 0) || ( (flags & BITMAP_MONOGLYPH) != 0) ) {
+ // point image to snapshot buffer, otherwise allocate mem
+ MFDB * bg = snapshot_create_std_mfdb( self, x+clip->g_x,y+clip->g_y, clip->g_w, clip->g_h );
+ stdform.fd_addr = bg->fd_addr;
+ } else {
+ if( dstsize > DUMMY_PRIV(self)->size_buf_planar) {
+ int blocks = (dstsize / (CONV_BLOCK_SIZE-1))+1;
+ if( DUMMY_PRIV(self)->buf_planar == NULL )
+ DUMMY_PRIV(self)->buf_planar =(void*)malloc( blocks * CONV_BLOCK_SIZE );
+ else
+ DUMMY_PRIV(self)->buf_planar =(void*)realloc(
+ DUMMY_PRIV(self)->buf_planar,
+ blocks * CONV_BLOCK_SIZE
+ );
+ assert( DUMMY_PRIV(self)->buf_planar );
+ if( DUMMY_PRIV(self)->buf_planar == NULL ) {
+ return( 0-ERR_NO_MEM );
+ }
+ DUMMY_PRIV(self)->size_buf_planar = blocks * CONV_BLOCK_SIZE;
}
- DUMMY_PRIV(self)->size_buf_planar = blocks * CONV_BLOCK_SIZE;
- }
- stdform.fd_addr = DUMMY_PRIV(self)->buf_planar;
+ stdform.fd_addr = DUMMY_PRIV(self)->buf_planar;
+ }
}
stdform.fd_w = dststride;
stdform.fd_h = clip->g_h;
@@ -1064,45 +1115,71 @@
stdform.fd_nplanes = (short)self->bpp_virt;
stdform.fd_r1 = stdform.fd_r2 = stdform.fd_r3 = 0;
- int wdplanesz = stdform.fd_wdwidth*stdform.fd_h;
- int bytestride = (dststride >> 3) * self->bpp_virt;
- unsigned long max = ((char*)stdform.fd_addr)+dstsize;
int img_stride = bitmap_get_rowstride(bm);
- unsigned char rgb[4];
uint32_t prev_pixel = 0x12345678;
- unsigned char prev_col = 1;
- unsigned char col = 0;
- unsigned long bgcol = 0;
+ unsigned long col = 0;
unsigned char val = 0;
+ uint32_t * row;
+ uint32_t pixel;
+ int wdplanesize = stdform.fd_wdwidth*stdform.fd_h;
+
// apply transparency.
- for( y=0; y<clip->g_h; y++ ){
- uint32_t * imgpixel;
- imgpixel = (uint32_t *)(bm->pixdata + (img_stride * (y+clip->g_y)));
- for( x=0; x<clip->g_w; x++ ){
-
- uint32_t pixel = imgpixel[x+clip->g_x];
-
- if( (pixel&0xFF) == 0 ){
- continue;
+ if( transp ){
+ unsigned long bgcol = 0;
+ unsigned char prev_col = 0x12345678;
+
+
+ for( y=0; y<clip->g_h; y++ ){
+
+ row = (uint32_t *)(bm->pixdata + (img_stride * (y+clip->g_y)));
+
+ for( x=0; x<clip->g_w; x++ ){
+
+ pixel = row[x+clip->g_x];
+
+ if( (pixel&0xFF) == 0 ){
+ continue;
+ }
+
+ if( (pixel&0xFF) < 0xF0 ){
+ col = get_stdpx( &stdform, wdplanesize,x,y );
+ if( col != prev_col )
+ bgcol = (((rgb_lookup[col][2] << 16) | (rgb_lookup[col][1] << 8) | (rgb_lookup[col][0]))<<8);
+ if( prev_col != col || prev_pixel != pixel ){
+ prev_col = col;
+ pixel = ablend( pixel, bgcol );
+ prev_pixel = pixel;
+ pixel = pixel >> 8;
+ /* convert pixel value to vdi color index: */
+ col = ( ((pixel&0xFF)<<16)
+ | (pixel&0xFF00)
+ | ((pixel&0xFF0000)>>16) );
+ val = RGB_TO_VDI( col );
+ }
+ set_stdpx( &stdform, wdplanesize, x,y, val );
+ } else {
+ if( pixel != prev_pixel ){
+ /* convert pixel value to vdi color index: */
+ pixel = pixel >> 8;
+ col = ( ((pixel&0xFF)<<16)
+ | (pixel&0xFF00)
+ | ((pixel&0xFF0000)>>16) );
+ val = RGB_TO_VDI( col );
+ prev_pixel = pixel;
+ }
+ set_stdpx( &stdform, wdplanesize, x,y, val );
+ }
}
-
- if( (pixel&0xFF) < 0xF0 ){
- col = get_stdpx( &stdform,x,y );
- if( col != prev_col )
- bgcol = (((rgb_lookup[col][2] << 16) | (rgb_lookup[col][1] << 8) | (rgb_lookup[col][0]))<<8);
- if( prev_col != col || prev_pixel != pixel ){
- prev_col = col;
- pixel = ablend( pixel, bgcol );
- pixel = pixel >> 8;
- /* convert pixel value to vdi color index: */
- col = ( ((pixel&0xFF)<<16)
- | (pixel&0xFF00)
- | ((pixel&0xFF0000)>>16) );
- val = RGB_TO_VDI( col );
- }
- set_stdpx( &stdform, x,y, val );
- } else {
+ }
+ } else {
+ for( y=0; y<clip->g_h; y++ ){
+
+ row = (uint32_t *)(bm->pixdata + (img_stride * (y+clip->g_y)));
+
+ for( x=0; x<clip->g_w; x++ ){
+
+ pixel = row[x+clip->g_x];
if( pixel != prev_pixel ){
/* convert pixel value to vdi color index: */
pixel = pixel >> 8;
@@ -1110,10 +1187,10 @@
| (pixel&0xFF00)
| ((pixel&0xFF0000)>>16) );
val = RGB_TO_VDI( col );
+ prev_pixel = pixel;
}
- set_stdpx( &stdform, x,y, val );
+ set_stdpx( &stdform, wdplanesize, x,y, val );
}
- prev_pixel = pixel;
}
}
@@ -1311,13 +1388,13 @@
return( true );
}
-static int plot_mfdb (GEM_PLOTTER self, GRECT * loc, MFDB * insrc, uint32_t flags)
+static int plot_mfdb (GEM_PLOTTER self, GRECT * loc, MFDB * insrc, unsigned char fgcolor, uint32_t flags)
{
MFDB screen, tran;
MFDB * src;
short pxy[8];
- short c[2] = {OFFSET_CUSTOM_COLOR, WHITE};
+ short c[2] = {fgcolor, WHITE};
GRECT off;
plotter_get_clip_grect( self, &off );
11 years, 5 months
r13366 tlsa - /trunk/netsurf/gtk/Makefile.target
by netsurf@semichrome.net
Author: tlsa
Date: Mon Jan 2 07:42:51 2012
New Revision: 13366
URL: http://source.netsurf-browser.org?rev=13366&view=rev
Log:
s/s/S/
Modified:
trunk/netsurf/gtk/Makefile.target
Modified: trunk/netsurf/gtk/Makefile.target
URL: http://source.netsurf-browser.org/trunk/netsurf/gtk/Makefile.target?rev=1...
==============================================================================
--- trunk/netsurf/gtk/Makefile.target (original)
+++ trunk/netsurf/gtk/Makefile.target Mon Jan 2 07:42:51 2012
@@ -24,7 +24,7 @@
$(eval $(call pkg_config_find_and_add,GIF,libnsgif,GIF))
$(eval $(call pkg_config_find_and_add,PNG,libpng,PNG ))
$(eval $(call pkg_config_find_and_add,VIDEO,gstreamer-0.10,Video))
-$(eval $(call pkg_config_find_and_add,JS,mozilla-js,Javascript))
+$(eval $(call pkg_config_find_and_add,JS,mozilla-js,JavaScript))
# no pkg-config for this library
$(eval $(call feature_enabled,WEBP,-DWITH_WEBP,-lwebp,WebP (libwebp)))
11 years, 5 months
r13365 jmb - /trunk/netsurf/content/urldb.c
by netsurf@semichrome.net
Author: jmb
Date: Mon Jan 2 07:20:11 2012
New Revision: 13365
URL: http://source.netsurf-browser.org?rev=13365&view=rev
Log:
Prevent use after free in cookie update
Modified:
trunk/netsurf/content/urldb.c
Modified: trunk/netsurf/content/urldb.c
URL: http://source.netsurf-browser.org/trunk/netsurf/content/urldb.c?rev=13365...
==============================================================================
--- trunk/netsurf/content/urldb.c (original)
+++ trunk/netsurf/content/urldb.c Mon Jan 2 07:20:11 2012
@@ -2911,7 +2911,6 @@
/* Now insert into database */
if (!urldb_insert_cookie(c, scheme, urlt))
goto error;
- cookies_schedule_update((struct cookie_data *)c);
} while (cur < end);
free(host);
@@ -3393,6 +3392,8 @@
else
p->cookies = c;
p->cookies_end = c;
+
+ cookies_schedule_update((struct cookie_data *)c);
}
return true;
11 years, 5 months