Commit 1799b72d authored by danakj's avatar danakj Committed by Commit bot

cc: Remove opaque rect from cc::Picture.

We don't do anything with this rect so remove it.

R=nduca@chromium.org, vmpstr
BUG=413479

Review URL: https://codereview.chromium.org/563963002

Cr-Commit-Position: refs/heads/master@{#294664}
parent f7e0e528
......@@ -122,9 +122,7 @@ scoped_refptr<Picture> Picture::CreateFromSkpValue(const base::Value* value) {
return NULL;
gfx::Rect layer_rect(skpicture->width(), skpicture->height());
gfx::Rect opaque_rect(skpicture->width(), skpicture->height());
return make_scoped_refptr(new Picture(skpicture, layer_rect, opaque_rect));
return make_scoped_refptr(new Picture(skpicture, layer_rect));
}
scoped_refptr<Picture> Picture::CreateFromValue(const base::Value* raw_value) {
......@@ -149,37 +147,24 @@ scoped_refptr<Picture> Picture::CreateFromValue(const base::Value* raw_value) {
if (!MathUtil::FromValue(layer_rect_value, &layer_rect))
return NULL;
const base::Value* opaque_rect_value = NULL;
if (!value->Get("params.opaque_rect", &opaque_rect_value))
return NULL;
gfx::Rect opaque_rect;
if (!MathUtil::FromValue(opaque_rect_value, &opaque_rect))
return NULL;
// Read the picture. This creates an empty picture on failure.
SkPicture* skpicture = SkPicture::CreateFromStream(&stream, &DecodeBitmap);
if (skpicture == NULL)
return NULL;
return make_scoped_refptr(new Picture(skpicture, layer_rect, opaque_rect));
return make_scoped_refptr(new Picture(skpicture, layer_rect));
}
Picture::Picture(SkPicture* picture,
const gfx::Rect& layer_rect,
const gfx::Rect& opaque_rect) :
layer_rect_(layer_rect),
opaque_rect_(opaque_rect),
Picture::Picture(SkPicture* picture, const gfx::Rect& layer_rect)
: layer_rect_(layer_rect),
picture_(skia::AdoptRef(picture)),
cell_size_(layer_rect.size()) {
}
Picture::Picture(const skia::RefPtr<SkPicture>& picture,
const gfx::Rect& layer_rect,
const gfx::Rect& opaque_rect,
const PixelRefMap& pixel_refs) :
layer_rect_(layer_rect),
opaque_rect_(opaque_rect),
picture_(picture),
pixel_refs_(pixel_refs),
cell_size_(layer_rect.size()) {
......@@ -287,8 +272,6 @@ void Picture::Record(ContentLayerClient* painter,
playback_.reset(recording->releasePlayback());
}
opaque_rect_ = gfx::ToEnclosedRect(opaque_layer_rect);
EmitTraceSnapshot();
}
......@@ -417,7 +400,6 @@ scoped_ptr<base::Value> Picture::AsValue() const {
// Encode the picture as base64.
scoped_ptr<base::DictionaryValue> res(new base::DictionaryValue());
res->Set("params.layer_rect", MathUtil::AsValue(layer_rect_).release());
res->Set("params.opaque_rect", MathUtil::AsValue(opaque_rect_).release());
size_t serialized_size = stream.bytesWritten();
scoped_ptr<char[]> serialized_picture(new char[serialized_size]);
......
......@@ -63,7 +63,6 @@ class CC_EXPORT Picture
static scoped_refptr<Picture> CreateFromSkpValue(const base::Value* value);
gfx::Rect LayerRect() const { return layer_rect_; }
gfx::Rect OpaqueRect() const { return opaque_rect_; }
// Has Record() been called yet?
bool HasRecording() const { return picture_.get() != NULL; }
......@@ -135,12 +134,9 @@ class CC_EXPORT Picture
// ownership to this picture.
Picture(const skia::RefPtr<SkPicture>&,
const gfx::Rect& layer_rect,
const gfx::Rect& opaque_rect,
const PixelRefMap& pixel_refs);
// This constructor will call AdoptRef on the SkPicture.
Picture(SkPicture*,
const gfx::Rect& layer_rect,
const gfx::Rect& opaque_rect);
Picture(SkPicture*, const gfx::Rect& layer_rect);
~Picture();
// Record a paint operation. To be able to safely use this SkPicture for
......@@ -153,7 +149,6 @@ class CC_EXPORT Picture
void GatherPixelRefs(const SkTileGridFactory::TileGridInfo& tile_grid_info);
gfx::Rect layer_rect_;
gfx::Rect opaque_rect_;
skia::RefPtr<SkPicture> picture_;
scoped_ptr<const EXPERIMENTAL::SkPlayback> playback_;
......
......@@ -73,8 +73,6 @@ TEST(PictureTest, AsBase64String) {
EXPECT_EQ(one_rect_picture->LayerRect(),
one_rect_picture_check->LayerRect());
EXPECT_EQ(one_rect_picture->OpaqueRect(),
one_rect_picture_check->OpaqueRect());
EXPECT_EQ(0, memcmp(one_rect_buffer, one_rect_buffer_check, 4 * 100 * 100));
}
......@@ -104,8 +102,6 @@ TEST(PictureTest, AsBase64String) {
EXPECT_EQ(two_rect_picture->LayerRect(),
two_rect_picture_check->LayerRect());
EXPECT_EQ(two_rect_picture->OpaqueRect(),
two_rect_picture_check->OpaqueRect());
EXPECT_EQ(0, memcmp(two_rect_buffer, two_rect_buffer_check, 4 * 100 * 100));
}
}
......@@ -438,8 +434,6 @@ TEST(PictureTest, CreateFromSkpValue) {
EXPECT_EQ(100, one_rect_picture_check->LayerRect().width());
EXPECT_EQ(200, one_rect_picture_check->LayerRect().height());
EXPECT_EQ(100, one_rect_picture_check->OpaqueRect().width());
EXPECT_EQ(200, one_rect_picture_check->OpaqueRect().height());
}
TEST(PictureTest, RecordingModes) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment