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

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

Issue 761903003: Update from https://crrev.com/306655 (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_layer_tiling.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
11 #include "base/base64.h" 11 #include "base/base64.h"
12 #include "base/debug/trace_event.h" 12 #include "base/debug/trace_event.h"
13 #include "base/debug/trace_event_argument.h" 13 #include "base/debug/trace_event_argument.h"
14 #include "base/values.h" 14 #include "base/values.h"
15 #include "cc/base/math_util.h" 15 #include "cc/base/math_util.h"
16 #include "cc/base/util.h" 16 #include "cc/base/util.h"
17 #include "cc/debug/traced_picture.h" 17 #include "cc/debug/traced_picture.h"
18 #include "cc/debug/traced_value.h" 18 #include "cc/debug/traced_value.h"
19 #include "cc/layers/content_layer_client.h" 19 #include "cc/layers/content_layer_client.h"
20 #include "skia/ext/pixel_ref_utils.h" 20 #include "skia/ext/pixel_ref_utils.h"
21 #include "third_party/skia/include/core/SkBBHFactory.h" 21 #include "third_party/skia/include/core/SkBBHFactory.h"
22 #include "third_party/skia/include/core/SkCanvas.h" 22 #include "third_party/skia/include/core/SkCanvas.h"
23 #include "third_party/skia/include/core/SkData.h" 23 #include "third_party/skia/include/core/SkData.h"
24 #include "third_party/skia/include/core/SkPaint.h" 24 #include "third_party/skia/include/core/SkPaint.h"
25 #include "third_party/skia/include/core/SkPictureRecorder.h" 25 #include "third_party/skia/include/core/SkPictureRecorder.h"
26 #include "third_party/skia/include/core/SkStream.h" 26 #include "third_party/skia/include/core/SkStream.h"
27 #include "third_party/skia/include/utils/SkNullCanvas.h" 27 #include "third_party/skia/include/utils/SkNullCanvas.h"
28 #include "third_party/skia/include/utils/SkPictureUtils.h"
28 #include "ui/gfx/codec/jpeg_codec.h" 29 #include "ui/gfx/codec/jpeg_codec.h"
29 #include "ui/gfx/codec/png_codec.h" 30 #include "ui/gfx/codec/png_codec.h"
30 #include "ui/gfx/geometry/rect_conversions.h" 31 #include "ui/gfx/geometry/rect_conversions.h"
31 #include "ui/gfx/skia_util.h" 32 #include "ui/gfx/skia_util.h"
32 33
33 namespace cc { 34 namespace cc {
34 35
35 namespace { 36 namespace {
36 37
37 SkData* EncodeBitmap(size_t* offset, const SkBitmap& bm) { 38 SkData* EncodeBitmap(size_t* offset, const SkBitmap& bm) {
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 // Pass a NULL context for now and discuss with skia folks if the context 186 // Pass a NULL context for now and discuss with skia folks if the context
186 // is really needed. 187 // is really needed.
187 return picture_->suitableForGpuRasterization(NULL); 188 return picture_->suitableForGpuRasterization(NULL);
188 } 189 }
189 190
190 int Picture::ApproximateOpCount() const { 191 int Picture::ApproximateOpCount() const {
191 DCHECK(picture_); 192 DCHECK(picture_);
192 return picture_->approximateOpCount(); 193 return picture_->approximateOpCount();
193 } 194 }
194 195
196 size_t Picture::ApproximateMemoryUsage() const {
197 DCHECK(picture_);
198 return SkPictureUtils::ApproximateBytesUsed(picture_.get());
199 }
200
195 bool Picture::HasText() const { 201 bool Picture::HasText() const {
196 DCHECK(picture_); 202 DCHECK(picture_);
197 return picture_->hasText(); 203 return picture_->hasText();
198 } 204 }
199 205
200 void Picture::Record(ContentLayerClient* painter, 206 void Picture::Record(ContentLayerClient* painter,
201 const SkTileGridFactory::TileGridInfo& tile_grid_info, 207 const SkTileGridFactory::TileGridInfo& tile_grid_info,
202 RecordingMode recording_mode) { 208 RecordingMode recording_mode) {
203 TRACE_EVENT2("cc", 209 TRACE_EVENT2("cc",
204 "Picture::Record", 210 "Picture::Record",
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 scoped_refptr<base::debug::TracedValue> record_data = 519 scoped_refptr<base::debug::TracedValue> record_data =
514 new base::debug::TracedValue(); 520 new base::debug::TracedValue();
515 TracedValue::SetIDRef(this, record_data.get(), "picture_id"); 521 TracedValue::SetIDRef(this, record_data.get(), "picture_id");
516 record_data->BeginArray("layer_rect"); 522 record_data->BeginArray("layer_rect");
517 MathUtil::AddToTracedValue(layer_rect_, record_data.get()); 523 MathUtil::AddToTracedValue(layer_rect_, record_data.get());
518 record_data->EndArray(); 524 record_data->EndArray();
519 return record_data; 525 return record_data;
520 } 526 }
521 527
522 } // namespace cc 528 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/picture.h ('k') | cc/resources/picture_layer_tiling.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698