[cairo-commit] 6 commits - src/cairo-win32-font.c src/cairo-win32.h src/cairo-win32-private.h src/cairo-win32-surface.c

Carl Worth cworth at kemper.freedesktop.org
Thu May 18 17:36:25 PDT 2006


 src/cairo-win32-font.c    |   49 +++++++++++---
 src/cairo-win32-private.h |    1 
 src/cairo-win32-surface.c |  153 ++++++++++++++++++++++++++++++++++++++++++----
 src/cairo-win32.h         |    3 
 4 files changed, 184 insertions(+), 22 deletions(-)

New commits:
diff-tree 9b84b3da58a62b25c129626f918713036e41cc88 (from 2a89526edf1f42dfc3e8592b82a51b9970015bda)
Author: Vladimir Vukicevic <vladimir at cyclone.vlad1.com>
Date:   Fri Mar 17 00:06:21 2006 -0800

    [win32] GDI is nearly always faster than pixman; use it whenever possible
    
    Remove local image check from fill_rectangles and fix check for whether
    we can AlphaBlend or not (ARGB->ARGB AlphaBlend works fine)
    (cherry picked from f099783b3e7f895a59d4d4a67a8534f1d21d44e1 commit)

diff --git a/src/cairo-win32-surface.c b/src/cairo-win32-surface.c
index 7e7d0ee..12486cd 100644
--- a/src/cairo-win32-surface.c
+++ b/src/cairo-win32-surface.c
@@ -143,8 +143,13 @@ _create_dc_and_bitmap (cairo_win32_surfa
     bitmap_info->bmiHeader.biPlanes = 1;
     
     switch (format) {
-    case CAIRO_FORMAT_ARGB32:
+    /* We can't create real RGB24 bitmaps because something seems to
+     * break if we do, especially if we don't set up an image
+     * fallback.  It could be a bug with using a 24bpp pixman image
+     * (and creating one with masks).  So treat them like 32bpp.
+     */
     case CAIRO_FORMAT_RGB24:
+    case CAIRO_FORMAT_ARGB32:
 	bitmap_info->bmiHeader.biBitCount = 32;
 	bitmap_info->bmiHeader.biCompression = BI_RGB;
 	bitmap_info->bmiHeader.biClrUsed = 0;	/* unused */
@@ -698,7 +703,6 @@ _cairo_win32_surface_composite (cairo_op
         height = src->extents.height - src_y;
 
     if (alpha == 255 &&
-	src->format == dst->format &&
 	(op == CAIRO_OPERATOR_SOURCE ||
 	 (src->format == CAIRO_FORMAT_RGB24 && op == CAIRO_OPERATOR_OVER))) {
 	
@@ -712,9 +716,8 @@ _cairo_win32_surface_composite (cairo_op
 
 	return CAIRO_STATUS_SUCCESS;
 	
-    } 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,
@@ -816,10 +819,11 @@ _cairo_win32_surface_fill_rectangles (vo
     HBRUSH new_brush;
     int i;
 
-    /* If we have a local image, use the fallback code; it will be as fast
-     * as calling out to GDI.
-     */
-    if (surface->image)
+    /* XXXperf If it's not RGB24, we need to do a little more checking
+     * to figure out when we can use GDI.  We don't have that checking
+     * anywhere at the moment, so just bail and use the fallback
+     * paths. */
+    if (surface->format != CAIRO_FORMAT_RGB24)
 	return CAIRO_INT_STATUS_UNSUPPORTED;
 
     /* Optimize for no destination alpha (surface->pixman_image is non-NULL for all
diff-tree 2a89526edf1f42dfc3e8592b82a51b9970015bda (from a9c42e8fc264e3d07e4888d5965eea130c1e9d0a)
Author: Vladimir Vukicevic <vladimir at cyclone.vlad1.com>
Date:   Thu Mar 16 14:04:49 2006 -0800

    [win32] Add GdiFlush() calls after DIB creation, as per MSDN docs
    
    Also fixes some spacing/tab issues
    (cherry picked from 123ca7c9f9d8984be5ed4fb42a2897508e8ff44a commit)

diff --git a/src/cairo-win32-surface.c b/src/cairo-win32-surface.c
index 929a80d..7e7d0ee 100644
--- a/src/cairo-win32-surface.c
+++ b/src/cairo-win32-surface.c
@@ -193,6 +193,8 @@ _create_dc_and_bitmap (cairo_win32_surfa
     if (!surface->bitmap)
 	goto FAIL;
 
+    GdiFlush();
+
     surface->saved_dc_bitmap = SelectObject (surface->dc,
 					     surface->bitmap);
     if (!surface->saved_dc_bitmap)
@@ -452,6 +454,8 @@ _cairo_win32_surface_acquire_dest_image 
     int x1, y1, x2, y2;
 
     if (surface->image) {
+	GdiFlush();
+
 	image_rect->x = 0;
 	image_rect->y = 0;
 	image_rect->width = surface->clip_rect.width;
@@ -997,29 +1001,29 @@ _cairo_win32_surface_show_glyphs (void		
 
     /* We can only handle win32 fonts */
     if (cairo_scaled_font_get_type (scaled_font) != CAIRO_SCALED_FONT_TYPE_WIN32)
-        return CAIRO_INT_STATUS_UNSUPPORTED;
+	return CAIRO_INT_STATUS_UNSUPPORTED;
 
     /* We can only handle opaque solid color sources */
     if (!_cairo_pattern_is_opaque_solid(source))
-        return CAIRO_INT_STATUS_UNSUPPORTED;
+	return CAIRO_INT_STATUS_UNSUPPORTED;
 
     /* We can only handle operator SOURCE or OVER with the destination
      * having no alpha */
     if ((op != CAIRO_OPERATOR_SOURCE && op != CAIRO_OPERATOR_OVER) || 
 	(dst->format != CAIRO_FORMAT_RGB24))
-        return CAIRO_INT_STATUS_UNSUPPORTED;
+	return CAIRO_INT_STATUS_UNSUPPORTED;
 
     /* If we have a fallback mask clip set on the dst, we have
      * to go through the fallback path */
     if (dst->base.clip &&
-        (dst->base.clip->mode != CAIRO_CLIP_MODE_REGION ||
-         dst->base.clip->surface != NULL))
+	(dst->base.clip->mode != CAIRO_CLIP_MODE_REGION ||
+	 dst->base.clip->surface != NULL))
 	return CAIRO_INT_STATUS_UNSUPPORTED;
 
     solid_pattern = (cairo_solid_pattern_t *)source;
     color = RGB(((int)solid_pattern->color.red_short) >> 8,
-                ((int)solid_pattern->color.green_short) >> 8,
-                ((int)solid_pattern->color.blue_short) >> 8);
+		((int)solid_pattern->color.green_short) >> 8,
+		((int)solid_pattern->color.blue_short) >> 8);
 
     SaveDC(dst->dc);
 
@@ -1034,7 +1038,7 @@ _cairo_win32_surface_show_glyphs (void		
     }
 
     for (i = 0; i < num_glyphs; ++i) {
-        output_count++;
+	output_count++;
 
 	glyph_buf[i] = glyphs[i].index;
 	if (i == num_glyphs - 1)
@@ -1044,21 +1048,21 @@ _cairo_win32_surface_show_glyphs (void		
 
 
 	if (i == num_glyphs - 1 || glyphs[i].y != glyphs[i+1].y) {
-            const int offset = (i - output_count) + 1;
+	    const int offset = (i - output_count) + 1;
 	    win_result = ExtTextOutW(dst->dc,
-                                     glyphs[offset].x * WIN32_FONT_LOGICAL_SCALE,
-                                     last_y * WIN32_FONT_LOGICAL_SCALE,
-                                     ETO_GLYPH_INDEX,
-                                     NULL,
-                                     glyph_buf + offset,
-                                     output_count,
-                                     dx_buf + offset);
+				     glyphs[offset].x * WIN32_FONT_LOGICAL_SCALE,
+				     last_y * WIN32_FONT_LOGICAL_SCALE,
+				     ETO_GLYPH_INDEX,
+				     NULL,
+				     glyph_buf + offset,
+				     output_count,
+				     dx_buf + offset);
 	    if (!win_result) {
 		_cairo_win32_print_gdi_error("_cairo_win32_surface_show_glyphs(ExtTextOutW failed)");
 		goto FAIL;
 	    }
 
-            output_count = 0;
+	    output_count = 0;
 	}
 
 	last_y = glyphs[i].y;
diff-tree a9c42e8fc264e3d07e4888d5965eea130c1e9d0a (from 59a45f1c4a914c9640bbea37c72b1ec222f56ff3)
Author: Stuart Parmenter <stuart at mozilla.com>
Date:   Wed Mar 15 14:20:35 2006 -0800

    [win32] fix win32_show_glyphs glyph offsets
    (cherry picked from 947a4a1bc6a0a0ee78c44b71fef32c924ebc9397 commit)

diff --git a/src/cairo-win32-surface.c b/src/cairo-win32-surface.c
index 0a84dc4..929a80d 100644
--- a/src/cairo-win32-surface.c
+++ b/src/cairo-win32-surface.c
@@ -988,11 +988,12 @@ _cairo_win32_surface_show_glyphs (void		
     int *dx_buf = dx_buf_stack;
 
     BOOL win_result = 0;
-    int i, last_y_offset = 0;
+    int i;
     double last_y = glyphs[0].y;
 
     cairo_solid_pattern_t *solid_pattern;
     COLORREF color;
+    int output_count = 0;
 
     /* We can only handle win32 fonts */
     if (cairo_scaled_font_get_type (scaled_font) != CAIRO_SCALED_FONT_TYPE_WIN32)
@@ -1033,6 +1034,8 @@ _cairo_win32_surface_show_glyphs (void		
     }
 
     for (i = 0; i < num_glyphs; ++i) {
+        output_count++;
+
 	glyph_buf[i] = glyphs[i].index;
 	if (i == num_glyphs - 1)
 	    dx_buf[i] = 0;
@@ -1041,20 +1044,21 @@ _cairo_win32_surface_show_glyphs (void		
 
 
 	if (i == num_glyphs - 1 || glyphs[i].y != glyphs[i+1].y) {
+            const int offset = (i - output_count) + 1;
 	    win_result = ExtTextOutW(dst->dc,
-                                     glyphs[last_y_offset].x * WIN32_FONT_LOGICAL_SCALE,
+                                     glyphs[offset].x * WIN32_FONT_LOGICAL_SCALE,
                                      last_y * WIN32_FONT_LOGICAL_SCALE,
                                      ETO_GLYPH_INDEX,
                                      NULL,
-                                     glyph_buf + last_y_offset,
-                                     (i - last_y_offset) + 1,
-                                     dx_buf + last_y_offset);
+                                     glyph_buf + offset,
+                                     output_count,
+                                     dx_buf + offset);
 	    if (!win_result) {
 		_cairo_win32_print_gdi_error("_cairo_win32_surface_show_glyphs(ExtTextOutW failed)");
 		goto FAIL;
 	    }
 
-	    last_y_offset = i;
+            output_count = 0;
 	}
 
 	last_y = glyphs[i].y;
diff-tree 59a45f1c4a914c9640bbea37c72b1ec222f56ff3 (from a10bbecaf8f122726c3e5b55b07bcd7882f6f319)
Author: Stuart Parmenter <pavlov at pavlov.net>
Date:   Fri Mar 10 12:25:07 2006 -0800

    [win32] implement win32 show_glyphs
    (cherry picked from 9c7d0cbde415d02b6e8298a02b3b62cf4513a59e commit)

diff --git a/src/cairo-win32-font.c b/src/cairo-win32-font.c
index 1d1d94f..ac455b4 100644
--- a/src/cairo-win32-font.c
+++ b/src/cairo-win32-font.c
@@ -52,8 +52,6 @@
 
 const cairo_scaled_font_backend_t cairo_win32_scaled_font_backend;
 
-#define LOGICAL_SCALE 32
-
 typedef struct {
     cairo_scaled_font_t base;
 
@@ -63,8 +61,8 @@ typedef struct {
 
     /* We do drawing and metrics computation in a "logical space" which
      * is similar to font space, except that it is scaled by a factor
-     * of the (desired font size) * (LOGICAL_SCALE). The multiplication
-     * by LOGICAL_SCALE allows for sub-pixel precision.
+     * of the (desired font size) * (WIN32_FONT_LOGICAL_SCALE). The multiplication
+     * by WIN32_FONT_LOGICAL_SCALE allows for sub-pixel precision.
      */
     double logical_scale;
 
@@ -148,8 +146,8 @@ _compute_transform (cairo_win32_scaled_f
 	if (scaled_font->swap_y)
 	    scaled_font->y_scale = - scaled_font->y_scale;
 	
-	scaled_font->logical_scale = LOGICAL_SCALE * scaled_font->y_scale;
-	scaled_font->logical_size = LOGICAL_SCALE * floor (scaled_font->y_scale + 0.5);
+	scaled_font->logical_scale = WIN32_FONT_LOGICAL_SCALE * scaled_font->y_scale;
+	scaled_font->logical_size = WIN32_FONT_LOGICAL_SCALE * floor (scaled_font->y_scale + 0.5);
     }
 
     /* The font matrix has x and y "scale" components which we extract and
@@ -163,8 +161,8 @@ _compute_transform (cairo_win32_scaled_f
 					     &scaled_font->x_scale, &scaled_font->y_scale,
 					     TRUE);	/* XXX: Handle vertical text */
 
-	scaled_font->logical_size = floor (LOGICAL_SCALE * scaled_font->y_scale + 0.5);
-	scaled_font->logical_scale = LOGICAL_SCALE * scaled_font->y_scale;
+	scaled_font->logical_size = floor (WIN32_FONT_LOGICAL_SCALE * scaled_font->y_scale + 0.5);
+	scaled_font->logical_scale = WIN32_FONT_LOGICAL_SCALE * scaled_font->y_scale;
     }
 
     cairo_matrix_scale (&scaled_font->logical_to_device,
diff --git a/src/cairo-win32-private.h b/src/cairo-win32-private.h
index 3745c46..01fa294 100644
--- a/src/cairo-win32-private.h
+++ b/src/cairo-win32-private.h
@@ -46,6 +46,7 @@
 #define SB_NONE 0
 #endif
 
+#define WIN32_FONT_LOGICAL_SCALE 32
 
 typedef struct _cairo_win32_surface {
     cairo_surface_t base;
diff --git a/src/cairo-win32-surface.c b/src/cairo-win32-surface.c
index 1dee142..0a84dc4 100644
--- a/src/cairo-win32-surface.c
+++ b/src/cairo-win32-surface.c
@@ -37,6 +37,7 @@
 
 #include <stdio.h>
 #include "cairoint.h"
+#include "cairo-clip-private.h"
 #include "cairo-win32-private.h"
 
 /* for older SDKs */
@@ -969,6 +970,108 @@ _cairo_win32_surface_flush (void *abstra
     return _cairo_surface_reset_clip (abstract_surface);
 }
 
+#define STACK_GLYPH_SIZE 256
+
+static cairo_int_status_t
+_cairo_win32_surface_show_glyphs (void			*surface,
+				  cairo_operator_t	 op,
+				  cairo_pattern_t	*source,
+				  const cairo_glyph_t	*glyphs,
+				  int			 num_glyphs,
+				  cairo_scaled_font_t	*scaled_font)
+{
+    cairo_win32_surface_t *dst = surface;
+
+    WORD glyph_buf_stack[STACK_GLYPH_SIZE];
+    WORD *glyph_buf = glyph_buf_stack;
+    int dx_buf_stack[STACK_GLYPH_SIZE];
+    int *dx_buf = dx_buf_stack;
+
+    BOOL win_result = 0;
+    int i, last_y_offset = 0;
+    double last_y = glyphs[0].y;
+
+    cairo_solid_pattern_t *solid_pattern;
+    COLORREF color;
+
+    /* We can only handle win32 fonts */
+    if (cairo_scaled_font_get_type (scaled_font) != CAIRO_SCALED_FONT_TYPE_WIN32)
+        return CAIRO_INT_STATUS_UNSUPPORTED;
+
+    /* We can only handle opaque solid color sources */
+    if (!_cairo_pattern_is_opaque_solid(source))
+        return CAIRO_INT_STATUS_UNSUPPORTED;
+
+    /* We can only handle operator SOURCE or OVER with the destination
+     * having no alpha */
+    if ((op != CAIRO_OPERATOR_SOURCE && op != CAIRO_OPERATOR_OVER) || 
+	(dst->format != CAIRO_FORMAT_RGB24))
+        return CAIRO_INT_STATUS_UNSUPPORTED;
+
+    /* If we have a fallback mask clip set on the dst, we have
+     * to go through the fallback path */
+    if (dst->base.clip &&
+        (dst->base.clip->mode != CAIRO_CLIP_MODE_REGION ||
+         dst->base.clip->surface != NULL))
+	return CAIRO_INT_STATUS_UNSUPPORTED;
+
+    solid_pattern = (cairo_solid_pattern_t *)source;
+    color = RGB(((int)solid_pattern->color.red_short) >> 8,
+                ((int)solid_pattern->color.green_short) >> 8,
+                ((int)solid_pattern->color.blue_short) >> 8);
+
+    SaveDC(dst->dc);
+
+    cairo_win32_scaled_font_select_font(scaled_font, dst->dc);
+    SetTextColor(dst->dc, color);
+    SetTextAlign(dst->dc, TA_BASELINE | TA_LEFT);
+    SetBkMode(dst->dc, TRANSPARENT);
+
+    if (num_glyphs > STACK_GLYPH_SIZE) {
+	glyph_buf = (WORD *)malloc(num_glyphs * sizeof(WORD));
+	dx_buf = (int *)malloc(num_glyphs * sizeof(int));
+    }
+
+    for (i = 0; i < num_glyphs; ++i) {
+	glyph_buf[i] = glyphs[i].index;
+	if (i == num_glyphs - 1)
+	    dx_buf[i] = 0;
+	else
+	    dx_buf[i] = (glyphs[i+1].x - glyphs[i].x) * WIN32_FONT_LOGICAL_SCALE;
+
+
+	if (i == num_glyphs - 1 || glyphs[i].y != glyphs[i+1].y) {
+	    win_result = ExtTextOutW(dst->dc,
+                                     glyphs[last_y_offset].x * WIN32_FONT_LOGICAL_SCALE,
+                                     last_y * WIN32_FONT_LOGICAL_SCALE,
+                                     ETO_GLYPH_INDEX,
+                                     NULL,
+                                     glyph_buf + last_y_offset,
+                                     (i - last_y_offset) + 1,
+                                     dx_buf + last_y_offset);
+	    if (!win_result) {
+		_cairo_win32_print_gdi_error("_cairo_win32_surface_show_glyphs(ExtTextOutW failed)");
+		goto FAIL;
+	    }
+
+	    last_y_offset = i;
+	}
+
+	last_y = glyphs[i].y;
+    }
+
+FAIL:
+    RestoreDC(dst->dc, -1);
+
+    if (glyph_buf != glyph_buf_stack) {
+	free(glyph_buf);
+	free(dx_buf);
+    }
+    return (win_result) ? CAIRO_STATUS_SUCCESS : CAIRO_INT_STATUS_UNSUPPORTED;
+}  
+
+#undef STACK_GLYPH_SIZE
+
 /**
  * cairo_win32_surface_create:
  * @hdc: the DC to create a surface for
@@ -1137,7 +1240,17 @@ static const cairo_surface_backend_t cai
     NULL, /* old_show_glyphs */
     NULL, /* get_font_options */
     _cairo_win32_surface_flush,
-    NULL  /* mark_dirty_rectangle */
+    NULL, /* mark_dirty_rectangle */
+    NULL, /* scaled_font_fini */
+    NULL, /* scaled_glyph_fini */
+
+    NULL, /* paint */
+    NULL, /* mask */
+    NULL, /* stroke */
+    NULL, /* fill */
+    _cairo_win32_surface_show_glyphs,
+
+    NULL  /* snapshot */
 };
 
 /*
diff-tree a10bbecaf8f122726c3e5b55b07bcd7882f6f319 (from 244c111fca042b15d6718295ca2f7c7843fa7ab5)
Author: Stuart Parmenter <pavlov at pavlov.net>
Date:   Fri Mar 10 12:12:36 2006 -0800

    [win32] Allow for creating a font from a HFONT
    (cherry picked from 677f6c84f9beae3afd375663fed0a440007ebca2 commit)

diff --git a/src/cairo-win32-font.c b/src/cairo-win32-font.c
index e7c6713..1d1d94f 100644
--- a/src/cairo-win32-font.c
+++ b/src/cairo-win32-font.c
@@ -98,7 +98,8 @@ typedef struct {
 
     HFONT scaled_hfont;
     HFONT unscaled_hfont;
-    
+
+    cairo_bool_t delete_scaled_hfont;
 } cairo_win32_scaled_font_t;
 
 static cairo_status_t 
@@ -225,6 +226,7 @@ _get_system_quality (void)
 
 static cairo_scaled_font_t *
 _win32_scaled_font_create (LOGFONTW                   *logfont,
+			   HFONT                      hfont,
 			   cairo_font_face_t	      *font_face,
 			   const cairo_matrix_t       *font_matrix,
 			   const cairo_matrix_t       *ctm,
@@ -270,9 +272,12 @@ _win32_scaled_font_create (LOGFONTW     
     }
     
     f->em_square = 0;
-    f->scaled_hfont = NULL;
+    f->scaled_hfont = hfont;
     f->unscaled_hfont = NULL;
 
+    /* don't delete the hfont if it was passed in to us */
+    f->delete_scaled_hfont = !hfont;
+
     cairo_matrix_multiply (&scale, font_matrix, ctm);
     _compute_transform (f, &scale);
 
@@ -516,7 +521,7 @@ _cairo_win32_scaled_font_create_toy (cai
     if (!logfont.lfFaceName)
 	return CAIRO_STATUS_NO_MEMORY;
     
-    scaled_font = _win32_scaled_font_create (&logfont, &toy_face->base,
+    scaled_font = _win32_scaled_font_create (&logfont, NULL, &toy_face->base,
 					     font_matrix, ctm, options);
     if (!scaled_font)
 	return CAIRO_STATUS_NO_MEMORY;
@@ -534,7 +539,7 @@ _cairo_win32_scaled_font_fini (void *abs
     if (scaled_font == NULL)
 	return;
 
-    if (scaled_font->scaled_hfont)
+    if (scaled_font->scaled_hfont && scaled_font->delete_scaled_hfont)
 	DeleteObject (scaled_font->scaled_hfont);
 
     if (scaled_font->unscaled_hfont)
@@ -1371,6 +1376,7 @@ typedef struct _cairo_win32_font_face ca
 struct _cairo_win32_font_face {
     cairo_font_face_t base;
     LOGFONTW logfont;
+    HFONT hfont;
 };
 
 /* implement the platform-specific interface */
@@ -1390,6 +1396,7 @@ _cairo_win32_font_face_scaled_font_creat
     cairo_win32_font_face_t *font_face = abstract_face;
 
     *font = _win32_scaled_font_create (&font_face->logfont,
+				       font_face->hfont,
 				       &font_face->base,
 				       font_matrix, ctm, options);
     if (*font)
@@ -1431,6 +1438,26 @@ cairo_win32_font_face_create_for_logfont
     }
     
     font_face->logfont = *logfont;
+    font_face->hfont = NULL;
+    
+    _cairo_font_face_init (&font_face->base, &_cairo_win32_font_face_backend);
+
+    return &font_face->base;
+}
+
+
+cairo_font_face_t *
+cairo_win32_font_face_create_for_hfont (HFONT font)
+{
+    cairo_win32_font_face_t *font_face;
+
+    font_face = malloc (sizeof (cairo_win32_font_face_t));
+    if (!font_face) {
+	_cairo_error (CAIRO_STATUS_NO_MEMORY);
+	return (cairo_font_face_t *)&_cairo_font_face_nil;
+    }
+    
+    font_face->hfont = font;
     
     _cairo_font_face_init (&font_face->base, &_cairo_win32_font_face_backend);
 
diff --git a/src/cairo-win32.h b/src/cairo-win32.h
index 6ba37de..a5cd2f5 100644
--- a/src/cairo-win32.h
+++ b/src/cairo-win32.h
@@ -58,6 +58,9 @@ cairo_win32_surface_get_dc (cairo_surfac
 cairo_public cairo_font_face_t *
 cairo_win32_font_face_create_for_logfontw (LOGFONTW *logfont);
 
+cairo_public cairo_font_face_t *
+cairo_win32_font_face_create_for_hfont (HFONT font);
+
 cairo_public cairo_status_t
 cairo_win32_scaled_font_select_font (cairo_scaled_font_t *scaled_font,
 				     HDC                  hdc);
diff-tree 244c111fca042b15d6718295ca2f7c7843fa7ab5 (from 92a015ff8ec5c11aac6d9c0c6702fa4873c04381)
Author: Vladimir Vukicevic <vladimir at pobox.com>
Date:   Fri Mar 10 11:56:27 2006 -0800

    [win32] Add SHADEBLENDCAPS and SB_NONE definitions for older SDKs
    (cherry picked from 7a68b7d035b1c63076d6fa6c54d40944459d206d commit)

diff --git a/src/cairo-win32-surface.c b/src/cairo-win32-surface.c
index a02a406..1dee142 100644
--- a/src/cairo-win32-surface.c
+++ b/src/cairo-win32-surface.c
@@ -39,6 +39,14 @@
 #include "cairoint.h"
 #include "cairo-win32-private.h"
 
+/* for older SDKs */
+#ifndef SHADEBLENDCAPS
+#define SHADEBLENDCAPS  120
+#endif
+#ifndef SB_NONE
+#define SB_NONE         0x00000000
+#endif
+
 static const cairo_surface_backend_t cairo_win32_surface_backend;
 
 /**


More information about the cairo-commit mailing list