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

Side by Side Diff: cc/layers/content_layer.cc

Issue 236633008: Switching Chromium to use new Skia SkPictureRecorder API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update to ToT Created 6 years, 8 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 | « no previous file | cc/layers/picture_layer.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 2010 The Chromium Authors. All rights reserved. 1 // Copyright 2010 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/content_layer.h" 5 #include "cc/layers/content_layer.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/time/time.h" 9 #include "base/time/time.h"
10 #include "cc/layers/content_layer_client.h" 10 #include "cc/layers/content_layer_client.h"
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 } 153 }
154 154
155 skia::RefPtr<SkPicture> ContentLayer::GetPicture() const { 155 skia::RefPtr<SkPicture> ContentLayer::GetPicture() const {
156 if (!DrawsContent()) 156 if (!DrawsContent())
157 return skia::RefPtr<SkPicture>(); 157 return skia::RefPtr<SkPicture>();
158 158
159 int width = bounds().width(); 159 int width = bounds().width();
160 int height = bounds().height(); 160 int height = bounds().height();
161 gfx::RectF opaque; 161 gfx::RectF opaque;
162 162
163 skia::RefPtr<SkPicture> picture = skia::AdoptRef(new SkPicture); 163 SkPictureRecorder recorder;
164 SkCanvas* canvas = picture->beginRecording(width, height); 164 SkCanvas* canvas = recorder.beginRecording(width, height);
165 client_->PaintContents(canvas, gfx::Rect(width, height), &opaque); 165 client_->PaintContents(canvas, gfx::Rect(width, height), &opaque);
166 picture->endRecording(); 166 skia::RefPtr<SkPicture> picture = skia::AdoptRef(recorder.endRecording());
167 return picture; 167 return picture;
168 } 168 }
169 169
170 void ContentLayer::OnOutputSurfaceCreated() { 170 void ContentLayer::OnOutputSurfaceCreated() {
171 SetTextureFormat( 171 SetTextureFormat(
172 layer_tree_host()->GetRendererCapabilities().best_texture_format); 172 layer_tree_host()->GetRendererCapabilities().best_texture_format);
173 TiledLayer::OnOutputSurfaceCreated(); 173 TiledLayer::OnOutputSurfaceCreated();
174 } 174 }
175 175
176 } // namespace cc 176 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/layers/picture_layer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698