// Single full-size rect picture.
content_layer_client.add_draw_rect(layer_rect, red_paint);
- scoped_refptr<Picture> one_rect_picture = Picture::Create(layer_rect);
- one_rect_picture->Record(&content_layer_client,
- tile_grid_info);
+ scoped_refptr<Picture> one_rect_picture = Picture::Create(
+ layer_rect, &content_layer_client, tile_grid_info, false, 0);
scoped_ptr<base::Value> serialized_one_rect(
one_rect_picture->AsValue());
// Two rect picture.
content_layer_client.add_draw_rect(gfx::Rect(25, 25, 50, 50), green_paint);
- scoped_refptr<Picture> two_rect_picture = Picture::Create(layer_rect);
- two_rect_picture->Record(&content_layer_client,
- tile_grid_info);
+ scoped_refptr<Picture> two_rect_picture = Picture::Create(
+ layer_rect, &content_layer_client, tile_grid_info, false, 0);
scoped_ptr<base::Value> serialized_two_rect(
two_rect_picture->AsValue());
FakeContentLayerClient content_layer_client;
- // Lazy pixel refs are found in the following grids:
+ // Discardable pixel refs are found in the following grids:
// |---|---|---|---|
// | | x | | x |
// |---|---|---|---|
// |---|---|---|---|
// | x | | x | |
// |---|---|---|---|
- SkBitmap lazy_bitmap[4][4];
+ SkBitmap discardable_bitmap[4][4];
for (int y = 0; y < 4; ++y) {
for (int x = 0; x < 4; ++x) {
if ((x + y) & 1) {
- CreateBitmap(gfx::Size(500, 500), "lazy", &lazy_bitmap[y][x]);
+ CreateBitmap(
+ gfx::Size(500, 500), "discardable", &discardable_bitmap[y][x]);
SkPaint paint;
content_layer_client.add_draw_bitmap(
- lazy_bitmap[y][x],
+ discardable_bitmap[y][x],
gfx::Point(x * 512 + 6, y * 512 + 6), paint);
}
}
}
- scoped_refptr<Picture> picture = Picture::Create(layer_rect);
- picture->Record(&content_layer_client,
- tile_grid_info);
- picture->GatherPixelRefs(tile_grid_info);
+ scoped_refptr<Picture> picture = Picture::Create(
+ layer_rect, &content_layer_client, tile_grid_info, true, 0);
// Default iterator does not have any pixel refs
{
picture.get());
if ((x + y) & 1) {
EXPECT_TRUE(iterator) << x << " " << y;
- EXPECT_TRUE(*iterator == lazy_bitmap[y][x].pixelRef()) << x << " " << y;
+ EXPECT_TRUE(*iterator == discardable_bitmap[y][x].pixelRef()) << x <<
+ " " << y;
EXPECT_FALSE(++iterator) << x << " " << y;
} else {
EXPECT_FALSE(iterator) << x << " " << y;
Picture::PixelRefIterator iterator(gfx::Rect(512, 512, 2048, 2048),
picture.get());
EXPECT_TRUE(iterator);
- EXPECT_TRUE(*iterator == lazy_bitmap[1][2].pixelRef());
+ EXPECT_TRUE(*iterator == discardable_bitmap[1][2].pixelRef());
EXPECT_TRUE(++iterator);
- EXPECT_TRUE(*iterator == lazy_bitmap[2][1].pixelRef());
+ EXPECT_TRUE(*iterator == discardable_bitmap[2][1].pixelRef());
EXPECT_TRUE(++iterator);
- EXPECT_TRUE(*iterator == lazy_bitmap[2][3].pixelRef());
+ EXPECT_TRUE(*iterator == discardable_bitmap[2][3].pixelRef());
EXPECT_TRUE(++iterator);
- EXPECT_TRUE(*iterator == lazy_bitmap[3][2].pixelRef());
+ EXPECT_TRUE(*iterator == discardable_bitmap[3][2].pixelRef());
EXPECT_FALSE(++iterator);
}
Picture::PixelRefIterator iterator(gfx::Rect(512, 512, 2048, 2048),
picture.get());
EXPECT_TRUE(iterator);
- EXPECT_TRUE(*iterator == lazy_bitmap[1][2].pixelRef());
+ EXPECT_TRUE(*iterator == discardable_bitmap[1][2].pixelRef());
EXPECT_TRUE(++iterator);
- EXPECT_TRUE(*iterator == lazy_bitmap[2][1].pixelRef());
+ EXPECT_TRUE(*iterator == discardable_bitmap[2][1].pixelRef());
// copy now points to the same spot as iterator,
// but both can be incremented independently.
Picture::PixelRefIterator copy = iterator;
EXPECT_TRUE(++iterator);
- EXPECT_TRUE(*iterator == lazy_bitmap[2][3].pixelRef());
+ EXPECT_TRUE(*iterator == discardable_bitmap[2][3].pixelRef());
EXPECT_TRUE(++iterator);
- EXPECT_TRUE(*iterator == lazy_bitmap[3][2].pixelRef());
+ EXPECT_TRUE(*iterator == discardable_bitmap[3][2].pixelRef());
EXPECT_FALSE(++iterator);
EXPECT_TRUE(copy);
- EXPECT_TRUE(*copy == lazy_bitmap[2][1].pixelRef());
+ EXPECT_TRUE(*copy == discardable_bitmap[2][1].pixelRef());
EXPECT_TRUE(++copy);
- EXPECT_TRUE(*copy == lazy_bitmap[2][3].pixelRef());
+ EXPECT_TRUE(*copy == discardable_bitmap[2][3].pixelRef());
EXPECT_TRUE(++copy);
- EXPECT_TRUE(*copy == lazy_bitmap[3][2].pixelRef());
+ EXPECT_TRUE(*copy == discardable_bitmap[3][2].pixelRef());
EXPECT_FALSE(++copy);
}
FakeContentLayerClient content_layer_client;
- // Lazy pixel refs are found in the following grids:
+ // Discardable pixel refs are found in the following grids:
// |---|---|---|---|
// | | x | | x |
// |---|---|---|---|
// |---|---|---|---|
// | x | | x | |
// |---|---|---|---|
- SkBitmap lazy_bitmap[4][4];
+ SkBitmap discardable_bitmap[4][4];
for (int y = 0; y < 4; ++y) {
for (int x = 0; x < 4; ++x) {
if ((x + y) & 1) {
- CreateBitmap(gfx::Size(500, 500), "lazy", &lazy_bitmap[y][x]);
+ CreateBitmap(
+ gfx::Size(500, 500), "discardable", &discardable_bitmap[y][x]);
SkPaint paint;
content_layer_client.add_draw_bitmap(
- lazy_bitmap[y][x],
+ discardable_bitmap[y][x],
gfx::Point(1024 + x * 512 + 6, y * 512 + 6), paint);
}
}
}
- scoped_refptr<Picture> picture = Picture::Create(layer_rect);
- picture->Record(&content_layer_client,
- tile_grid_info);
- picture->GatherPixelRefs(tile_grid_info);
+ scoped_refptr<Picture> picture = Picture::Create(
+ layer_rect, &content_layer_client, tile_grid_info, true, 0);
// Default iterator does not have any pixel refs
{
gfx::Rect(1024 + x * 512, y * 512, 500, 500), picture.get());
if ((x + y) & 1) {
EXPECT_TRUE(iterator) << x << " " << y;
- EXPECT_TRUE(*iterator == lazy_bitmap[y][x].pixelRef());
+ EXPECT_TRUE(*iterator == discardable_bitmap[y][x].pixelRef());
EXPECT_FALSE(++iterator) << x << " " << y;
} else {
EXPECT_FALSE(iterator) << x << " " << y;
Picture::PixelRefIterator iterator(gfx::Rect(1024 + 512, 512, 2048, 2048),
picture.get());
EXPECT_TRUE(iterator);
- EXPECT_TRUE(*iterator == lazy_bitmap[1][2].pixelRef());
+ EXPECT_TRUE(*iterator == discardable_bitmap[1][2].pixelRef());
EXPECT_TRUE(++iterator);
- EXPECT_TRUE(*iterator == lazy_bitmap[2][1].pixelRef());
+ EXPECT_TRUE(*iterator == discardable_bitmap[2][1].pixelRef());
EXPECT_TRUE(++iterator);
- EXPECT_TRUE(*iterator == lazy_bitmap[2][3].pixelRef());
+ EXPECT_TRUE(*iterator == discardable_bitmap[2][3].pixelRef());
EXPECT_TRUE(++iterator);
- EXPECT_TRUE(*iterator == lazy_bitmap[3][2].pixelRef());
+ EXPECT_TRUE(*iterator == discardable_bitmap[3][2].pixelRef());
EXPECT_FALSE(++iterator);
}
Picture::PixelRefIterator iterator(gfx::Rect(1024 + 512, 512, 2048, 2048),
picture.get());
EXPECT_TRUE(iterator);
- EXPECT_TRUE(*iterator == lazy_bitmap[1][2].pixelRef());
+ EXPECT_TRUE(*iterator == discardable_bitmap[1][2].pixelRef());
EXPECT_TRUE(++iterator);
- EXPECT_TRUE(*iterator == lazy_bitmap[2][1].pixelRef());
+ EXPECT_TRUE(*iterator == discardable_bitmap[2][1].pixelRef());
// copy now points to the same spot as iterator,
// but both can be incremented independently.
Picture::PixelRefIterator copy = iterator;
EXPECT_TRUE(++iterator);
- EXPECT_TRUE(*iterator == lazy_bitmap[2][3].pixelRef());
+ EXPECT_TRUE(*iterator == discardable_bitmap[2][3].pixelRef());
EXPECT_TRUE(++iterator);
- EXPECT_TRUE(*iterator == lazy_bitmap[3][2].pixelRef());
+ EXPECT_TRUE(*iterator == discardable_bitmap[3][2].pixelRef());
EXPECT_FALSE(++iterator);
EXPECT_TRUE(copy);
- EXPECT_TRUE(*copy == lazy_bitmap[2][1].pixelRef());
+ EXPECT_TRUE(*copy == discardable_bitmap[2][1].pixelRef());
EXPECT_TRUE(++copy);
- EXPECT_TRUE(*copy == lazy_bitmap[2][3].pixelRef());
+ EXPECT_TRUE(*copy == discardable_bitmap[2][3].pixelRef());
EXPECT_TRUE(++copy);
- EXPECT_TRUE(*copy == lazy_bitmap[3][2].pixelRef());
+ EXPECT_TRUE(*copy == discardable_bitmap[3][2].pixelRef());
EXPECT_FALSE(++copy);
}
FakeContentLayerClient content_layer_client;
- // Lazy pixel refs are found in the following grids:
+ // Discardable pixel refs are found in the following grids:
// |---|---|---|---|
// | | x | | x |
// |---|---|---|---|
// |---|---|---|---|
// | x | | x | |
// |---|---|---|---|
- SkBitmap lazy_bitmap[4][4];
+ SkBitmap discardable_bitmap[4][4];
for (int y = 0; y < 4; ++y) {
for (int x = 0; x < 4; ++x) {
if ((x + y) & 1) {
- CreateBitmap(gfx::Size(500, 500), "lazy", &lazy_bitmap[y][x]);
+ CreateBitmap(
+ gfx::Size(500, 500), "discardable", &discardable_bitmap[y][x]);
SkPaint paint;
content_layer_client.add_draw_bitmap(
- lazy_bitmap[y][x],
+ discardable_bitmap[y][x],
gfx::Point(x * 512 + 6, y * 512 + 6), paint);
}
}
}
- scoped_refptr<Picture> picture = Picture::Create(layer_rect);
- picture->Record(&content_layer_client,
- tile_grid_info);
- picture->GatherPixelRefs(tile_grid_info);
+ scoped_refptr<Picture> picture = Picture::Create(
+ layer_rect, &content_layer_client, tile_grid_info, true, 0);
for (int y = 0; y < 4; ++y) {
for (int x = 0; x < 4; ++x) {
gfx::Rect(x * 512, y * 512 + 256, 1, 1), picture.get());
if ((x + y) & 1) {
EXPECT_TRUE(iterator) << x << " " << y;
- EXPECT_TRUE(*iterator == lazy_bitmap[y][x].pixelRef());
+ EXPECT_TRUE(*iterator == discardable_bitmap[y][x].pixelRef());
EXPECT_FALSE(++iterator) << x << " " << y;
} else {
EXPECT_FALSE(iterator) << x << " " << y;
// Single full-size rect picture.
content_layer_client.add_draw_rect(layer_rect, red_paint);
- scoped_refptr<Picture> one_rect_picture = Picture::Create(layer_rect);
- one_rect_picture->Record(&content_layer_client,
- tile_grid_info);
+ scoped_refptr<Picture> one_rect_picture = Picture::Create(
+ layer_rect, &content_layer_client, tile_grid_info, false, 0);
scoped_ptr<base::Value> serialized_one_rect(
one_rect_picture->AsValue());