diff options
author | MenTaLguY <mental@bede.(none)> | 2008-11-17 17:46:15 -0500 |
---|---|---|
committer | Benjamin Otte <otte@gnome.org> | 2008-11-18 11:09:31 +0100 |
commit | bb5ece1032c5bb6db72e76e7b8f9e9040c7f1885 (patch) | |
tree | 8dba8cbf5dbb46b41567491f6d37f7db3f22fc6e | |
parent | 9fcfcf14dd8a907fbe85df5d4abe238f79e2f557 (diff) |
fix BitmapData.fillRect and add test for it
-rw-r--r-- | swfdec/swfdec_bitmap_data.c | 6 | ||||
-rw-r--r-- | test/image/bitmap-data-fillRect-5.swf | bin | 0 -> 309 bytes | |||
-rw-r--r-- | test/image/bitmap-data-fillRect-5.swf.png | bin | 0 -> 355 bytes | |||
-rw-r--r-- | test/image/bitmap-data-fillRect-6.swf | bin | 0 -> 309 bytes | |||
-rw-r--r-- | test/image/bitmap-data-fillRect-6.swf.png | bin | 0 -> 355 bytes | |||
-rw-r--r-- | test/image/bitmap-data-fillRect-7.swf | bin | 0 -> 309 bytes | |||
-rw-r--r-- | test/image/bitmap-data-fillRect-7.swf.png | bin | 0 -> 355 bytes | |||
-rw-r--r-- | test/image/bitmap-data-fillRect-8.swf | bin | 0 -> 316 bytes | |||
-rw-r--r-- | test/image/bitmap-data-fillRect-8.swf.png | bin | 0 -> 374 bytes | |||
-rw-r--r-- | test/image/bitmap-data-fillRect.as | 16 |
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 Binary files differnew file mode 100644 index 00000000..bafe54bc --- /dev/null +++ b/test/image/bitmap-data-fillRect-5.swf diff --git a/test/image/bitmap-data-fillRect-5.swf.png b/test/image/bitmap-data-fillRect-5.swf.png Binary files differnew file mode 100644 index 00000000..98591293 --- /dev/null +++ b/test/image/bitmap-data-fillRect-5.swf.png diff --git a/test/image/bitmap-data-fillRect-6.swf b/test/image/bitmap-data-fillRect-6.swf Binary files differnew file mode 100644 index 00000000..73f31034 --- /dev/null +++ b/test/image/bitmap-data-fillRect-6.swf diff --git a/test/image/bitmap-data-fillRect-6.swf.png b/test/image/bitmap-data-fillRect-6.swf.png Binary files differnew file mode 100644 index 00000000..98591293 --- /dev/null +++ b/test/image/bitmap-data-fillRect-6.swf.png diff --git a/test/image/bitmap-data-fillRect-7.swf b/test/image/bitmap-data-fillRect-7.swf Binary files differnew file mode 100644 index 00000000..11216896 --- /dev/null +++ b/test/image/bitmap-data-fillRect-7.swf diff --git a/test/image/bitmap-data-fillRect-7.swf.png b/test/image/bitmap-data-fillRect-7.swf.png Binary files differnew file mode 100644 index 00000000..98591293 --- /dev/null +++ b/test/image/bitmap-data-fillRect-7.swf.png diff --git a/test/image/bitmap-data-fillRect-8.swf b/test/image/bitmap-data-fillRect-8.swf Binary files differnew file mode 100644 index 00000000..3f60b685 --- /dev/null +++ b/test/image/bitmap-data-fillRect-8.swf diff --git a/test/image/bitmap-data-fillRect-8.swf.png b/test/image/bitmap-data-fillRect-8.swf.png Binary files differnew file mode 100644 index 00000000..130d5300 --- /dev/null +++ b/test/image/bitmap-data-fillRect-8.swf.png 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; |