OBS User unknown 2007-01-15 23:06:30 +00:00 committed by Git OBS Bridge
commit affce36a9e
11 changed files with 1265 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.osc

51
bugzilla-104365.patch Normal file
View File

@ -0,0 +1,51 @@
--- cairo-1.2.0/src/cairo-ft-font.c
+++ cairo-1.2.0/src/cairo-ft-font.c
@@ -2154,16 +2154,12 @@
if (options->antialias != CAIRO_ANTIALIAS_DEFAULT)
{
- if (FcPatternGet (pattern, FC_ANTIALIAS, 0, &v) == FcResultNoMatch)
- {
+ FcPatternDel (pattern, FC_ANTIALIAS);
FcPatternAddBool (pattern, FC_ANTIALIAS, options->antialias != CAIRO_ANTIALIAS_NONE);
- }
}
if (options->antialias != CAIRO_ANTIALIAS_DEFAULT)
{
- if (FcPatternGet (pattern, FC_RGBA, 0, &v) == FcResultNoMatch)
- {
int rgba;
if (options->antialias == CAIRO_ANTIALIAS_SUBPIXEL) {
@@ -2187,19 +2183,17 @@
rgba = FC_RGBA_NONE;
}
+ FcPatternDel (pattern, FC_RGBA);
FcPatternAddInteger (pattern, FC_RGBA, rgba);
- }
}
if (options->hint_style != CAIRO_HINT_STYLE_DEFAULT)
{
- if (FcPatternGet (pattern, FC_HINTING, 0, &v) == FcResultNoMatch)
- {
+
+ FcPatternDel (pattern, FC_HINTING);
FcPatternAddBool (pattern, FC_HINTING, options->hint_style != CAIRO_HINT_STYLE_NONE);
- }
#ifdef FC_HINT_STYLE
- if (FcPatternGet (pattern, FC_HINT_STYLE, 0, &v) == FcResultNoMatch)
{
int hint_style;
@@ -2216,6 +2210,7 @@
break;
}
+ FcPatternDel (pattern, FC_HINT_STYLE);
FcPatternAddInteger (pattern, FC_HINT_STYLE, hint_style);
}
#endif

View File

@ -0,0 +1,11 @@
--- ../cairo/src/cairo-xlib-surface.c 2006-01-19 14:55:25.000000000 -0500
+++ ./src/cairo-xlib-surface.c 2006-01-19 14:55:25.000000000 -0500
@@ -675,7 +675,7 @@
ximage.bitmap_unit = 32; /* always for libpixman */
ximage.bitmap_bit_order = native_byte_order;
ximage.bitmap_pad = 32; /* always for libpixman */
- ximage.depth = image->depth;
+ ximage.depth = surface->depth;
ximage.bytes_per_line = image->stride;
ximage.bits_per_pixel = bpp;
ximage.red_mask = red;

View File

