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

Unified Diff: cc/layers/picture_layer.cc

Issue 23049007: Implemented printToSkPicture without using WebViewBenchmarkSupport. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixed compile error 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/picture_layer.h ('k') | content/renderer/gpu/gpu_benchmarking_extension.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layers/picture_layer.cc
diff --git a/cc/layers/picture_layer.cc b/cc/layers/picture_layer.cc
index 889e2fbd3f6e3ebac325bc35895276ac759c312e..34792eb98e5faf8c2a46d1407adee3d2e8b39c0d 100644
--- a/cc/layers/picture_layer.cc
+++ b/cc/layers/picture_layer.cc
@@ -6,6 +6,7 @@
#include "cc/debug/benchmark_instrumentation.h"
#include "cc/debug/devtools_instrumentation.h"
+#include "cc/layers/content_layer_client.h"
#include "cc/layers/picture_layer_impl.h"
#include "cc/trees/layer_tree_impl.h"
#include "ui/gfx/rect_conversions.h"
@@ -130,4 +131,22 @@ bool PictureLayer::SupportsLCDText() const {
return true;
}
+skia::RefPtr<SkPicture> PictureLayer::GetPicture() const {
+ // We could either return the SkPicture in picture-pile,
enne (OOO) 2013/08/20 01:25:15 This comment is a little misleading. PicturePile
alokp 2013/08/20 18:01:56 Done.
+ // or paint a fresh one depending on what we intend to do with the
+ // picture. For now we just paint a fresh one to get consistent results.
+ if (!DrawsContent())
enne (OOO) 2013/08/20 01:25:15 Can you make this early out consistent with the Co
alokp 2013/08/20 18:01:56 Done.
+ 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/picture_layer.h ('k') | content/renderer/gpu/gpu_benchmarking_extension.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698