summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMenTaLguY <mental@bede.(none)>2008-11-17 17:46:15 -0500
committerBenjamin Otte <otte@gnome.org>2008-11-18 11:09:31 +0100
commitbb5ece1032c5bb6db72e76e7b8f9e9040c7f1885 (patch)
tree8dba8cbf5dbb46b41567491f6d37f7db3f22fc6e
parent9fcfcf14dd8a907fbe85df5d4abe238f79e2f557 (diff)
fix BitmapData.fillRect and add test for it
-rw-r--r--swfdec/swfdec_bitmap_data.c6
-rw-r--r--test/image/bitmap-data-fillRect-5.swfbin0 -> 309 bytes
-rw-r--r--test/image/bitmap-data-fillRect-5.swf.pngbin0 -> 355 bytes
-rw-r--r--test/image/bitmap-data-fillRect-6.swfbin0 -> 309 bytes
-rw-r--r--test/image/bitmap-data-fillRect-6.swf.pngbin0 -> 355 bytes
-rw-r--r--test/image/bitmap-data-fillRect-7.swfbin0 -> 309 bytes
-rw-r--r--test/image/bitmap-data-fillRect-7.swf.pngbin0 -> 355 bytes
-rw-r--r--test/image/bitmap-data-fillRect-8.swfbin0 -> 316 bytes
-rw-r--r--test/image/bitmap-data-fillRect-8.swf.pngbin0 -> 374 bytes
-rw-r--r--test/image/bitmap-data-fillRect.as16
10 files changed, 20 insertions, 2 deletions
diff --git a/swfdec/swfdec_bitmap_data.c b/swfdec/swfdec_bitmap_data.c
index ba0439fa..041b448a 100644
--- a/swfdec/swfdec_bitmap_data.c
+++ b/swfdec/swfdec_bitmap_data.c
@@ -399,14 +399,16 @@ swfdec_bitmap_data_fillRect (SwfdecAsContext *cx, SwfdecAsObject *object,
if (!swfdec_rectangle_from_as_object (&rect, recto) || bitmap->surface == NULL)
return;
- /* We can treat a guint as a SwfdecColor */
- if (SWFDEC_COLOR_ALPHA (color) == 0)
+ if (!swfdec_surface_has_alpha(bitmap->surface))
+ /* We can treat a guint as a SwfdecColor */
color = SWFDEC_COLOR_OPAQUE (color);
cr = cairo_create (bitmap->surface);
swfdec_color_set_source (cr, color);
cairo_rectangle (cr, rect.x, rect.y, rect.width, rect.height);
+ cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
cairo_fill (cr);
+ cairo_destroy(cr);
swfdec_bitmap_data_invalidate (bitmap, rect.x, rect.y, rect.width, rect.height);
}
diff --git a/test/image/bitmap-data-fillRect-5.swf b/test/image/bitmap-data-fillRect-5.swf
new file mode 100644
index 00000000..bafe54bc
--- /dev/null
+++ b/test/image/bitmap-data-fillRect-5.swf
Binary files differ
diff --git a/test/image/bitmap-data-fillRect-5.swf.png b/test/image/bitmap-data-fillRect-5.swf.png
new file mode 100644
index 00000000..98591293
--- /dev/null
+++ b/test/image/bitmap-data-fillRect-5.swf.png
Binary files differ
diff --git a/test/image/bitmap-data-fillRect-6.swf b/test/image/bitmap-data-fillRect-6.swf
new file mode 100644
index 00000000..73f31034
--- /dev/null
+++ b/test/image/bitmap-data-fillRect-6.swf
Binary files differ
diff --git a/test/image/bitmap-data-fillRect-6.swf.png b/test/image/bitmap-data-fillRect-6.swf.png
new file mode 100644
index 00000000..98591293
--- /dev/null
+++ b/test/image/bitmap-data-fillRect-6.swf.png
Binary files differ
diff --git a/test/image/bitmap-data-fillRect-7.swf b/test/image/bitmap-data-fillRect-7.swf
new file mode 100644
index 00000000..11216896
--- /dev/null
+++ b/test/image/bitmap-data-fillRect-7.swf
Binary files differ
diff --git a/test/image/bitmap-data-fillRect-7.swf.png b/test/image/bitmap-data-fillRect-7.swf.png
new file mode 100644
index 00000000..98591293
--- /dev/null
+++ b/test/image/bitmap-data-fillRect-7.swf.png
Binary files differ
diff --git a/test/image/bitmap-data-fillRect-8.swf b/test/image/bitmap-data-fillRect-8.swf
new file mode 100644
index 00000000..3f60b685
--- /dev/null
+++ b/test/image/bitmap-data-fillRect-8.swf
Binary files differ
diff --git a/test/image/bitmap-data-fillRect-8.swf.png b/test/image/bitmap-data-fillRect-8.swf.png
new file mode 100644
index 00000000..130d5300
--- /dev/null
+++ b/test/image/bitmap-data-fillRect-8.swf.png
Binary files differ
diff --git a/test/image/bitmap-data-fillRect.as b/test/image/bitmap-data-fillRect.as
new file mode 100644
index 00000000..a2ef5a83
--- /dev/null
+++ b/test/image/bitmap-data-fillRect.as
@@ -0,0 +1,16 @@
+// makeswf -v 7 -s 200x150 -r 1 -o bitmap-data-fillRect.swf bitmap-data-fillRect.as
+
+var RECT_SIZE = 25;
+
+var mc1 = createEmptyMovieClip("mc1", getNextHighestDepth());
+var b1 = new flash.display.BitmapData(RECT_SIZE, RECT_SIZE, false, 0xffff0000);
+var mc2 = createEmptyMovieClip("mc2", getNextHighestDepth());
+var b2 = new flash.display.BitmapData(RECT_SIZE, RECT_SIZE, true, 0xffff0000);
+b1.fillRect(b1.rectangle, 0x80000000);
+b2.fillRect(b2.rectangle, 0x80000000);
+mc1.attachBitmap(b1, mc1.getNextHighestDepth());
+mc2.attachBitmap(b2, mc2.getNextHighestDepth());
+mc1._x = 0;
+mc1._y = 0;
+mc2._x = RECT_SIZE;
+mc2._y = RECT_SIZE;