summaryrefslogtreecommitdiff
path: root/src/cairo-win32-surface.c
diff options
context:
space:
mode:
authorVladimir Vukicevic <vladimir@pobox.com>2008-03-03 17:43:41 -0800
committerVladimir Vukicevic <vladimir@h-232.office.mozilla.org>2008-03-03 17:43:41 -0800
commit2f9350424fd7eb03ecbdbdee2831944d4e9c35af (patch)
treeecd52f9b5acc1fdd6b25fe294bac8db6fb8dd118 /src/cairo-win32-surface.c
parent9dd55f6fe854ec2365a5c1d264e39ca03f6eceb5 (diff)
[win32] Treat all incoming HDCs as RGB24, regardless of depth
Assuming A8/A1 doesn't really make sense in any case, and doing this allows for rendering to 8bpp displays.
Diffstat (limited to 'src/cairo-win32-surface.c')
-rw-r--r--src/cairo-win32-surface.c28
1 files changed, 6 insertions, 22 deletions
diff --git a/src/cairo-win32-surface.c b/src/cairo-win32-surface.c
index 660d3c5c..4df953f5 100644
--- a/src/cairo-win32-surface.c
+++ b/src/cairo-win32-surface.c
@@ -1677,9 +1677,10 @@ _cairo_win32_surface_show_glyphs (void *surface,
*
* Creates a cairo surface that targets the given DC. The DC will be
* queried for its initial clip extents, and this will be used as the
- * size of the cairo surface. Also, if the DC is a raster DC, it will
- * be queried for its pixel format and the cairo surface format will
- * be set appropriately.
+ * size of the cairo surface. The resulting surface will always be of
+ * format CAIRO_FORMAT_RGB24; should you need another surface format,
+ * you will need to create one through
+ * cairo_win32_surface_create_with_dib().
*
* Return value: the newly created surface
**/
@@ -1692,25 +1693,8 @@ cairo_win32_surface_create (HDC hdc)
cairo_format_t format;
RECT rect;
- if (GetDeviceCaps(hdc, TECHNOLOGY) == DT_RASDISPLAY) {
- depth = GetDeviceCaps(hdc, BITSPIXEL);
- if (depth == 32)
- format = CAIRO_FORMAT_RGB24;
- else if (depth == 24)
- format = CAIRO_FORMAT_RGB24;
- else if (depth == 16)
- 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)");
- return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_INVALID_FORMAT));
- }
- } else {
- format = CAIRO_FORMAT_RGB24;
- }
+ /* Assume that everything coming in as a HDC is RGB24 */
+ format = CAIRO_FORMAT_RGB24;
surface = malloc (sizeof (cairo_win32_surface_t));
if (surface == NULL)