Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(53)

Unified Diff: cc/picture.cc

Issue 11299324: Make PicturePile pile. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix signed/unsigned mismatch warning Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/picture.h ('k') | cc/picture_pile.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/picture.cc
diff --git a/cc/picture.cc b/cc/picture.cc
index 50eefd867096b0a492e579052da5dbc14028d5b2..f1e4627e22a330185e84344b39b18d31d6d53255 100644
--- a/cc/picture.cc
+++ b/cc/picture.cc
@@ -11,11 +11,12 @@
namespace cc {
-scoped_refptr<Picture> Picture::Create() {
- return make_scoped_refptr(new Picture());
+scoped_refptr<Picture> Picture::Create(gfx::Rect layer_rect) {
+ return make_scoped_refptr(new Picture(layer_rect));
}
-Picture::Picture() {
+Picture::Picture(gfx::Rect layer_rect)
+ : layer_rect_(layer_rect) {
}
Picture::Picture(SkPicture* picture, gfx::Rect layer_rect,
@@ -28,7 +29,7 @@ Picture::Picture(SkPicture* picture, gfx::Rect layer_rect,
Picture::~Picture() {
}
-scoped_refptr<Picture> Picture::Clone() {
+scoped_refptr<Picture> Picture::Clone() const {
// SkPicture is not thread-safe to rasterize with, so return a thread-safe
// clone of it.
DCHECK(picture_.get());
@@ -36,7 +37,7 @@ scoped_refptr<Picture> Picture::Clone() {
return make_scoped_refptr(new Picture(clone, layer_rect_, opaque_rect_));
}
-void Picture::Record(ContentLayerClient* painter, gfx::Rect layer_rect,
+void Picture::Record(ContentLayerClient* painter,
RenderingStats& stats) {
TRACE_EVENT0("cc", "Picture::Record");
@@ -45,37 +46,36 @@ void Picture::Record(ContentLayerClient* painter, gfx::Rect layer_rect,
picture_.reset(new SkPicture);
SkCanvas* canvas = picture_->beginRecording(
- layer_rect.width(),
- layer_rect.height(),
+ layer_rect_.width(),
+ layer_rect_.height(),
SkPicture::kOptimizeForClippedPlayback_RecordingFlag);
canvas->save();
- canvas->translate(SkFloatToScalar(-layer_rect.x()),
- SkFloatToScalar(-layer_rect.y()));
+ canvas->translate(SkFloatToScalar(-layer_rect_.x()),
+ SkFloatToScalar(-layer_rect_.y()));
SkPaint paint;
paint.setAntiAlias(false);
paint.setXfermodeMode(SkXfermode::kClear_Mode);
- SkRect layer_skrect = SkRect::MakeXYWH(layer_rect.x(),
- layer_rect.y(),
- layer_rect.width(),
- layer_rect.height());
+ SkRect layer_skrect = SkRect::MakeXYWH(layer_rect_.x(),
+ layer_rect_.y(),
+ layer_rect_.width(),
+ layer_rect_.height());
canvas->drawRect(layer_skrect, paint);
canvas->clipRect(layer_skrect);
gfx::RectF opaque_layer_rect;
base::TimeTicks beginPaintTime = base::TimeTicks::Now();
- painter->paintContents(canvas, layer_rect, opaque_layer_rect);
+ painter->paintContents(canvas, layer_rect_, opaque_layer_rect);
double delta = (base::TimeTicks::Now() - beginPaintTime).InSecondsF();
stats.totalPaintTimeInSeconds += delta;
- stats.totalPixelsPainted += layer_rect.width() *
- layer_rect.height();
+ stats.totalPixelsPainted += layer_rect_.width() *
+ layer_rect_.height();
canvas->restore();
picture_->endRecording();
opaque_rect_ = gfx::ToEnclosedRect(opaque_layer_rect);
- layer_rect_ = layer_rect;
}
void Picture::Raster(SkCanvas* canvas) {
« no previous file with comments | « cc/picture.h ('k') | cc/picture_pile.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698