OLD | NEW |
---|---|
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 "third_party/skia/include/core/SkCanvas.h" | 7 #include "third_party/skia/include/core/SkCanvas.h" |
8 #include "third_party/skia/include/core/SkDrawPictureCallback.h" | 8 #include "third_party/skia/include/core/SkDrawPictureCallback.h" |
9 #include "third_party/skia/include/core/SkMatrix.h" | 9 #include "third_party/skia/include/core/SkMatrix.h" |
10 #include "third_party/skia/include/core/SkPicture.h" | 10 #include "third_party/skia/include/core/SkPicture.h" |
(...skipping 13 matching lines...) Expand all Loading... | |
24 SkDrawPictureCallback* callback) const { | 24 SkDrawPictureCallback* callback) const { |
25 canvas->save(); | 25 canvas->save(); |
26 canvas->translate(location_.x(), location_.y()); | 26 canvas->translate(location_.x(), location_.y()); |
27 if (callback) | 27 if (callback) |
28 picture_->playback(canvas, callback); | 28 picture_->playback(canvas, callback); |
29 else | 29 else |
30 canvas->drawPicture(picture_.get()); | 30 canvas->drawPicture(picture_.get()); |
31 canvas->restore(); | 31 canvas->restore(); |
32 } | 32 } |
33 | 33 |
34 void DrawingDisplayItem::RasterForTracing(SkCanvas* canvas) const { | |
vmpstr
2015/01/08 21:44:34
This seems to be basically ::Raster with nullptr a
ajuma
2015/01/08 22:20:58
We need playback instead of drawPicture to make th
vmpstr
2015/01/08 22:45:59
Ah I see. FWIW, you can just Raster and give is so
ajuma
2015/01/08 23:16:11
Added a comment.
| |
35 canvas->save(); | |
36 canvas->translate(location_.x(), location_.y()); | |
37 picture_->playback(canvas); | |
38 canvas->restore(); | |
39 } | |
40 | |
34 bool DrawingDisplayItem::IsSuitableForGpuRasterization() const { | 41 bool DrawingDisplayItem::IsSuitableForGpuRasterization() const { |
35 return picture_->suitableForGpuRasterization(NULL); | 42 return picture_->suitableForGpuRasterization(NULL); |
36 } | 43 } |
37 | 44 |
38 int DrawingDisplayItem::ApproximateOpCount() const { | 45 int DrawingDisplayItem::ApproximateOpCount() const { |
39 return picture_->approximateOpCount() + sizeof(gfx::PointF); | 46 return picture_->approximateOpCount() + sizeof(gfx::PointF); |
40 } | 47 } |
41 | 48 |
42 size_t DrawingDisplayItem::PictureMemoryUsage() const { | 49 size_t DrawingDisplayItem::PictureMemoryUsage() const { |
43 DCHECK(picture_); | 50 DCHECK(picture_); |
44 return SkPictureUtils::ApproximateBytesUsed(picture_.get()); | 51 return SkPictureUtils::ApproximateBytesUsed(picture_.get()); |
45 } | 52 } |
46 | 53 |
47 } // namespace cc | 54 } // namespace cc |
OLD | NEW |