[cairo] [PATCH 3/3] Adjust assertions and checks to handle more pixel formats
LRN
lrn1986 at gmail.com
Thu Apr 17 02:07:03 PDT 2014
Now that ARGB32 format is available, allow it to be used, and use it
where appropriate.
Signed-off-by: Руслан Ижбулатов <lrn1986 at gmail.com>
---
src/win32/cairo-win32-display-surface.c | 4 ++--
src/win32/cairo-win32-surface.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/win32/cairo-win32-display-surface.c b/src/win32/cairo-win32-display-surface.c
index d002ce2..5c01721 100644
--- a/src/win32/cairo-win32-display-surface.c
+++ b/src/win32/cairo-win32-display-surface.c
@@ -372,7 +372,7 @@ _cairo_win32_display_surface_create_similar (void *abstract_src,
*/
if (!(src->is_dib || content & CAIRO_CONTENT_ALPHA)) {
/* try to create a ddb */
- new_surf = cairo_win32_surface_create_with_ddb (src->win32.dc, CAIRO_FORMAT_RGB24, width, height);
+ new_surf = cairo_win32_surface_create_with_ddb (src->win32.dc, CAIRO_FORMAT_ARGB32, width, height);
if (new_surf->status)
new_surf = NULL;
@@ -1049,7 +1049,7 @@ cairo_win32_surface_create_with_ddb (HDC hdc,
HDC screen_dc, ddb_dc;
HBITMAP saved_dc_bitmap;
- if (format != CAIRO_FORMAT_RGB24)
+ if (format != CAIRO_FORMAT_RGB24 && format != CAIRO_FORMAT_ARGB32)
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_INVALID_FORMAT));
/* XXX handle these eventually
format != CAIRO_FORMAT_A8 ||
diff --git a/src/win32/cairo-win32-surface.c b/src/win32/cairo-win32-surface.c
index 7cd46fc..081eeab 100644
--- a/src/win32/cairo-win32-surface.c
+++ b/src/win32/cairo-win32-surface.c
@@ -227,7 +227,7 @@ _cairo_win32_surface_emit_glyphs (cairo_win32_surface_t *dst,
/* We can only handle opaque solid color sources and destinations */
assert (_cairo_pattern_is_opaque_solid(source));
- assert (dst->format == CAIRO_FORMAT_RGB24);
+ assert (dst->format == CAIRO_FORMAT_RGB24 || dst->format == CAIRO_FORMAT_ARGB32);
solid_pattern = (cairo_solid_pattern_t *)source;
color = RGB(((int)solid_pattern->color.red_short) >> 8,
--
1.8.5.3
More information about the cairo
mailing list