Chromium Code Reviews| Index: cc/resources/display_item_list_unittest.cc |
| diff --git a/cc/resources/display_item_list_unittest.cc b/cc/resources/display_item_list_unittest.cc |
| index b53b84a574c59fff847ddc46420289ab7529acab..db96b209bda93e988a5e25891bdcfddd8e3c5986 100644 |
| --- a/cc/resources/display_item_list_unittest.cc |
| +++ b/cc/resources/display_item_list_unittest.cc |
| @@ -36,7 +36,7 @@ TEST(DisplayItemListTest, SingleDrawingItem) { |
| SkPaint red_paint; |
| red_paint.setColor(SK_ColorRED); |
| unsigned char pixels[4 * 100 * 100] = {0}; |
| - scoped_refptr<DisplayItemList> list = DisplayItemList::Create(); |
| + scoped_refptr<DisplayItemList> list = DisplayItemList::Create(layer_rect); |
| gfx::PointF offset(8.f, 9.f); |
| gfx::RectF recording_rect(offset, layer_rect.size()); |
| @@ -47,6 +47,7 @@ TEST(DisplayItemListTest, SingleDrawingItem) { |
| canvas->drawRectCoords(50.f, 50.f, 75.f, 75.f, blue_paint); |
| picture = skia::AdoptRef(recorder.endRecordingAsPicture()); |
| list->AppendItem(DrawingDisplayItem::Create(picture)); |
| + list->CreateAndCacheSkPicture(); |
| DrawDisplayList(pixels, layer_rect, list); |
| SkBitmap expected_bitmap; |
| @@ -76,7 +77,7 @@ TEST(DisplayItemListTest, ClipItem) { |
| SkPaint red_paint; |
| red_paint.setColor(SK_ColorRED); |
| unsigned char pixels[4 * 100 * 100] = {0}; |
| - scoped_refptr<DisplayItemList> list = DisplayItemList::Create(); |
| + scoped_refptr<DisplayItemList> list = DisplayItemList::Create(layer_rect); |
| gfx::PointF first_offset(8.f, 9.f); |
| gfx::RectF first_recording_rect(first_offset, layer_rect.size()); |
| @@ -100,6 +101,7 @@ TEST(DisplayItemListTest, ClipItem) { |
| list->AppendItem(DrawingDisplayItem::Create(picture)); |
| list->AppendItem(EndClipDisplayItem::Create()); |
| + list->CreateAndCacheSkPicture(); |
| DrawDisplayList(pixels, layer_rect, list); |
| @@ -131,7 +133,7 @@ TEST(DisplayItemListTest, TransformItem) { |
| SkPaint red_paint; |
| red_paint.setColor(SK_ColorRED); |
| unsigned char pixels[4 * 100 * 100] = {0}; |
| - scoped_refptr<DisplayItemList> list = DisplayItemList::Create(); |
| + scoped_refptr<DisplayItemList> list = DisplayItemList::Create(layer_rect); |
| gfx::PointF first_offset(8.f, 9.f); |
| gfx::RectF first_recording_rect(first_offset, layer_rect.size()); |
| @@ -156,6 +158,7 @@ TEST(DisplayItemListTest, TransformItem) { |
| list->AppendItem(DrawingDisplayItem::Create(picture)); |
| list->AppendItem(EndTransformDisplayItem::Create()); |
| + list->CreateAndCacheSkPicture(); |
| DrawDisplayList(pixels, layer_rect, list); |
| @@ -177,11 +180,11 @@ TEST(DisplayItemListTest, TransformItem) { |
| EXPECT_EQ(0, memcmp(pixels, expected_pixels, 4 * 100 * 100)); |
| } |
| -TEST(DisplayItemList, FilterItem) { |
| +TEST(DisplayItemListTest, FilterItem) { |
| gfx::Rect layer_rect(100, 100); |
| FilterOperations filters; |
| unsigned char pixels[4 * 100 * 100] = {0}; |
| - scoped_refptr<DisplayItemList> list = DisplayItemList::Create(); |
| + scoped_refptr<DisplayItemList> list = DisplayItemList::Create(layer_rect); |
| SkBitmap source_bitmap; |
| source_bitmap.allocN32Pixels(50, 50); |
| @@ -206,6 +209,7 @@ TEST(DisplayItemList, FilterItem) { |
| gfx::RectF filter_bounds(10.f, 10.f, 50.f, 50.f); |
| list->AppendItem(FilterDisplayItem::Create(filters, filter_bounds)); |
| list->AppendItem(EndFilterDisplayItem::Create()); |
| + list->CreateAndCacheSkPicture(); |
| DrawDisplayList(pixels, layer_rect, list); |
| @@ -222,39 +226,5 @@ TEST(DisplayItemList, FilterItem) { |
| EXPECT_EQ(0, memcmp(pixels, expected_pixels, 4 * 100 * 100)); |
| } |
| -TEST(DisplayItemListTest, CompactingItems) { |
|
ajuma
2015/04/14 18:02:32
This test compares rastering with and without a ca
enne (OOO)
2015/04/14 22:55:35
Is rastering without caching a desirable option in
ajuma
2015/04/15 15:38:45
Good point, I've updated DisplayItemList so that c
|
| - gfx::Rect layer_rect(100, 100); |
| - SkPictureRecorder recorder; |
| - skia::RefPtr<SkCanvas> canvas; |
| - skia::RefPtr<SkPicture> picture; |
| - SkPaint blue_paint; |
| - blue_paint.setColor(SK_ColorBLUE); |
| - SkPaint red_paint; |
| - red_paint.setColor(SK_ColorRED); |
| - unsigned char pixels[4 * 100 * 100] = {0}; |
| - |
| - gfx::PointF offset(8.f, 9.f); |
| - gfx::RectF recording_rect(offset, layer_rect.size()); |
| - |
| - scoped_refptr<DisplayItemList> list = DisplayItemList::Create(); |
| - list->set_layer_rect(ToEnclosingRect(recording_rect)); |
| - |
| - canvas = skia::SharePtr( |
| - recorder.beginRecording(gfx::RectFToSkRect(recording_rect))); |
| - canvas->translate(offset.x(), offset.y()); |
| - canvas->drawRectCoords(0.f, 0.f, 60.f, 60.f, red_paint); |
| - canvas->drawRectCoords(50.f, 50.f, 75.f, 75.f, blue_paint); |
| - picture = skia::AdoptRef(recorder.endRecordingAsPicture()); |
| - list->AppendItem(DrawingDisplayItem::Create(picture)); |
| - DrawDisplayList(pixels, layer_rect, list); |
| - |
| - list->CreateAndCacheSkPicture(); |
| - |
| - unsigned char expected_pixels[4 * 100 * 100] = {0}; |
| - DrawDisplayList(expected_pixels, layer_rect, list); |
| - |
| - EXPECT_EQ(0, memcmp(pixels, expected_pixels, 4 * 100 * 100)); |
| -} |
| - |
| } // namespace |
| } // namespace cc |