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

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

Issue 773373002: Update from https://crrev.com/306706 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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
« no previous file with comments | « cc/resources/picture.h ('k') | cc/resources/picture_pile.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/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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 picture_(picture), 168 picture_(picture),
169 pixel_refs_(pixel_refs), 169 pixel_refs_(pixel_refs),
170 cell_size_(layer_rect.size()) { 170 cell_size_(layer_rect.size()) {
171 } 171 }
172 172
173 Picture::~Picture() { 173 Picture::~Picture() {
174 TRACE_EVENT_OBJECT_DELETED_WITH_ID( 174 TRACE_EVENT_OBJECT_DELETED_WITH_ID(
175 TRACE_DISABLED_BY_DEFAULT("cc.debug"), "cc::Picture", this); 175 TRACE_DISABLED_BY_DEFAULT("cc.debug"), "cc::Picture", this);
176 } 176 }
177 177
178 bool Picture::IsSuitableForGpuRasterization() const { 178 bool Picture::IsSuitableForGpuRasterization(const char** reason) const {
179 DCHECK(picture_); 179 DCHECK(picture_);
180 180
181 // TODO(alokp): SkPicture::suitableForGpuRasterization needs a GrContext. 181 // TODO(hendrikw): SkPicture::suitableForGpuRasterization takes a GrContext.
182 // Ideally this GrContext should be the same as that for rasterizing this 182 // Currently the GrContext isn't used, and should probably be removed from
183 // picture. But we are on the main thread while the rasterization context 183 // skia.
184 // may be on the compositor or raster thread. 184 return picture_->suitableForGpuRasterization(nullptr, reason);
185 // SkPicture::suitableForGpuRasterization is not implemented yet.
186 // Pass a NULL context for now and discuss with skia folks if the context
187 // is really needed.
188 return picture_->suitableForGpuRasterization(NULL);
189 } 185 }
190 186
191 int Picture::ApproximateOpCount() const { 187 int Picture::ApproximateOpCount() const {
192 DCHECK(picture_); 188 DCHECK(picture_);
193 return picture_->approximateOpCount(); 189 return picture_->approximateOpCount();
194 } 190 }
195 191
196 size_t Picture::ApproximateMemoryUsage() const { 192 size_t Picture::ApproximateMemoryUsage() const {
197 DCHECK(picture_); 193 DCHECK(picture_);
198 return SkPictureUtils::ApproximateBytesUsed(picture_.get()); 194 return SkPictureUtils::ApproximateBytesUsed(picture_.get());
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
519 scoped_refptr<base::debug::TracedValue> record_data = 515 scoped_refptr<base::debug::TracedValue> record_data =
520 new base::debug::TracedValue(); 516 new base::debug::TracedValue();
521 TracedValue::SetIDRef(this, record_data.get(), "picture_id"); 517 TracedValue::SetIDRef(this, record_data.get(), "picture_id");
522 record_data->BeginArray("layer_rect"); 518 record_data->BeginArray("layer_rect");
523 MathUtil::AddToTracedValue(layer_rect_, record_data.get()); 519 MathUtil::AddToTracedValue(layer_rect_, record_data.get());
524 record_data->EndArray(); 520 record_data->EndArray();
525 return record_data; 521 return record_data;
526 } 522 }
527 523
528 } // namespace cc 524 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/picture.h ('k') | cc/resources/picture_pile.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698