mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-08 12:37:37 +00:00
56 lines
1.6 KiB
Diff
56 lines
1.6 KiB
Diff
Index: gfx/cairo/cairo/src/cairo-win32-surface.c
|
|
===================================================================
|
|
--- gfx/cairo/cairo/src/cairo-win32-surface.c.orig 2006-02-12 23:13:07.587375000 -0800
|
|
+++ gfx/cairo/cairo/src/cairo-win32-surface.c 2006-02-12 23:13:10.696750000 -0800
|
|
@@ -944,7 +944,7 @@
|
|
return CAIRO_STATUS_NO_MEMORY;
|
|
|
|
/* Combine the new region with the original clip */
|
|
-
|
|
+
|
|
if (surface->saved_clip) {
|
|
if (CombineRgn (gdi_region, gdi_region, surface->saved_clip, RGN_AND) == ERROR)
|
|
goto FAIL;
|
|
@@ -985,6 +985,8 @@
|
|
{
|
|
cairo_win32_surface_t *surface;
|
|
RECT rect;
|
|
+ int depth;
|
|
+ cairo_format_t format;
|
|
|
|
/* Try to figure out the drawing bounds for the Device context
|
|
*/
|
|
@@ -994,7 +996,22 @@
|
|
_cairo_error (CAIRO_STATUS_NO_MEMORY);
|
|
return &_cairo_surface_nil;
|
|
}
|
|
-
|
|
+
|
|
+ depth = GetDeviceCaps(hdc, BITSPIXEL);
|
|
+ if (depth == 32)
|
|
+ format = CAIRO_FORMAT_ARGB32;
|
|
+ else if (depth == 24)
|
|
+ format = CAIRO_FORMAT_RGB24;
|
|
+ else if (depth == 8)
|
|
+ format = CAIRO_FORMAT_A8;
|
|
+ else if (depth == 1)
|
|
+ format = CAIRO_FORMAT_A1;
|
|
+ else {
|
|
+ _cairo_win32_print_gdi_error("cairo_win32_surface_create(bad BITSPIXEL)");
|
|
+ _cairo_error (CAIRO_STATUS_NO_MEMORY);
|
|
+ return &_cairo_surface_nil;
|
|
+ }
|
|
+
|
|
surface = malloc (sizeof (cairo_win32_surface_t));
|
|
if (surface == NULL) {
|
|
_cairo_error (CAIRO_STATUS_NO_MEMORY);
|
|
@@ -1002,7 +1019,7 @@
|
|
}
|
|
|
|
surface->image = NULL;
|
|
- surface->format = CAIRO_FORMAT_RGB24;
|
|
+ surface->format = format;
|
|
|
|
surface->dc = hdc;
|
|
surface->bitmap = NULL;
|