@ -0,0 +1,720 @@
diff -urbN cairo-1.2.4-old/src/cairo-ft-font.c cairo-1.2.4/src/cairo-ft-font.c
--- cairo-1.2.4-old/src/cairo-ft-font.c 2006-10-24 11:05:15.000000000 +0200
+++ cairo-1.2.4/src/cairo-ft-font.c 2006-10-24 11:06:45.000000000 +0200
@@ -53,6 +53,8 @@
#include FT_SYNTHESIS_H
#endif
+#include FT_LCD_FILTER_H
+
#define DOUBLE_TO_26_6(d) ((FT_F26Dot6)((d) * 64.0))
#define DOUBLE_FROM_26_6(t) ((double)(t) / 64.0)
#define DOUBLE_TO_16_16(d) ((FT_Fixed)((d) * 65536.0))
@@ -683,23 +685,300 @@
assert (error == 0);
}
-/* Empirically-derived subpixel filtering values thanks to Keith
- * Packard and libXft. */
-static const int filters[3][3] = {
- /* red */
-#if 0
- { 65538*4/7,65538*2/7,65538*1/7 },
- /* green */
- { 65536*1/4, 65536*2/4, 65537*1/4 },
- /* blue */
- { 65538*1/7,65538*2/7,65538*4/7 },
+/* we sometimes need to convert the glyph bitmap in a FT_GlyphSlot
+ * into a different format. For example, we want to convert a
+ * FT_PIXEL_MODE_LCD or FT_PIXEL_MODE_LCD_V bitmap into a 32-bit
+ * ARGB or ABGR bitmap.
+ *
+ * this function prepares a target descriptor for this operation.
+ *
+ * input :: target bitmap descriptor. The function will set its
+ * 'width', 'rows' and 'pitch' fields, and only these
+ *
+ * slot :: the glyph slot containing the source bitmap. this
+ * function assumes that slot->format == FT_GLYPH_FORMAT_BITMAP
+ *
+ * mode :: the requested final rendering mode. supported values are
+ * MONO, NORMAL (i.e. gray), LCD and LCD_V
+ *
+ * the function returns the size in bytes of the corresponding buffer,
+ * it's up to the caller to allocate the corresponding memory block
+ * before calling _fill_xrender_bitmap
+ *
+ * it also returns -1 in case of error (e.g. incompatible arguments,
+ * like trying to convert a gray bitmap into a monochrome one)
+ */
+static int
+_compute_xrender_bitmap_size( FT_Bitmap* target,
+ FT_GlyphSlot slot,
+ FT_Render_Mode mode )
+{
+ FT_Bitmap* ftbit;
+ int width, height, pitch;
+
+ if ( slot->format != FT_GLYPH_FORMAT_BITMAP )
+ return -1;
+
+ // compute the size of the final bitmap
+ ftbit = &slot->bitmap;
+
+ width = ftbit->width;
+ height = ftbit->rows;
+ pitch = (width+3) & ~3;
+
+ switch ( ftbit->pixel_mode )
+ {
+ case FT_PIXEL_MODE_MONO:
+ if ( mode == FT_RENDER_MODE_MONO )
+ {
+ pitch = (((width+31) & ~31) >> 3);
+ break;
+ }
+ /* fall-through */
+
+ case FT_PIXEL_MODE_GRAY:
+ if ( mode == FT_RENDER_MODE_LCD ||
+ mode == FT_RENDER_MODE_LCD_V )
+ {
+ /* each pixel is replicated into a 32-bit ARGB value */
+ pitch = width*4;
+ }
+ break;
+
+ case FT_PIXEL_MODE_LCD:
+ if ( mode != FT_RENDER_MODE_LCD )
+ return -1;
+
+ /* horz pixel triplets are packed into 32-bit ARGB values */
+ width /= 3;
+ pitch = width*4;
+ break;
+
+ case FT_PIXEL_MODE_LCD_V:
+ if ( mode != FT_RENDER_MODE_LCD_V )
+ return -1;
+
+ /* vert pixel triplets are packed into 32-bit ARGB values */
+ height /= 3;
+ pitch = width*4;
+ break;
+
+ default: /* unsupported source format */
+ return -1;
+ }
+
+ target->width = width;
+ target->rows = height;
+ target->pitch = pitch;
+ target->buffer = NULL;
+
+ return pitch * height;
+}
+
+/* this functions converts the glyph bitmap found in a FT_GlyphSlot
+ * into a different format (see _compute_xrender_bitmap_size)
+ *
+ * you should call this function after _compute_xrender_bitmap_size
+ *
+ * target :: target bitmap descriptor. Note that its 'buffer' pointer
+ * must point to memory allocated by the caller
+ *
+ * slot :: the glyph slot containing the source bitmap
+ *
+ * mode :: the requested final rendering mode
+ *
+ * bgr :: boolean, set if BGR or VBGR pixel ordering is needed
+ */
+static void
+_fill_xrender_bitmap( FT_Bitmap* target,
+ FT_GlyphSlot slot,
+ FT_Render_Mode mode,
+ int bgr )
+{
+ FT_Bitmap* ftbit = &slot->bitmap;
+ unsigned char* srcLine = ftbit->buffer;
+ unsigned char* dstLine = target->buffer;
+ int src_pitch = ftbit->pitch;
+ int width = target->width;
+ int height = target->rows;
+ int pitch = target->pitch;
+ int subpixel;
+ int h;
+
+ subpixel = ( mode == FT_RENDER_MODE_LCD ||
+ mode == FT_RENDER_MODE_LCD_V );
+
+ if ( src_pitch < 0 )
+ srcLine -= src_pitch*(ftbit->rows-1);
+
+ target->pixel_mode = ftbit->pixel_mode;
+
+ switch ( ftbit->pixel_mode )
+ {
+ case FT_PIXEL_MODE_MONO:
+ if ( subpixel ) /* convert mono to ARGB32 values */
+ {
+ for ( h = height; h > 0; h--, srcLine += src_pitch, dstLine += pitch )
+ {
+ int x;
+
+ for ( x = 0; x < width; x++ )
+ {
+ if ( srcLine[(x >> 3)] & (0x80 >> (x & 7)) )
+ ((unsigned int*)dstLine)[x] = 0xffffffffU;
+ }
+ }
+ target->pixel_mode = FT_PIXEL_MODE_LCD;
+ }
+ else if ( mode == FT_RENDER_MODE_NORMAL ) /* convert mono to 8-bit gray */
+ {
+ for ( h = height; h > 0; h--, srcLine += src_pitch, dstLine += pitch )
+ {
+ int x;
+
+ for ( x = 0; x < width; x++ )
+ {
+ if ( srcLine[(x >> 3)] & (0x80 >> (x & 7)) )
+ dstLine[x] = 0xff;
+ }
+ }
+ target->pixel_mode = FT_PIXEL_MODE_GRAY;
+ }
+ else /* copy mono to mono */
+ {
+ int bytes = (width+7) >> 3;
+
+ for ( h = height; h > 0; h--, srcLine += src_pitch, dstLine += pitch )
+ memcpy( dstLine, srcLine, bytes );
+ }
+ break;
+
+ case FT_PIXEL_MODE_GRAY:
+ if ( subpixel ) /* convert gray to ARGB32 values */
+ {
+ for ( h = height; h > 0; h--, srcLine += src_pitch, dstLine += pitch )
+ {
+ int x;
+ unsigned int* dst = (unsigned int*)dstLine;
+
+ for ( x = 0; x < width; x++ )
+ {
+ unsigned int pix = srcLine[x];
+
+ pix |= (pix << 8);
+ pix |= (pix << 16);
+
+ dst[x] = pix;
+ }
+ }
+ target->pixel_mode = FT_PIXEL_MODE_LCD;
+ }
+ else /* copy gray into gray */
+ {
+ for ( h = height; h > 0; h--, srcLine += src_pitch, dstLine += pitch )
+ memcpy( dstLine, srcLine, width );
+ }
+ break;
+
+ case FT_PIXEL_MODE_LCD:
+ if ( !bgr )
+ {
+ /* convert horizontal RGB into ARGB32 */
+ for ( h = height; h > 0; h--, srcLine += src_pitch, dstLine += pitch )
+ {
+ int x;
+ unsigned char* src = srcLine;
+ unsigned int* dst = (unsigned int*)dstLine;
+
+ for ( x = 0; x < width; x++, src += 3 )
+ {
+ unsigned int pix;
+
+ pix = ((unsigned int)src[0] << 16) |
+ ((unsigned int)src[1] << 8) |
+ ((unsigned int)src[2] ) |
+ ((unsigned int)src[1] << 24) ;
+
+ dst[x] = pix;
+ }
+ }
+ }
+ else
+ {
+ /* convert horizontal BGR into ARGB32 */
+ for ( h = height; h > 0; h--, srcLine += src_pitch, dstLine += pitch )
+ {
+ int x;
+ unsigned char* src = srcLine;
+ unsigned int* dst = (unsigned int*)dstLine;
+
+ for ( x = 0; x < width; x++, src += 3 )
+ {
+ unsigned int pix;
+
+ pix = ((unsigned int)src[2] << 16) |
+ ((unsigned int)src[1] << 8) |
+ ((unsigned int)src[0] ) |
+ ((unsigned int)src[1] << 24) ;
+
+ dst[x] = pix;
+ }
+ }
+ }
+ break;
+
+ default: /* FT_PIXEL_MODE_LCD_V */
+ /* convert vertical RGB into ARGB32 */
+ if ( !bgr )
+ {
+ for ( h = height; h > 0; h--, srcLine += 3*src_pitch, dstLine += pitch )
+ {
+ int x;
+ unsigned char* src = srcLine;
+ unsigned int* dst = (unsigned int*)dstLine;
+
+ for ( x = 0; x < width; x++, src += 1 )
+ {
+ unsigned int pix;
+#if 1
+ pix = ((unsigned int)src[0] << 16) |
+ ((unsigned int)src[src_pitch] << 8) |
+ ((unsigned int)src[src_pitch*2] ) |
+ 0xFF000000 ;
+#else
+ pix = ((unsigned int)src[0] << 16) |
+ ((unsigned int)src[src_pitch] << 8) |
+ ((unsigned int)src[src_pitch*2] ) |
+ ((unsigned int)src[src_pitch] << 24) ;
#endif
- { 65538*9/13,65538*3/13,65538*1/13 },
- /* green */
- { 65538*1/6, 65538*4/6, 65538*1/6 },
- /* blue */
- { 65538*1/13,65538*3/13,65538*9/13 },
-};
+ dst[x] = pix;
+ }
+ }
+ }
+ else
+ {
+ for ( h = height; h > 0; h--, srcLine += 3*src_pitch, dstLine += pitch )
+ {
+ int x;
+ unsigned char* src = srcLine;
+ unsigned int* dst = (unsigned int*)dstLine;
+
+ for ( x = 0; x < width; x++, src += 1 )
+ {
+ unsigned int pix;
+
+ pix = ((unsigned int)src[src_pitch*2] << 16) |
+ ((unsigned int)src[src_pitch] << 8) |
+ ((unsigned int)src[0] ) |
+ ((unsigned int)src[src_pitch] << 24) ;
+
+ dst[x] = pix;
+ }
+ }
+ }
+ }
+}
+
/* Fills in val->image with an image surface created from @bitmap
*/
@@ -712,12 +991,14 @@
int width, height, stride;
unsigned char *data;
int format = CAIRO_FORMAT_A8;
- cairo_bool_t subpixel = FALSE;
+ cairo_image_surface_t *image;
width = bitmap->width;
height = bitmap->rows;
- switch (bitmap->pixel_mode) {
+ {
+ switch (bitmap->pixel_mode)
+ {
case FT_PIXEL_MODE_MONO:
stride = (((width + 31) & ~31) >> 3);
if (own_buffer) {
@@ -745,7 +1026,6 @@
}
}
}
-
#ifndef WORDS_BIGENDIAN
{
unsigned char *d = data;
@@ -757,17 +1037,15 @@
}
}
#endif
+
format = CAIRO_FORMAT_A1;
break;
case FT_PIXEL_MODE_LCD:
case FT_PIXEL_MODE_LCD_V:
case FT_PIXEL_MODE_GRAY:
- switch (font_options->antialias) {
- case CAIRO_ANTIALIAS_DEFAULT:
- case CAIRO_ANTIALIAS_GRAY:
- case CAIRO_ANTIALIAS_NONE:
- default:
+ if (font_options->antialias != CAIRO_ANTIALIAS_SUBPIXEL)
+ {
stride = bitmap->pitch;
if (own_buffer) {
data = bitmap->buffer;
@@ -778,101 +1056,19 @@
memcpy (data, bitmap->buffer, stride * height);
}
format = CAIRO_FORMAT_A8;
- break;
- case CAIRO_ANTIALIAS_SUBPIXEL: {
- int x, y;
- unsigned char *in_line, *out_line, *in;
- unsigned int *out;
- unsigned int red, green, blue;
- int rf, gf, bf;
- int s;
- int o, os;
- unsigned char *data_rgba;
- unsigned int width_rgba, stride_rgba;
- int vmul = 1;
- int hmul = 1;
+ } else {
+ // if we get there, the data from the source bitmap
+ // really comes from _fill_xrender_bitmap, and is
+ // made of 32-bit ARGB or ABGR values
+ assert(own_buffer != 0);
+ assert(bitmap->pixel_mode != FT_PIXEL_MODE_GRAY);
- switch (font_options->subpixel_order) {
- case CAIRO_SUBPIXEL_ORDER_DEFAULT:
- case CAIRO_SUBPIXEL_ORDER_RGB:
- case CAIRO_SUBPIXEL_ORDER_BGR:
- default:
- width /= 3;
- hmul = 3;
- break;
- case CAIRO_SUBPIXEL_ORDER_VRGB:
- case CAIRO_SUBPIXEL_ORDER_VBGR:
- vmul = 3;
- height /= 3;
- break;
- }
- /*
- * Filter the glyph to soften the color fringes
- */
- width_rgba = width;
+ data = bitmap->buffer;
stride = bitmap->pitch;
- stride_rgba = (width_rgba * 4 + 3) & ~3;
- data_rgba = calloc (1, stride_rgba * height);
-
- os = 1;
- switch (font_options->subpixel_order) {
- case CAIRO_SUBPIXEL_ORDER_VRGB:
- os = stride;
- case CAIRO_SUBPIXEL_ORDER_DEFAULT:
- case CAIRO_SUBPIXEL_ORDER_RGB:
- default:
- rf = 0;
- gf = 1;
- bf = 2;
- break;
- case CAIRO_SUBPIXEL_ORDER_VBGR:
- os = stride;
- case CAIRO_SUBPIXEL_ORDER_BGR:
- bf = 0;
- gf = 1;
- rf = 2;
- break;
- }
- in_line = bitmap->buffer;
- out_line = data_rgba;
- for (y = 0; y < height; y++)
- {
- in = in_line;
- out = (unsigned int *) out_line;
- in_line += stride * vmul;
- out_line += stride_rgba;
- for (x = 0; x < width * hmul; x += hmul)
- {
- red = green = blue = 0;
- o = 0;
- for (s = 0; s < 3; s++)
- {
- red += filters[rf][s]*in[x+o];
- green += filters[gf][s]*in[x+o];
- blue += filters[bf][s]*in[x+o];
- o += os;
- }
- red = red / 65536;
- green = green / 65536;
- blue = blue / 65536;
- *out++ = (green << 24) | (red << 16) | (green << 8) | blue;
- }
- }
-
- /* Images here are stored in native format. The
- * backend must convert to its own format as needed
- */
-
- if (own_buffer)
- free (bitmap->buffer);
- data = data_rgba;
- stride = stride_rgba;
format = CAIRO_FORMAT_ARGB32;
- subpixel = TRUE;
- break;
- }
}
break;
+
case FT_PIXEL_MODE_GRAY2:
case FT_PIXEL_MODE_GRAY4:
/* These could be triggered by very rare types of TrueType fonts */
@@ -880,20 +1076,21 @@
return CAIRO_STATUS_NO_MEMORY;
}
- *surface = (cairo_image_surface_t *)
+ /* XXX */
+ *surface = image = (cairo_image_surface_t *)
cairo_image_surface_create_for_data (data,
format,
width, height, stride);
- if ((*surface)->base.status) {
+ if (image->base.status) {
free (data);
return CAIRO_STATUS_NO_MEMORY;
}
- if (subpixel)
- pixman_image_set_component_alpha ((*surface)->pixman_image, TRUE);
-
- _cairo_image_surface_assume_ownership_of_data ((*surface));
+ if (font_options->antialias == CAIRO_ANTIALIAS_SUBPIXEL)
+ pixman_image_set_component_alpha (image->pixman_image, TRUE);
+ _cairo_image_surface_assume_ownership_of_data (image);
+ }
return CAIRO_STATUS_SUCCESS;
}
@@ -917,16 +1114,44 @@
cairo_font_options_t *font_options,
cairo_image_surface_t **surface)
{
+ int rgba = FC_RGBA_UNKNOWN;
FT_GlyphSlot glyphslot = face->glyph;
FT_Outline *outline = &glyphslot->outline;
FT_Bitmap bitmap;
FT_BBox cbox;
- FT_Matrix matrix;
- int hmul = 1;
- int vmul = 1;
unsigned int width, height, stride;
- cairo_bool_t subpixel = FALSE;
+ cairo_format_t format;
cairo_status_t status;
+ FT_Error fterror;
+ FT_Library library = glyphslot->library;
+ FT_Render_Mode render_mode = FT_RENDER_MODE_NORMAL;
+
+ switch (font_options->antialias)
+ {
+ case CAIRO_ANTIALIAS_NONE:
+ render_mode = FT_RENDER_MODE_MONO;
+ break;
+
+ case CAIRO_ANTIALIAS_SUBPIXEL:
+ switch (font_options->subpixel_order)
+ {
+ case CAIRO_SUBPIXEL_ORDER_DEFAULT:
+ case CAIRO_SUBPIXEL_ORDER_RGB:
+ case CAIRO_SUBPIXEL_ORDER_BGR:
+ render_mode = FT_RENDER_MODE_LCD;
+ break;
+
+ case CAIRO_SUBPIXEL_ORDER_VRGB:
+ case CAIRO_SUBPIXEL_ORDER_VBGR:
+ render_mode = FT_RENDER_MODE_LCD_V;
+ break;
+ }
+ break;
+
+ case CAIRO_ANTIALIAS_DEFAULT:
+ case CAIRO_ANTIALIAS_GRAY:
+ render_mode = FT_RENDER_MODE_NORMAL;
+ }
FT_Outline_Get_CBox (outline, &cbox);
@@ -937,98 +1162,90 @@
width = (unsigned int) ((cbox.xMax - cbox.xMin) >> 6);
height = (unsigned int) ((cbox.yMax - cbox.yMin) >> 6);
- stride = (width * hmul + 3) & ~3;
+ stride = (width + 3) & ~3;
if (width * height == 0) {
- cairo_format_t format;
/* Looks like fb handles zero-sized images just fine */
- switch (font_options->antialias) {
- case CAIRO_ANTIALIAS_NONE:
+ switch (render_mode)
+ {
+ case FT_RENDER_MODE_MONO:
format = CAIRO_FORMAT_A1;
break;
- case CAIRO_ANTIALIAS_SUBPIXEL:
- format= CAIRO_FORMAT_ARGB32;
+ case FT_RENDER_MODE_LCD:
+ case FT_RENDER_MODE_LCD_V:
+ format = CAIRO_FORMAT_ARGB32;
break;
- case CAIRO_ANTIALIAS_DEFAULT:
- case CAIRO_ANTIALIAS_GRAY:
default:
format = CAIRO_FORMAT_A8;
- break;
}
(*surface) = (cairo_image_surface_t *)
cairo_image_surface_create_for_data (NULL, format, 0, 0, 0);
if ((*surface)->base.status)
return CAIRO_STATUS_NO_MEMORY;
+
} else {
- matrix.xx = matrix.yy = 0x10000L;
- matrix.xy = matrix.yx = 0;
+ int bitmap_size;
- switch (font_options->antialias) {
- case CAIRO_ANTIALIAS_NONE:
- bitmap.pixel_mode = FT_PIXEL_MODE_MONO;
- bitmap.num_grays = 1;
- stride = ((width + 31) & -32) >> 3;
+ switch (render_mode)
+ {
+ case FT_RENDER_MODE_LCD:
+ if (font_options->subpixel_order == CAIRO_SUBPIXEL_ORDER_BGR ) {
+ rgba = FC_RGBA_BGR;
+ } else {
+ rgba = FC_RGBA_RGB;
+ }
break;
- case CAIRO_ANTIALIAS_DEFAULT:
- case CAIRO_ANTIALIAS_GRAY:
- bitmap.pixel_mode = FT_PIXEL_MODE_GRAY;
- bitmap.num_grays = 256;
- stride = (width + 3) & -4;
+
+ case FT_RENDER_MODE_LCD_V:
+ if (font_options->subpixel_order == CAIRO_SUBPIXEL_ORDER_VBGR ) {
+ rgba = FC_RGBA_VBGR;
+ } else {
+ rgba = FC_RGBA_VRGB;
+ }
break;
- case CAIRO_ANTIALIAS_SUBPIXEL:
- switch (font_options->subpixel_order) {
- case CAIRO_SUBPIXEL_ORDER_RGB:
- case CAIRO_SUBPIXEL_ORDER_BGR:
- case CAIRO_SUBPIXEL_ORDER_DEFAULT:
+
default:
- matrix.xx *= 3;
- hmul = 3;
- subpixel = TRUE;
- break;
- case CAIRO_SUBPIXEL_ORDER_VRGB:
- case CAIRO_SUBPIXEL_ORDER_VBGR:
- matrix.yy *= 3;
- vmul = 3;
- subpixel = TRUE;
- break;
+ ;
}
- FT_Outline_Transform (outline, &matrix);
- bitmap.pixel_mode = FT_PIXEL_MODE_GRAY;
- bitmap.num_grays = 256;
- stride = (width * hmul + 3) & -4;
- }
+ FT_Library_SetLcdFilter( library, FT_LCD_FILTER_DEFAULT );
- bitmap.pitch = stride;
- bitmap.width = width * hmul;
- bitmap.rows = height * vmul;
- bitmap.buffer = calloc (1, stride * bitmap.rows);
+ fterror = FT_Render_Glyph( face->glyph, render_mode );
- if (bitmap.buffer == NULL) {
+ FT_Library_SetLcdFilter( library, FT_LCD_FILTER_NONE );
+
+ if (fterror != 0)
return CAIRO_STATUS_NO_MEMORY;
- }
- FT_Outline_Translate (outline, -cbox.xMin*hmul, -cbox.yMin*vmul);
+ bitmap_size = _compute_xrender_bitmap_size( &bitmap,
+ face->glyph,
+ render_mode );
+ if ( bitmap_size < 0 )
+ return CAIRO_STATUS_NO_MEMORY;
- if (FT_Outline_Get_Bitmap (glyphslot->library, outline, &bitmap) != 0) {
- free (bitmap.buffer);
+ bitmap.buffer = calloc(1, bitmap_size);
+ if (bitmap.buffer == NULL) {
return CAIRO_STATUS_NO_MEMORY;
}
+ _fill_xrender_bitmap( &bitmap, face->glyph, render_mode,
+ (rgba == FC_RGBA_BGR || rgba == FC_RGBA_VBGR) );
+
+ // NOTE: _get_bitmap_surface will free bitmap.buffer if there is an error
status = _get_bitmap_surface (&bitmap, TRUE, font_options, surface);
if (status)
return status;
- }
/*
* Note: the font's coordinate system is upside down from ours, so the
* Y coordinate of the control box needs to be negated.
*/
cairo_surface_set_device_offset (&(*surface)->base,
- floor ((double) cbox.xMin / 64.0),
- floor (-(double) cbox.yMax / 64.0));
+ (double) glyphslot->bitmap_left,
+ (double)-glyphslot->bitmap_top);
+ }
return CAIRO_STATUS_SUCCESS;
}
@@ -1389,11 +1606,11 @@
case CAIRO_SUBPIXEL_ORDER_DEFAULT:
case CAIRO_SUBPIXEL_ORDER_RGB:
case CAIRO_SUBPIXEL_ORDER_BGR:
- load_target |= FT_LOAD_TARGET_LCD;
+ load_target = FT_LOAD_TARGET_LCD;
break;
case CAIRO_SUBPIXEL_ORDER_VRGB:
case CAIRO_SUBPIXEL_ORDER_VBGR:
- load_target |= FT_LOAD_TARGET_LCD_V;
+ load_target = FT_LOAD_TARGET_LCD_V;
break;
}
}

