mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-14 04:03:47 +00:00
cairo: Fix up win32 surface coords before calling BitBlt/AlphaBlend, so that the functions don't complain if called with src outside of src region
This commit is contained in:
parent
e393d91fcb
commit
b8920b9f9e
56
gfx/cairo/cairo-win32-composite-coord-fix.patch
Executable file
56
gfx/cairo/cairo-win32-composite-coord-fix.patch
Executable file
@ -0,0 +1,56 @@
|
||||
Index: gfx/cairo/cairo/src/cairo-win32-surface.c
|
||||
===================================================================
|
||||
--- gfx/cairo/cairo/src/cairo-win32-surface.c.orig 2006-02-11 16:02:20.937500000 -0800
|
||||
+++ gfx/cairo/cairo/src/cairo-win32-surface.c 2006-02-12 01:10:16.358500000 -0800
|
||||
@@ -677,6 +677,33 @@
|
||||
if (!integer_transform)
|
||||
return CAIRO_INT_STATUS_UNSUPPORTED;
|
||||
|
||||
+ /* Fix up src coordinates; the src coords and size must be within the
|
||||
+ * bounds of the source surface.
|
||||
+ * XXX the region not covered should be appropriately rendered!
|
||||
+ * - for OVER/SOURCE with RGB24 source -> opaque black
|
||||
+ * - for SOURCE with ARGB32 source -> 100% transparent black
|
||||
+ */
|
||||
+ src_x += itx;
|
||||
+ src_y += ity;
|
||||
+
|
||||
+ if (src_x < 0) {
|
||||
+ width += src_x;
|
||||
+ dst_x -= src_x;
|
||||
+ src_x = 0;
|
||||
+ }
|
||||
+
|
||||
+ if (src_y < 0) {
|
||||
+ height += src_y;
|
||||
+ dst_y -= src_y;
|
||||
+ src_y = 0;
|
||||
+ }
|
||||
+
|
||||
+ if (src_x + width > src->extents.width)
|
||||
+ width = src->extents.width - src_x;
|
||||
+
|
||||
+ if (src_y + height > src->extents.height)
|
||||
+ height = src->extents.height - src_y;
|
||||
+
|
||||
if (alpha == 255 &&
|
||||
(op == CAIRO_OPERATOR_SOURCE ||
|
||||
(src->format == CAIRO_FORMAT_RGB24 && op == CAIRO_OPERATOR_OVER))) {
|
||||
@@ -685,7 +712,7 @@
|
||||
dst_x, dst_y,
|
||||
width, height,
|
||||
src->dc,
|
||||
- src_x + itx, src_y + ity,
|
||||
+ src_x, src_y,
|
||||
SRCCOPY))
|
||||
return _cairo_win32_print_gdi_error ("_cairo_win32_surface_composite(BitBlt)");
|
||||
|
||||
@@ -696,7 +723,7 @@
|
||||
op == CAIRO_OPERATOR_OVER) {
|
||||
|
||||
return _composite_alpha_blend (dst, src, alpha,
|
||||
- src_x + itx, src_y + ity,
|
||||
+ src_x, src_y,
|
||||
dst_x, dst_y, width, height);
|
||||
}
|
||||
|
@ -677,6 +677,33 @@ _cairo_win32_surface_composite (cairo_operator_t op,
|
||||
if (!integer_transform)
|
||||
return CAIRO_INT_STATUS_UNSUPPORTED;
|
||||
|
||||
/* Fix up src coordinates; the src coords and size must be within the
|
||||
* bounds of the source surface.
|
||||
* XXX the region not covered should be appropriately rendered!
|
||||
* - for OVER/SOURCE with RGB24 source -> opaque black
|
||||
* - for SOURCE with ARGB32 source -> 100% transparent black
|
||||
*/
|
||||
src_x += itx;
|
||||
src_y += ity;
|
||||
|
||||
if (src_x < 0) {
|
||||
width += src_x;
|
||||
dst_x -= src_x;
|
||||
src_x = 0;
|
||||
}
|
||||
|
||||
if (src_y < 0) {
|
||||
height += src_y;
|
||||
dst_y -= src_y;
|
||||
src_y = 0;
|
||||
}
|
||||
|
||||
if (src_x + width > src->extents.width)
|
||||
width = src->extents.width - src_x;
|
||||
|
||||
if (src_y + height > src->extents.height)
|
||||
height = src->extents.height - src_y;
|
||||
|
||||
if (alpha == 255 &&
|
||||
(op == CAIRO_OPERATOR_SOURCE ||
|
||||
(src->format == CAIRO_FORMAT_RGB24 && op == CAIRO_OPERATOR_OVER))) {
|
||||
@ -685,7 +712,7 @@ _cairo_win32_surface_composite (cairo_operator_t op,
|
||||
dst_x, dst_y,
|
||||
width, height,
|
||||
src->dc,
|
||||
src_x + itx, src_y + ity,
|
||||
src_x, src_y,
|
||||
SRCCOPY))
|
||||
return _cairo_win32_print_gdi_error ("_cairo_win32_surface_composite(BitBlt)");
|
||||
|
||||
@ -696,7 +723,7 @@ _cairo_win32_surface_composite (cairo_operator_t op,
|
||||
op == CAIRO_OPERATOR_OVER) {
|
||||
|
||||
return _composite_alpha_blend (dst, src, alpha,
|
||||
src_x + itx, src_y + ity,
|
||||
src_x, src_y,
|
||||
dst_x, dst_y, width, height);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user