cairo text rendering fixes; remove previous optimistic optimization

This commit is contained in:
vladimir%pobox.com 2006-02-10 22:03:39 +00:00
Родитель 6d068a01b6
Коммит 7d295623b2
7 изменённых файлов: 47 добавлений и 80 удалений

Просмотреть файл

@ -20,7 +20,7 @@ if cairo is enabled. Please upgrade to VC7.1/8.
==== Patches ====
Last update: 09 Feb 2006
Last update: 10 Feb 2006
mozilla-misc.patch
- Misc compilation fixes for pixman (submitted upstream)
@ -47,14 +47,20 @@ cairo-win32-clip.patch
- Rework win32 surface clip and extents handling for correctness
(submitted upstream)
cairo-win32-alphablend.patch (Updated 9 Feb 06)
cairo-win32-expose-dc-and-dib.patch (Updated 10 Feb 06)
- Expose cairo_win32_surface_create_dib() and add
cairo_win32_surface_get_dc() to get at a surface's HDC
cairo-win32-alphablend.patch (Updated 10 Feb 06)
- Use AlphaBlend if the dst surface is either RGB24 or ARGB32, not
just RGB24
- Add cairo_win32_surface_get_dc()
(Submitted upstream: https://bugs.freedesktop.org/show_bug.cgi?id=5845)
- Remove RGB24 format check in fast win32-font.c path (we can still use GDI)
- Removed src->format == dst->format restriction for deciding when
to use BitBlt; it's valid for ARGB32->RGB24 and vice-versa with operator
SOURCE
- Remove RGB24 format check in fast win32-font.c path (we can still use
GDI with ARGB32)
- Add GdiFlush() calls before each image surface get
(Submitted upstream: https://bugs.freedesktop.org/show_bug.cgi?id=5845)
device-offset-scale.patch (Updated 7 Feb 06)
- Move device offset/scale handling into surface layer; large rework

Просмотреть файл

@ -1,7 +1,7 @@
Index: cairo/src/cairo-win32-surface.c
===================================================================
--- cairo.orig/src/cairo-win32-surface.c 2006-02-07 17:14:24.921875000 -0800
+++ cairo/src/cairo-win32-surface.c 2006-02-09 17:57:30.562500000 -0800
--- cairo.orig/src/cairo-win32-surface.c 2006-02-10 11:25:30.047875000 -0800
+++ cairo/src/cairo-win32-surface.c 2006-02-10 11:27:21.984375000 -0800
@@ -132,8 +132,13 @@
bitmap_info->bmiHeader.biPlanes = 1;
@ -62,7 +62,15 @@ Index: cairo/src/cairo-win32-surface.c
return CAIRO_STATUS_SUCCESS;
}
@@ -675,13 +688,13 @@
@@ -665,7 +678,6 @@
return CAIRO_INT_STATUS_UNSUPPORTED;
if (alpha == 255 &&
- src->format == dst->format &&
(op == CAIRO_OPERATOR_SOURCE ||
(src->format == CAIRO_FORMAT_RGB24 && op == CAIRO_OPERATOR_OVER))) {
@@ -675,13 +687,12 @@
src->dc,
src_x + itx, src_y + ity,
SRCCOPY))
@ -71,14 +79,15 @@ Index: cairo/src/cairo-win32-surface.c
return CAIRO_STATUS_SUCCESS;
} else if (integer_transform &&
(src->format == CAIRO_FORMAT_RGB24 || src->format == CAIRO_FORMAT_ARGB32) &&
- } else if (integer_transform &&
- (src->format == CAIRO_FORMAT_RGB24 || src->format == CAIRO_FORMAT_ARGB32) &&
- dst->format == CAIRO_FORMAT_RGB24 &&
+ } else if ((src->format == CAIRO_FORMAT_RGB24 || src->format == CAIRO_FORMAT_ARGB32) &&
+ (dst->format == CAIRO_FORMAT_RGB24 || dst->format == CAIRO_FORMAT_ARGB32) &&
op == CAIRO_OPERATOR_OVER) {
return _composite_alpha_blend (dst, src, alpha,
@@ -783,10 +796,11 @@
@@ -783,10 +794,11 @@
HBRUSH new_brush;
int i;
@ -94,39 +103,7 @@ Index: cairo/src/cairo-win32-surface.c
return CAIRO_INT_STATUS_UNSUPPORTED;
/* Optimize for no destination alpha (surface->pixman_image is non-NULL for all
@@ -1007,6 +1021,31 @@
return surface->backend == &cairo_win32_surface_backend;
}
+/**
+ * cairo_win32_surface_get_dc
+ * @surface: a #cairo_surface_t
+ *
+ * Returns the HDC associated with this surface, or NULL if none.
+ * Also returns NULL if the surface is not a win32 surface.
+ *
+ * Return value: HDC or NULL if no HDC available.
+ **/
+HDC
+cairo_win32_surface_get_dc (cairo_surface_t *surface)
+{
+ cairo_win32_surface_t *winsurf;
+
+ if (surface == NULL)
+ return NULL;
+
+ if (!_cairo_surface_is_win32(surface))
+ return NULL;
+
+ winsurf = (cairo_win32_surface_t *) surface;
+
+ return winsurf->dc;
+}
+
static const cairo_surface_backend_t cairo_win32_surface_backend = {
_cairo_win32_surface_create_similar,
_cairo_win32_surface_finish,
@@ -1026,7 +1065,17 @@
@@ -1051,7 +1063,17 @@
NULL, /* old_show_glyphs */
NULL, /* get_font_options */
_cairo_win32_surface_flush,
@ -145,24 +122,10 @@ Index: cairo/src/cairo-win32-surface.c
};
/*
Index: cairo/src/cairo-win32.h
===================================================================
--- cairo.orig/src/cairo-win32.h 2006-02-07 17:14:24.922875000 -0800
+++ cairo/src/cairo-win32.h 2006-02-07 17:15:20.390625000 -0800
@@ -60,6 +60,9 @@
cairo_public double
cairo_win32_scaled_font_get_metrics_factor (cairo_scaled_font_t *scaled_font);
+cairo_public HDC
+cairo_win32_surface_get_dc (cairo_surface_t *surface);
+
CAIRO_END_DECLS
#else /* CAIRO_HAS_WIN32_SURFACE */
Index: cairo/src/cairo-win32-font.c
===================================================================
--- cairo.orig/src/cairo-win32-font.c 2006-02-09 17:53:51.265625000 -0800
+++ cairo/src/cairo-win32-font.c 2006-02-09 17:54:49.062500000 -0800
--- cairo.orig/src/cairo-win32-font.c 2006-02-10 11:25:30.046875000 -0800
+++ cairo/src/cairo-win32-font.c 2006-02-10 11:26:38.328125000 -0800
@@ -1127,7 +1127,6 @@
return CAIRO_STATUS_SUCCESS;

Просмотреть файл

@ -903,8 +903,8 @@ _cairo_surface_old_show_glyphs_draw_func (void *closure,
op,
src, dst,
extents->x, extents->y,
extents->x - dst_x + dst->device_x_offset,
extents->y - dst_y + dst->device_y_offset,
extents->x - dst_x,
extents->y - dst_y,
extents->width, extents->height,
glyph_info->glyphs,
glyph_info->num_glyphs);

Просмотреть файл

@ -1127,6 +1127,7 @@ _cairo_win32_scaled_font_show_glyphs (void *abstract_font,
return CAIRO_STATUS_SUCCESS;
if (_cairo_surface_is_win32 (generic_surface) &&
surface->format == CAIRO_FORMAT_RGB24 &&
op == CAIRO_OPERATOR_OVER &&
_cairo_pattern_is_opaque_solid (pattern)) {
@ -1159,7 +1160,7 @@ _cairo_win32_scaled_font_show_glyphs (void *abstract_font,
cairo_surface_pattern_t mask;
RECT r;
tmp_surface = (cairo_win32_surface_t *)_cairo_win32_surface_create_dib (CAIRO_FORMAT_ARGB32, width, height);
tmp_surface = (cairo_win32_surface_t *)cairo_win32_surface_create_dib (CAIRO_FORMAT_ARGB32, width, height);
if (tmp_surface->base.status)
return CAIRO_STATUS_NO_MEMORY;
@ -1170,8 +1171,7 @@ _cairo_win32_scaled_font_show_glyphs (void *abstract_font,
FillRect (tmp_surface->dc, &r, GetStockObject (WHITE_BRUSH));
_draw_glyphs_on_surface (tmp_surface, scaled_font, RGB (0, 0, 0),
dest_x - surface->base.device_x_offset,
dest_y - surface->base.device_y_offset,
dest_x, dest_y,
glyphs, num_glyphs);
if (scaled_font->quality == CLEARTYPE_QUALITY) {

Просмотреть файл

@ -70,11 +70,6 @@ typedef struct _cairo_win32_surface {
cairo_status_t
_cairo_win32_print_gdi_error (const char *context);
cairo_surface_t *
_cairo_win32_surface_create_dib (cairo_format_t format,
int width,
int height);
cairo_bool_t
_cairo_surface_is_win32 (cairo_surface_t *surface);

Просмотреть файл

@ -337,9 +337,9 @@ _cairo_win32_surface_create_similar (void *abstract_src,
* be created (probably because of lack of memory)
**/
cairo_surface_t *
_cairo_win32_surface_create_dib (cairo_format_t format,
int width,
int height)
cairo_win32_surface_create_dib (cairo_format_t format,
int width,
int height)
{
return _cairo_win32_surface_create_for_dc (NULL, format, width, height);
}
@ -678,7 +678,6 @@ _cairo_win32_surface_composite (cairo_operator_t op,
return CAIRO_INT_STATUS_UNSUPPORTED;
if (alpha == 255 &&
src->format == dst->format &&
(op == CAIRO_OPERATOR_SOURCE ||
(src->format == CAIRO_FORMAT_RGB24 && op == CAIRO_OPERATOR_OVER))) {
@ -692,8 +691,7 @@ _cairo_win32_surface_composite (cairo_operator_t op,
return CAIRO_STATUS_SUCCESS;
} else if (integer_transform &&
(src->format == CAIRO_FORMAT_RGB24 || src->format == CAIRO_FORMAT_ARGB32) &&
} else if ((src->format == CAIRO_FORMAT_RGB24 || src->format == CAIRO_FORMAT_ARGB32) &&
(dst->format == CAIRO_FORMAT_RGB24 || dst->format == CAIRO_FORMAT_ARGB32) &&
op == CAIRO_OPERATOR_OVER) {

Просмотреть файл

@ -47,6 +47,14 @@ CAIRO_BEGIN_DECLS
cairo_public cairo_surface_t *
cairo_win32_surface_create (HDC hdc);
cairo_public cairo_surface_t *
cairo_win32_surface_create_dib (cairo_format_t format,
int width,
int height);
cairo_public HDC
cairo_win32_surface_get_dc (cairo_surface_t *surface);
cairo_public cairo_font_face_t *
cairo_win32_font_face_create_for_logfontw (LOGFONTW *logfont);
@ -60,9 +68,6 @@ cairo_win32_scaled_font_done_font (cairo_scaled_font_t *scaled_font);
cairo_public double
cairo_win32_scaled_font_get_metrics_factor (cairo_scaled_font_t *scaled_font);
cairo_public HDC
cairo_win32_surface_get_dc (cairo_surface_t *surface);
CAIRO_END_DECLS
#else /* CAIRO_HAS_WIN32_SURFACE */