3
cairo-1.2.4.tar.bz2 Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:44088c499e0d6be0a207275e4c333aa016b117ad03c90a8453ad254fd5680be3
size 2415658

19
cairo-defines.patch Normal file
View File

@ -0,0 +1,19 @@
Index: cairo-1.0.2/pixman/src/slim_internal.h
===================================================================
--- cairo-1.0.2.orig/pixman/src/slim_internal.h
+++ cairo-1.0.2/pixman/src/slim_internal.h
@@ -78,9 +78,11 @@
level. */
#if __GNUC__ >= 3 && defined(__ELF__)
-# define slim_hidden_proto(name) slim_hidden_proto1(name, INT_##name)
-# define slim_hidden_def(name) slim_hidden_def1(name, INT_##name)
-# define slim_hidden_proto1(name, internal) \
+# define slim_hidden_proto(name) slim_hidden_protoX(name)
+# define slim_hidden_def(name) slim_hidden_defX(name)
+# define slim_hidden_protoX(name) slim_hidden_proto1(name, INT_##name)
+# define slim_hidden_defX(name) slim_hidden_def1(name, INT_##name)
+# define slim_hidden_proto1(name, internal) \
extern __typeof (name) name \
__asm__ (slim_hidden_asmname (internal)) \
pixman_private;

