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

Unified Diff: cc/layers/content_layer.cc

Issue 23049007: Implemented printToSkPicture without using WebViewBenchmarkSupport. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 4 months 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/layers/content_layer.h ('k') | cc/layers/layer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layers/content_layer.cc
diff --git a/cc/layers/content_layer.cc b/cc/layers/content_layer.cc
index 2053ecbeac10f10610d30aa1be167270aa5808cf..c166c9232b446cfee695143705ffa549fc30dceb 100644
--- a/cc/layers/content_layer.cc
+++ b/cc/layers/content_layer.cc
@@ -145,4 +145,20 @@ bool ContentLayer::SupportsLCDText() const {
return true;
}
+
+skia::RefPtr<SkPicture> ContentLayer::GetPicture() const {
enne (OOO) 2013/08/19 23:01:09 It seems like you should also implement this in Pi
alokp 2013/08/19 23:08:37 Aren't PictureLayers created only if you are using
enne (OOO) 2013/08/19 23:17:21 Yes, PictureLayers are only created with impl-side
alokp 2013/08/19 23:37:20 I missed the "as well" part and did not realize th
+ if (!client_ || !DrawsContent())
+ return skia::RefPtr<SkPicture>();
+
+ int width = bounds().width();
+ int height = bounds().height();
+ gfx::RectF opaque;
+
+ skia::RefPtr<SkPicture> picture = skia::AdoptRef(new SkPicture);
+ SkCanvas* canvas = picture->beginRecording(width, height);
+ client_->PaintContents(canvas, gfx::Rect(width, height), &opaque);
+ picture->endRecording();
+ return picture;
+}
+
} // namespace cc
« no previous file with comments | « cc/layers/content_layer.h ('k') | cc/layers/layer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698