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

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: replaced && with &= 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
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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 TRACE_DISABLED_BY_DEFAULT("cc.debug"), "cc::Picture", this); 188 TRACE_DISABLED_BY_DEFAULT("cc.debug"), "cc::Picture", this);
189 } 189 }
190 190
191 Picture* Picture::GetCloneForDrawingOnThread(unsigned thread_index) { 191 Picture* Picture::GetCloneForDrawingOnThread(unsigned thread_index) {
192 // SkPicture is not thread-safe to rasterize with, this returns a clone 192 // SkPicture is not thread-safe to rasterize with, this returns a clone
193 // to rasterize with on a specific thread. 193 // to rasterize with on a specific thread.
194 CHECK_GE(clones_.size(), thread_index); 194 CHECK_GE(clones_.size(), thread_index);
195 return thread_index == clones_.size() ? this : clones_[thread_index].get(); 195 return thread_index == clones_.size() ? this : clones_[thread_index].get();
196 } 196 }
197 197
198 bool Picture::IsSuitableForGpuRasterization() const {
199 DCHECK(picture_);
200
201 // TODO(alokp): SkPicture::suitableForGpuRasterization needs a GrContext.
202 // Ideally this GrContext should be the same as that for rasterizing this
203 // picture. But we are on the main thread while the rasterization context
204 // may be on the compositor or raster thread.
205 // SkPicture::suitableForGpuRasterization is not implemented yet.
206 // Pass a NULL context for now and discuss with skia folks if the context
207 // is really needed.
208 return picture_->suitableForGpuRasterization(NULL);
209 }
210
198 void Picture::CloneForDrawing(int num_threads) { 211 void Picture::CloneForDrawing(int num_threads) {
199 TRACE_EVENT1("cc", "Picture::CloneForDrawing", "num_threads", num_threads); 212 TRACE_EVENT1("cc", "Picture::CloneForDrawing", "num_threads", num_threads);
200 213
201 DCHECK(picture_); 214 DCHECK(picture_);
202 DCHECK(clones_.empty()); 215 DCHECK(clones_.empty());
203 216
204 // We can re-use this picture for one raster worker thread. 217 // We can re-use this picture for one raster worker thread.
205 raster_thread_checker_.DetachFromThread(); 218 raster_thread_checker_.DetachFromThread();
206 219
207 if (num_threads > 1) { 220 if (num_threads > 1) {
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 516
504 scoped_refptr<base::debug::ConvertableToTraceFormat> 517 scoped_refptr<base::debug::ConvertableToTraceFormat>
505 Picture::AsTraceableRecordData() const { 518 Picture::AsTraceableRecordData() const {
506 scoped_ptr<base::DictionaryValue> record_data(new base::DictionaryValue()); 519 scoped_ptr<base::DictionaryValue> record_data(new base::DictionaryValue());
507 record_data->Set("picture_id", TracedValue::CreateIDRef(this).release()); 520 record_data->Set("picture_id", TracedValue::CreateIDRef(this).release());
508 record_data->Set("layer_rect", MathUtil::AsValue(layer_rect_).release()); 521 record_data->Set("layer_rect", MathUtil::AsValue(layer_rect_).release());
509 return TracedValue::FromValue(record_data.release()); 522 return TracedValue::FromValue(record_data.release());
510 } 523 }
511 524
512 } // namespace cc 525 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698