View File

@ -0,0 +1,13 @@
--- configure.in
+++ configure.in
@@ -471,6 +471,10 @@
*) PKGCONFIG_REQUIRES="Requires.private"; ;;
esac
+# Hack. Don't use Requires.private, as otherwise f.i. the freetype
+# include patchs will be missing from the --cflags output for gtk+-2.0
+PKGCONFIG_REQUIRES="Requires"
+
AC_SUBST(PKGCONFIG_REQUIRES)
dnl ===========================================================================

202
cairo.changes Normal file
View File

@ -0,0 +1,202 @@
-------------------------------------------------------------------
Tue Oct 24 22:58:14 CEST 2006 - jhargadon@suse.de
- update to version 1.2.4
- fixed several rendering bugs
- add cairo-1.2.4-lcd-filter-1.patch to resolve bug #213989
-------------------------------------------------------------------
Thu Sep 14 17:35:13 CEST 2006 - sbrabec@suse.cz
- Create correct dependencies in older products.
-------------------------------------------------------------------
Fri Aug 18 00:32:31 CEST 2006 - jhargadon@suse.de
- update to version 1.2.2
- Fix crashes with BGR X servers
- Fix the "disappearing text" bug
- Fix broken image fallback scaling
- Fix inadvertent semantic change of font matrix translation
- Fix create_similar to preserve fallback resolution and font options
-------------------------------------------------------------------
Wed Aug 16 15:54:33 CEST 2006 - gekker@suse.de
- Disable gtk-doc, it comes prebuilt and this decreases build deps
-------------------------------------------------------------------
Fri Jul 28 20:32:21 CEST 2006 - gekker@suse.de
- Update to version 1.2.0
- Remove upstreamed patches
- API addition: cairo_xlib_surface_get_width,cairo_xlib_surface_get_height
- new features:
Dots can now be drawn by using CAIRO_LINE_CAP_ROUND with
degenerate sub-paths, (cairo_move_to() followed by either
cairo_close_path() or a cairo_line_to() to the same location).
- many bugfixes
-------------------------------------------------------------------
Fri May 12 22:54:47 CEST 2006 - joeshaw@suse.de
- Add a patch to fix a crash in Nautilus, backported from 1.0.4.
bnc #174152
-------------------------------------------------------------------
Fri Apr 28 18:46:08 CEST 2006 - mfabian@suse.de
- Bugzilla #104365: delete fontconfig pattern elements before
trying to add them if the intention is to override default
settings.
-------------------------------------------------------------------
Thu Mar 23 22:16:32 CET 2006 - gekker@suse.de
- Fixes cairo crash in evolution with specific mails (#159675)
- CVE-2006-0528
-------------------------------------------------------------------
Fri Jan 27 01:06:04 CET 2006 - ro@suse.de
- use -fstack-protector (merged from meissner)
-------------------------------------------------------------------
Fri Jan 27 01:04:48 CET 2006 - mls@suse.de
- converted neededforbuild to BuildRequires
-------------------------------------------------------------------
Wed Jan 25 11:53:15 CET 2006 - sbrabec@suse.cz
- Removed Xlib version fb repeating picture bug check (#100469).
-------------------------------------------------------------------
Mon Jan 23 16:55:42 CET 2006 - dreveman@suse.de
- Fix 16bpp issue.
-------------------------------------------------------------------
Wed Jan 11 12:58:11 CET 2006 - sbrabec@suse.cz
- Do not require libpixman, it's included now.
- Obsolete no longer needed libpixman.
-------------------------------------------------------------------
Wed Nov 23 19:18:41 CET 2005 - gekker@suse.de
- Fix broken build (Thanks to Richard Guenther for the patch).
-------------------------------------------------------------------
Tue Nov 1 18:03:03 CET 2005 - sbrabec@suse.cz
- Updated to version 1.0.2.
-------------------------------------------------------------------
Tue Oct 4 14:26:10 CEST 2005 - sbrabec@suse.cz
- Enabled ps and pdf backends (#120049).
-------------------------------------------------------------------
Fri Sep 9 10:46:04 CEST 2005 - sbrabec@suse.cz
- Re-enabled glitz backend (#116075).
-------------------------------------------------------------------
Sat Sep 3 00:09:55 CEST 2005 - matz@suse.de
- Fix last change.
-------------------------------------------------------------------
Fri Sep 2 22:25:43 CEST 2005 - gekker@suse.de
- Remove Requires.private from the cairo.pc file as it causes
build failures in gcc.
-------------------------------------------------------------------
Thu Sep 1 19:44:25 CEST 2005 - gekker@suse.de
- Update to released version 1.0.0
- Remove upsteamed patch
-------------------------------------------------------------------
Tue Aug 30 15:06:37 CEST 2005 - mfabian@suse.de
- Bugzilla #113602: add patch from bugzilla.gnome.org to
fix crashes in pangocairo. See also:
http://bugzilla.gnome.org/show_bug.cgi?id=313685
http://bugzilla.gnome.org/attachment.cgi?id=50878&action=view
-------------------------------------------------------------------
Mon Aug 29 16:13:45 CEST 2005 - mfabian@suse.de
- Bugzilla #113545: add patch by Zhe Su to support embedded
bitmaps.
-------------------------------------------------------------------
Thu Aug 18 13:57:14 CEST 2005 - kukuk@suse.de
- RPM can calculate dependencies much better than using a
hardcoded list
-------------------------------------------------------------------
Wed Aug 17 18:45:51 CEST 2005 - gekker@suse.de
- Update to version 0.9.2
-------------------------------------------------------------------
Wed Aug 3 17:40:31 CEST 2005 - sbrabec@suse.cz
- Xlib version fb repeating picture bug check update (#100469).
-------------------------------------------------------------------
Tue Aug 2 02:56:14 CEST 2005 - gekker@suse.de
- Fix requirements
-------------------------------------------------------------------
Mon Aug 1 18:49:24 CEST 2005 - gekker@suse.de
- Updated to version 0.6.0.
-------------------------------------------------------------------
Wed Jun 1 17:48:46 CEST 2005 - sbrabec@suse.cz
- Updated to version 0.5.0.
-------------------------------------------------------------------
Wed Jun 1 15:43:41 CEST 2005 - sbrabec@suse.cz
- Fixed devel requirements.
-------------------------------------------------------------------
Mon May 9 18:28:01 CEST 2005 - sbrabec@suse.cz
- Packaged license files.
-------------------------------------------------------------------
Mon May 9 17:56:07 CEST 2005 - sbrabec@suse.cz
- Updated to version 0.4.0.
-------------------------------------------------------------------
Wed Jan 26 19:07:56 CET 2005 - sbrabec@suse.cz
- Updated to version 0.3.0.
-------------------------------------------------------------------
Wed Jan 26 11:41:29 CET 2005 - meissner@suse.de
- Added libpng-devel-packages to nfb #49052
-------------------------------------------------------------------
Wed May 19 19:15:33 CEST 2004 - clahey@suse.de
- Updated to 0.1.23.
-------------------------------------------------------------------
Tue Apr 20 13:53:51 CEST 2004 - uli@suse.de
- initial package

222
cairo.spec Normal file
View File

@ -0,0 +1,222 @@
#
# spec file for package cairo (Version 1.2.4)
#
# Copyright (c) 2006 SUSE LINUX Products GmbH, Nuernberg, Germany.
# This file and all modifications and additions to the pristine
# package are under the same license as the package itself.
#
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
# norootforbuild
Name: cairo
BuildRequires: freetype2-devel glitz-devel libpng-devel
License: GNU Library General Public License v. 2.0 and 2.1 (LGPL), MOZILLA PUBLIC LICENSE (MPL/NPL)
Group: Development/Libraries/X11
Summary: Vector Graphics Library with Cross-Device Output Support
URL: http://cairographics.org/
Version: 1.2.4
Release: 1
Source0: %name-%version.tar.bz2
Patch2: cairo-remove-requires-private.patch
Patch3: cairo-defines.patch
Patch4: cairo-1.0.2-depth-fix-1.patch
Patch6: bugzilla-104365.patch
Patch7: cairo-1.2.4-lcd-filter-1.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Obsoletes: libpixman
%description
Cairo is a vector graphics library with cross-device output support.
Currently supported output targets include the X Window System,
in-memory image buffers, and PostScript. Cairo is designed to produce
identical output on all output media while taking advantage of display
hardware acceleration when available.
Authors:
--------
Carl D. Worth <cworth@isi.edu>
%package devel
Summary: Development environment for cairo
Group: Development/Libraries/X11
Requires: %{name} = %{version} freetype2-devel fontconfig-devel xorg-x11-devel libpng-devel glitz-devel
%if %(rpm -q --queryformat=%{version} xorg-x11-devel | sed 's/\..*$//') >= 7
Requires: xorg-x11-libXrender-devel
%endif
Obsoletes: libpixman-devel
%description devel
This package contains all files necessary to build binaries using
cairo.
Authors:
--------
Carl D. Worth <cworth@isi.edu>
%package doc
Summary: Development environment for cairo
Group: Development/Libraries/X11
Requires: %{name} = %{version}
Requires: gnome-filesystem
%description doc
This package contains all files necessary to build binaries using
cairo.
Authors:
--------
Carl D. Worth <cworth@isi.edu>
%prep
%setup
%patch2
%patch3 -p1
%patch4
#%patch6 -p1
%patch7 -p1
%build
autoconf
%if %suse_version > 1000
export RPM_OPT_FLAGS="$RPM_OPT_FLAGS -fstack-protector"
%endif
export CFLAGS="$RPM_OPT_FLAGS"
./configure\
--prefix=/usr\
--libdir=%{_libdir}\
--mandir=%{_mandir}\
--enable-glitz\
--enable-ps\
--enable-pdf\
--disable-gtk-doc
make %{?jobs:-j %jobs}
%install
make install DESTDIR=$RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT/opt/gnome
mv $RPM_BUILD_ROOT/usr/share $RPM_BUILD_ROOT/opt/gnome
%clean
rm -rf ${RPM_BUILD_ROOT}
%files
%defattr(-, root, root)
%doc AUTHORS COPYING COPYING-LGPL-2.1 COPYING-MPL-1.1 ChangeLog INSTALL NEWS README TODO
%{_libdir}/libcairo.so.*
%files devel
%defattr(-, root, root)
/usr/include/cairo
%{_libdir}/libcairo.*a
%{_libdir}/libcairo.so
%{_libdir}/pkgconfig/*.pc
%files doc
%defattr(-, root, root)
/opt/gnome/share/gtk-doc/html/*
%changelog -n cairo
* Tue Oct 24 2006 - jhargadon@suse.de
- update to version 1.2.4
- fixed several rendering bugs
- add cairo-1.2.4-lcd-filter-1.patch to resolve bug #213989
* Thu Sep 14 2006 - sbrabec@suse.cz
- Create correct dependencies in older products.
* Fri Aug 18 2006 - jhargadon@suse.de
- update to version 1.2.2
- Fix crashes with BGR X servers
- Fix the "disappearing text" bug
- Fix broken image fallback scaling
- Fix inadvertent semantic change of font matrix translation
- Fix create_similar to preserve fallback resolution and font options
* Wed Aug 16 2006 - gekker@suse.de
- Disable gtk-doc, it comes prebuilt and this decreases build deps
* Fri Jul 28 2006 - gekker@suse.de
- Update to version 1.2.0
- Remove upstreamed patches
- API addition: cairo_xlib_surface_get_width,cairo_xlib_surface_get_height
- new features:
Dots can now be drawn by using CAIRO_LINE_CAP_ROUND with
degenerate sub-paths, (cairo_move_to() followed by either
cairo_close_path() or a cairo_line_to() to the same location).
- many bugfixes
* Fri May 12 2006 - joeshaw@suse.de
- Add a patch to fix a crash in Nautilus, backported from 1.0.4.
bnc #174152
* Fri Apr 28 2006 - mfabian@suse.de
- Bugzilla #104365: delete fontconfig pattern elements before
trying to add them if the intention is to override default
settings.
* Thu Mar 23 2006 - gekker@suse.de
- Fixes cairo crash in evolution with specific mails (#159675)
- CVE-2006-0528
* Fri Jan 27 2006 - ro@suse.de
- use -fstack-protector (merged from meissner)
* Fri Jan 27 2006 - mls@suse.de
- converted neededforbuild to BuildRequires
* Wed Jan 25 2006 - sbrabec@suse.cz
- Removed Xlib version fb repeating picture bug check (#100469).
* Mon Jan 23 2006 - dreveman@suse.de
- Fix 16bpp issue.
* Wed Jan 11 2006 - sbrabec@suse.cz
- Do not require libpixman, it's included now.
- Obsolete no longer needed libpixman.
* Wed Nov 23 2005 - gekker@suse.de
- Fix broken build (Thanks to Richard Guenther for the patch).
* Tue Nov 01 2005 - sbrabec@suse.cz
- Updated to version 1.0.2.
* Tue Oct 04 2005 - sbrabec@suse.cz
- Enabled ps and pdf backends (#120049).
* Fri Sep 09 2005 - sbrabec@suse.cz
- Re-enabled glitz backend (#116075).
* Sat Sep 03 2005 - matz@suse.de
- Fix last change.
* Fri Sep 02 2005 - gekker@suse.de
- Remove Requires.private from the cairo.pc file as it causes
build failures in gcc.
* Thu Sep 01 2005 - gekker@suse.de
- Update to released version 1.0.0
- Remove upsteamed patch
* Tue Aug 30 2005 - mfabian@suse.de
- Bugzilla #113602: add patch from bugzilla.gnome.org to
fix crashes in pangocairo. See also:
http://bugzilla.gnome.org/show_bug.cgi?id=313685
http://bugzilla.gnome.org/attachment.cgi?id=50878&action=view
* Mon Aug 29 2005 - mfabian@suse.de
- Bugzilla #113545: add patch by Zhe Su to support embedded
bitmaps.
* Thu Aug 18 2005 - kukuk@suse.de
- RPM can calculate dependencies much better than using a
hardcoded list
* Wed Aug 17 2005 - gekker@suse.de
- Update to version 0.9.2
* Wed Aug 03 2005 - sbrabec@suse.cz
- Xlib version fb repeating picture bug check update (#100469).
* Tue Aug 02 2005 - gekker@suse.de
- Fix requirements
* Mon Aug 01 2005 - gekker@suse.de
- Updated to version 0.6.0.
* Wed Jun 01 2005 - sbrabec@suse.cz
- Updated to version 0.5.0.
* Wed Jun 01 2005 - sbrabec@suse.cz
- Fixed devel requirements.
* Mon May 09 2005 - sbrabec@suse.cz
- Packaged license files.
* Mon May 09 2005 - sbrabec@suse.cz
- Updated to version 0.4.0.
* Wed Jan 26 2005 - sbrabec@suse.cz
- Updated to version 0.3.0.
* Wed Jan 26 2005 - meissner@suse.de
- Added libpng-devel-packages to nfb #49052
* Wed May 19 2004 - clahey@suse.de
- Updated to 0.1.23.
* Tue Apr 20 2004 - uli@suse.de
- initial package

0
ready Normal file
View File