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

Side by Side Diff: cc/playback/transform_display_item.cc

Issue 1158553004: cc: Cull DrawingDisplayItems outside of the raster playback rect (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cull: . Created 5 years, 6 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/playback/transform_display_item.h ('k') | cc/test/skia_common.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/playback/transform_display_item.h" 5 #include "cc/playback/transform_display_item.h"
6 6
7 #include "base/strings/stringprintf.h" 7 #include "base/strings/stringprintf.h"
8 #include "base/trace_event/trace_event_argument.h" 8 #include "base/trace_event/trace_event_argument.h"
9 #include "third_party/skia/include/core/SkCanvas.h" 9 #include "third_party/skia/include/core/SkCanvas.h"
10 10
11 namespace cc { 11 namespace cc {
12 12
13 TransformDisplayItem::TransformDisplayItem() 13 TransformDisplayItem::TransformDisplayItem()
14 : transform_(gfx::Transform::kSkipInitialization) { 14 : transform_(gfx::Transform::kSkipInitialization) {
15 } 15 }
16 16
17 TransformDisplayItem::~TransformDisplayItem() { 17 TransformDisplayItem::~TransformDisplayItem() {
18 } 18 }
19 19
20 void TransformDisplayItem::SetNew(const gfx::Transform& transform) { 20 void TransformDisplayItem::SetNew(const gfx::Transform& transform) {
21 transform_ = transform; 21 transform_ = transform;
22 22
23 size_t memory_usage = sizeof(gfx::Transform); 23 size_t memory_usage = sizeof(gfx::Transform);
24 DisplayItem::SetNew(true /* suitable_for_gpu_raster */, 1 /* op_count */, 24 DisplayItem::SetNew(true /* suitable_for_gpu_raster */, 1 /* op_count */,
25 memory_usage); 25 memory_usage);
26 } 26 }
27 27
28 void TransformDisplayItem::Raster(SkCanvas* canvas, 28 void TransformDisplayItem::Raster(SkCanvas* canvas,
29 const gfx::Rect& canvas_target_playback_rect,
29 SkPicture::AbortCallback* callback) const { 30 SkPicture::AbortCallback* callback) const {
30 canvas->save(); 31 canvas->save();
31 if (!transform_.IsIdentity()) 32 if (!transform_.IsIdentity())
32 canvas->concat(transform_.matrix()); 33 canvas->concat(transform_.matrix());
33 } 34 }
34 35
35 void TransformDisplayItem::AsValueInto( 36 void TransformDisplayItem::AsValueInto(
36 base::trace_event::TracedValue* array) const { 37 base::trace_event::TracedValue* array) const {
37 array->AppendString(base::StringPrintf("TransformDisplayItem transform: [%s]", 38 array->AppendString(base::StringPrintf("TransformDisplayItem transform: [%s]",
38 transform_.ToString().c_str())); 39 transform_.ToString().c_str()));
39 } 40 }
40 41
41 EndTransformDisplayItem::EndTransformDisplayItem() { 42 EndTransformDisplayItem::EndTransformDisplayItem() {
42 DisplayItem::SetNew(true /* suitable_for_gpu_raster */, 0 /* op_count */, 43 DisplayItem::SetNew(true /* suitable_for_gpu_raster */, 0 /* op_count */,
43 0 /* memory_usage */); 44 0 /* memory_usage */);
44 } 45 }
45 46
46 EndTransformDisplayItem::~EndTransformDisplayItem() { 47 EndTransformDisplayItem::~EndTransformDisplayItem() {
47 } 48 }
48 49
49 void EndTransformDisplayItem::Raster(SkCanvas* canvas, 50 void EndTransformDisplayItem::Raster(
50 SkPicture::AbortCallback* callback) const { 51 SkCanvas* canvas,
52 const gfx::Rect& canvas_target_playback_rect,
53 SkPicture::AbortCallback* callback) const {
51 canvas->restore(); 54 canvas->restore();
52 } 55 }
53 56
54 void EndTransformDisplayItem::AsValueInto( 57 void EndTransformDisplayItem::AsValueInto(
55 base::trace_event::TracedValue* array) const { 58 base::trace_event::TracedValue* array) const {
56 array->AppendString("EndTransformDisplayItem"); 59 array->AppendString("EndTransformDisplayItem");
57 } 60 }
58 61
59 } // namespace cc 62 } // namespace cc
OLDNEW
« no previous file with comments | « cc/playback/transform_display_item.h ('k') | cc/test/skia_common.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698