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

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

Issue 851503003: Update from https://crrev.com/311076 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 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
« no previous file with comments | « cc/resources/drawing_display_item.h ('k') | cc/resources/picture.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/drawing_display_item.h" 5 #include "cc/resources/drawing_display_item.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "third_party/skia/include/core/SkCanvas.h" 8 #include "third_party/skia/include/core/SkCanvas.h"
9 #include "third_party/skia/include/core/SkDrawPictureCallback.h" 9 #include "third_party/skia/include/core/SkDrawPictureCallback.h"
10 #include "third_party/skia/include/core/SkMatrix.h" 10 #include "third_party/skia/include/core/SkMatrix.h"
(...skipping 14 matching lines...) Expand all
25 SkDrawPictureCallback* callback) const { 25 SkDrawPictureCallback* callback) const {
26 canvas->save(); 26 canvas->save();
27 canvas->translate(location_.x(), location_.y()); 27 canvas->translate(location_.x(), location_.y());
28 if (callback) 28 if (callback)
29 picture_->playback(canvas, callback); 29 picture_->playback(canvas, callback);
30 else 30 else
31 canvas->drawPicture(picture_.get()); 31 canvas->drawPicture(picture_.get());
32 canvas->restore(); 32 canvas->restore();
33 } 33 }
34 34
35 void DrawingDisplayItem::RasterForTracing(SkCanvas* canvas) const {
36 canvas->save();
37 canvas->translate(location_.x(), location_.y());
38 // The picture debugger in about:tracing doesn't drill down into |drawPicture|
39 // operations. Calling |playback()| rather than |drawPicture()| causes the
40 // skia operations in |picture_| to appear individually in the picture
41 // produced for tracing rather than being hidden inside a drawPicture
42 // operation.
43 picture_->playback(canvas);
44 canvas->restore();
45 }
46
35 bool DrawingDisplayItem::IsSuitableForGpuRasterization() const { 47 bool DrawingDisplayItem::IsSuitableForGpuRasterization() const {
36 return picture_->suitableForGpuRasterization(NULL); 48 return picture_->suitableForGpuRasterization(NULL);
37 } 49 }
38 50
39 int DrawingDisplayItem::ApproximateOpCount() const { 51 int DrawingDisplayItem::ApproximateOpCount() const {
40 return picture_->approximateOpCount() + sizeof(gfx::PointF); 52 return picture_->approximateOpCount() + sizeof(gfx::PointF);
41 } 53 }
42 54
43 size_t DrawingDisplayItem::PictureMemoryUsage() const { 55 size_t DrawingDisplayItem::PictureMemoryUsage() const {
44 DCHECK(picture_); 56 DCHECK(picture_);
45 return SkPictureUtils::ApproximateBytesUsed(picture_.get()); 57 return SkPictureUtils::ApproximateBytesUsed(picture_.get());
46 } 58 }
47 59
48 } // namespace cc 60 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/drawing_display_item.h ('k') | cc/resources/picture.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698