| 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/playback/filter_display_item.h" | 5 #include "cc/playback/filter_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 "cc/output/render_surface_filters.h" | 9 #include "cc/output/render_surface_filters.h" |
| 10 #include "cc/proto/display_item.pb.h" | 10 #include "cc/proto/display_item.pb.h" |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 | 70 |
| 71 SkPaint paint; | 71 SkPaint paint; |
| 72 paint.setXfermodeMode(SkXfermode::kSrcOver_Mode); | 72 paint.setXfermodeMode(SkXfermode::kSrcOver_Mode); |
| 73 paint.setImageFilter(image_filter.get()); | 73 paint.setImageFilter(image_filter.get()); |
| 74 canvas->saveLayer(&boundaries, &paint); | 74 canvas->saveLayer(&boundaries, &paint); |
| 75 | 75 |
| 76 canvas->translate(-bounds_.x(), -bounds_.y()); | 76 canvas->translate(-bounds_.x(), -bounds_.y()); |
| 77 } | 77 } |
| 78 | 78 |
| 79 void FilterDisplayItem::AsValueInto( | 79 void FilterDisplayItem::AsValueInto( |
| 80 const gfx::Rect& visual_rect, |
| 80 base::trace_event::TracedValue* array) const { | 81 base::trace_event::TracedValue* array) const { |
| 81 array->AppendString(base::StringPrintf("FilterDisplayItem bounds: [%s]", | 82 array->AppendString(base::StringPrintf( |
| 82 bounds_.ToString().c_str())); | 83 "FilterDisplayItem bounds: [%s] visualRect: [%s]", |
| 84 bounds_.ToString().c_str(), visual_rect.ToString().c_str())); |
| 83 } | 85 } |
| 84 | 86 |
| 85 EndFilterDisplayItem::EndFilterDisplayItem() { | 87 EndFilterDisplayItem::EndFilterDisplayItem() { |
| 86 DisplayItem::SetNew(true /* suitable_for_gpu_raster */, 0 /* op_count */, | 88 DisplayItem::SetNew(true /* suitable_for_gpu_raster */, 0 /* op_count */, |
| 87 0 /* external_memory_usage */); | 89 0 /* external_memory_usage */); |
| 88 } | 90 } |
| 89 | 91 |
| 90 EndFilterDisplayItem::~EndFilterDisplayItem() { | 92 EndFilterDisplayItem::~EndFilterDisplayItem() { |
| 91 } | 93 } |
| 92 | 94 |
| 93 void EndFilterDisplayItem::ToProtobuf(proto::DisplayItem* proto) const { | 95 void EndFilterDisplayItem::ToProtobuf(proto::DisplayItem* proto) const { |
| 94 proto->set_type(proto::DisplayItem::Type_EndFilter); | 96 proto->set_type(proto::DisplayItem::Type_EndFilter); |
| 95 } | 97 } |
| 96 | 98 |
| 97 void EndFilterDisplayItem::FromProtobuf(const proto::DisplayItem& proto) { | 99 void EndFilterDisplayItem::FromProtobuf(const proto::DisplayItem& proto) { |
| 98 DCHECK_EQ(proto::DisplayItem::Type_EndFilter, proto.type()); | 100 DCHECK_EQ(proto::DisplayItem::Type_EndFilter, proto.type()); |
| 99 } | 101 } |
| 100 | 102 |
| 101 void EndFilterDisplayItem::Raster(SkCanvas* canvas, | 103 void EndFilterDisplayItem::Raster(SkCanvas* canvas, |
| 102 const gfx::Rect& canvas_target_playback_rect, | 104 const gfx::Rect& canvas_target_playback_rect, |
| 103 SkPicture::AbortCallback* callback) const { | 105 SkPicture::AbortCallback* callback) const { |
| 104 canvas->restore(); | 106 canvas->restore(); |
| 105 canvas->restore(); | 107 canvas->restore(); |
| 106 } | 108 } |
| 107 | 109 |
| 108 void EndFilterDisplayItem::AsValueInto( | 110 void EndFilterDisplayItem::AsValueInto( |
| 111 const gfx::Rect& visual_rect, |
| 109 base::trace_event::TracedValue* array) const { | 112 base::trace_event::TracedValue* array) const { |
| 110 array->AppendString("EndFilterDisplayItem"); | 113 array->AppendString( |
| 114 base::StringPrintf("EndFilterDisplayItem visualRect: [%s]", |
| 115 visual_rect.ToString().c_str())); |
| 111 } | 116 } |
| 112 | 117 |
| 113 } // namespace cc | 118 } // namespace cc |
| OLD | NEW |