| Index: cc/layers/picture_image_layer_unittest.cc
|
| diff --git a/cc/layers/picture_image_layer_unittest.cc b/cc/layers/picture_image_layer_unittest.cc
|
| index 5b9375d2647210c6f388b11e30ee3b44fdfedb7e..cd95c9fde0b69840bdde477ae695be1df29118f3 100644
|
| --- a/cc/layers/picture_image_layer_unittest.cc
|
| +++ b/cc/layers/picture_image_layer_unittest.cc
|
| @@ -33,9 +33,44 @@ TEST(PictureImageLayerTest, PaintContentsToDisplayList) {
|
| layer->SetBitmap(image_bitmap);
|
| layer->SetBounds(gfx::Size(layer_rect.width(), layer_rect.height()));
|
|
|
| + bool use_cached_picture = false;
|
| scoped_refptr<DisplayItemList> display_list =
|
| - layer->PaintContentsToDisplayList(
|
| - layer_rect, ContentLayerClient::PAINTING_BEHAVIOR_NORMAL);
|
| + DisplayItemList::Create(layer_rect, use_cached_picture);
|
| + layer->PaintContentsToDisplayList(
|
| + display_list.get(), layer_rect,
|
| + ContentLayerClient::PAINTING_BEHAVIOR_NORMAL);
|
| + unsigned char actual_pixels[4 * 200 * 200] = {0};
|
| + DrawDisplayList(actual_pixels, layer_rect, display_list);
|
| +
|
| + EXPECT_EQ(0, memcmp(actual_pixels, image_pixels, 4 * 200 * 200));
|
| +}
|
| +
|
| +TEST(PictureImageLayerTest, PaintContentsToCachedDisplayList) {
|
| + scoped_refptr<PictureImageLayer> layer = PictureImageLayer::Create();
|
| + gfx::Rect layer_rect(200, 200);
|
| +
|
| + SkBitmap image_bitmap;
|
| + unsigned char image_pixels[4 * 200 * 200] = {0};
|
| + SkImageInfo info =
|
| + SkImageInfo::MakeN32Premul(layer_rect.width(), layer_rect.height());
|
| + image_bitmap.installPixels(info, image_pixels, info.minRowBytes());
|
| + SkCanvas image_canvas(image_bitmap);
|
| + image_canvas.clear(SK_ColorRED);
|
| + SkPaint blue_paint;
|
| + blue_paint.setColor(SK_ColorBLUE);
|
| + image_canvas.drawRectCoords(0.f, 0.f, 100.f, 100.f, blue_paint);
|
| + image_canvas.drawRectCoords(100.f, 100.f, 200.f, 200.f, blue_paint);
|
| +
|
| + layer->SetBitmap(image_bitmap);
|
| + layer->SetBounds(gfx::Size(layer_rect.width(), layer_rect.height()));
|
| +
|
| + bool use_cached_picture = true;
|
| + scoped_refptr<DisplayItemList> display_list =
|
| + DisplayItemList::Create(layer_rect, use_cached_picture);
|
| + layer->PaintContentsToDisplayList(
|
| + display_list.get(), layer_rect,
|
| + ContentLayerClient::PAINTING_BEHAVIOR_NORMAL);
|
| + display_list->CreateAndCacheSkPicture();
|
| unsigned char actual_pixels[4 * 200 * 200] = {0};
|
| DrawDisplayList(actual_pixels, layer_rect, display_list);
|
|
|
|
|