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

Side by Side Diff: cc/resources/picture.cc

Issue 222903005: cc: Let skia veto gpu rasterization. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: added comment about SetNeedsCommit 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 | « cc/resources/picture.h ('k') | cc/resources/picture_pile.h » ('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/resources/picture.h" 5 #include "cc/resources/picture.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <set> 9 #include <set>
10 10
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 TRACE_DISABLED_BY_DEFAULT("cc.debug"), "cc::Picture", this); 190 TRACE_DISABLED_BY_DEFAULT("cc.debug"), "cc::Picture", this);
191 } 191 }
192 192
193 Picture* Picture::GetCloneForDrawingOnThread(unsigned thread_index) { 193 Picture* Picture::GetCloneForDrawingOnThread(unsigned thread_index) {
194 // SkPicture is not thread-safe to rasterize with, this returns a clone 194 // SkPicture is not thread-safe to rasterize with, this returns a clone
195 // to rasterize with on a specific thread. 195 // to rasterize with on a specific thread.
196 CHECK_GE(clones_.size(), thread_index); 196 CHECK_GE(clones_.size(), thread_index);
197 return thread_index == clones_.size() ? this : clones_[thread_index].get(); 197 return thread_index == clones_.size() ? this : clones_[thread_index].get();
198 } 198 }
199 199
200 bool Picture::IsSuitableForGpuRasterization() const {
201 DCHECK(picture_);
202
203 // TODO(alokp): SkPicture::suitableForGpuRasterization needs a GrContext.
204 // Ideally this GrContext should be the same as that for rasterizing this
205 // picture. But we are on the main thread while the rasterization context
206 // may be on the compositor or raster thread.
207 // SkPicture::suitableForGpuRasterization is not implemented yet.
208 // Pass a NULL context for now and discuss with skia folks if the context
209 // is really needed.
210 return picture_->suitableForGpuRasterization(NULL);
211 }
212
200 void Picture::CloneForDrawing(int num_threads) { 213 void Picture::CloneForDrawing(int num_threads) {
201 TRACE_EVENT1("cc", "Picture::CloneForDrawing", "num_threads", num_threads); 214 TRACE_EVENT1("cc", "Picture::CloneForDrawing", "num_threads", num_threads);
202 215
203 DCHECK(picture_); 216 DCHECK(picture_);
204 DCHECK(clones_.empty()); 217 DCHECK(clones_.empty());
205 218
206 // We can re-use this picture for one raster worker thread. 219 // We can re-use this picture for one raster worker thread.
207 raster_thread_checker_.DetachFromThread(); 220 raster_thread_checker_.DetachFromThread();
208 221
209 if (num_threads > 1) { 222 if (num_threads > 1) {
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 540
528 scoped_refptr<base::debug::ConvertableToTraceFormat> 541 scoped_refptr<base::debug::ConvertableToTraceFormat>
529 Picture::AsTraceableRecordData() const { 542 Picture::AsTraceableRecordData() const {
530 scoped_ptr<base::DictionaryValue> record_data(new base::DictionaryValue()); 543 scoped_ptr<base::DictionaryValue> record_data(new base::DictionaryValue());
531 record_data->Set("picture_id", TracedValue::CreateIDRef(this).release()); 544 record_data->Set("picture_id", TracedValue::CreateIDRef(this).release());
532 record_data->Set("layer_rect", MathUtil::AsValue(layer_rect_).release()); 545 record_data->Set("layer_rect", MathUtil::AsValue(layer_rect_).release());
533 return TracedValue::FromValue(record_data.release()); 546 return TracedValue::FromValue(record_data.release());
534 } 547 }
535 548
536 } // namespace cc 549 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/picture.h ('k') | cc/resources/picture_pile.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698