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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « cc/layers/picture_layer.h ('k') | content/renderer/gpu/gpu_benchmarking_extension.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/layers/picture_layer.h" 5 #include "cc/layers/picture_layer.h"
6 6
7 #include "cc/debug/benchmark_instrumentation.h" 7 #include "cc/debug/benchmark_instrumentation.h"
8 #include "cc/debug/devtools_instrumentation.h" 8 #include "cc/debug/devtools_instrumentation.h"
9 #include "cc/layers/content_layer_client.h"
9 #include "cc/layers/picture_layer_impl.h" 10 #include "cc/layers/picture_layer_impl.h"
10 #include "cc/trees/layer_tree_impl.h" 11 #include "cc/trees/layer_tree_impl.h"
11 #include "ui/gfx/rect_conversions.h" 12 #include "ui/gfx/rect_conversions.h"
12 13
13 namespace cc { 14 namespace cc {
14 15
15 scoped_refptr<PictureLayer> PictureLayer::Create(ContentLayerClient* client) { 16 scoped_refptr<PictureLayer> PictureLayer::Create(ContentLayerClient* client) {
16 return make_scoped_refptr(new PictureLayer(client)); 17 return make_scoped_refptr(new PictureLayer(client));
17 } 18 }
18 19
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 } 124 }
124 125
125 void PictureLayer::SetIsMask(bool is_mask) { 126 void PictureLayer::SetIsMask(bool is_mask) {
126 is_mask_ = is_mask; 127 is_mask_ = is_mask;
127 } 128 }
128 129
129 bool PictureLayer::SupportsLCDText() const { 130 bool PictureLayer::SupportsLCDText() const {
130 return true; 131 return true;
131 } 132 }
132 133
134 skia::RefPtr<SkPicture> PictureLayer::GetPicture() const {
135 // 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.
136 // or paint a fresh one depending on what we intend to do with the
137 // picture. For now we just paint a fresh one to get consistent results.
138 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.
139 return skia::RefPtr<SkPicture>();
140
141 int width = bounds().width();
142 int height = bounds().height();
143 gfx::RectF opaque;
144
145 skia::RefPtr<SkPicture> picture = skia::AdoptRef(new SkPicture);
146 SkCanvas* canvas = picture->beginRecording(width, height);
147 client_->PaintContents(canvas, gfx::Rect(width, height), &opaque);
148 picture->endRecording();
149 return picture;
150 }
151
133 } // namespace cc 152 } // namespace cc
OLDNEW
« 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