| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 10 #include "base/trace_event/trace_event_argument.h" | 10 #include "base/trace_event/trace_event_argument.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 ImageSerializationProcessor* image_serialization_processor) const { | 51 ImageSerializationProcessor* image_serialization_processor) const { |
| 52 proto->set_type(proto::DisplayItem::Type_Filter); | 52 proto->set_type(proto::DisplayItem::Type_Filter); |
| 53 | 53 |
| 54 proto::FilterDisplayItem* details = proto->mutable_filter_item(); | 54 proto::FilterDisplayItem* details = proto->mutable_filter_item(); |
| 55 RectFToProto(bounds_, details->mutable_bounds()); | 55 RectFToProto(bounds_, details->mutable_bounds()); |
| 56 | 56 |
| 57 // TODO(dtrainor): Support serializing FilterOperations (crbug.com/541321). | 57 // TODO(dtrainor): Support serializing FilterOperations (crbug.com/541321). |
| 58 } | 58 } |
| 59 | 59 |
| 60 void FilterDisplayItem::Raster(SkCanvas* canvas, | 60 void FilterDisplayItem::Raster(SkCanvas* canvas, |
| 61 const gfx::Rect& canvas_target_playback_rect, | |
| 62 SkPicture::AbortCallback* callback) const { | 61 SkPicture::AbortCallback* callback) const { |
| 63 canvas->save(); | 62 canvas->save(); |
| 64 canvas->translate(bounds_.x(), bounds_.y()); | 63 canvas->translate(bounds_.x(), bounds_.y()); |
| 65 | 64 |
| 66 skia::RefPtr<SkImageFilter> image_filter = | 65 skia::RefPtr<SkImageFilter> image_filter = |
| 67 RenderSurfaceFilters::BuildImageFilter( | 66 RenderSurfaceFilters::BuildImageFilter( |
| 68 filters_, gfx::SizeF(bounds_.width(), bounds_.height())); | 67 filters_, gfx::SizeF(bounds_.width(), bounds_.height())); |
| 69 SkRect boundaries = SkRect::MakeWH(bounds_.width(), bounds_.height()); | 68 SkRect boundaries = SkRect::MakeWH(bounds_.width(), bounds_.height()); |
| 70 | 69 |
| 71 SkPaint paint; | 70 SkPaint paint; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 98 | 97 |
| 99 EndFilterDisplayItem::~EndFilterDisplayItem() {} | 98 EndFilterDisplayItem::~EndFilterDisplayItem() {} |
| 100 | 99 |
| 101 void EndFilterDisplayItem::ToProtobuf( | 100 void EndFilterDisplayItem::ToProtobuf( |
| 102 proto::DisplayItem* proto, | 101 proto::DisplayItem* proto, |
| 103 ImageSerializationProcessor* image_serialization_processor) const { | 102 ImageSerializationProcessor* image_serialization_processor) const { |
| 104 proto->set_type(proto::DisplayItem::Type_EndFilter); | 103 proto->set_type(proto::DisplayItem::Type_EndFilter); |
| 105 } | 104 } |
| 106 | 105 |
| 107 void EndFilterDisplayItem::Raster(SkCanvas* canvas, | 106 void EndFilterDisplayItem::Raster(SkCanvas* canvas, |
| 108 const gfx::Rect& canvas_target_playback_rect, | |
| 109 SkPicture::AbortCallback* callback) const { | 107 SkPicture::AbortCallback* callback) const { |
| 110 canvas->restore(); | 108 canvas->restore(); |
| 111 canvas->restore(); | 109 canvas->restore(); |
| 112 } | 110 } |
| 113 | 111 |
| 114 void EndFilterDisplayItem::AsValueInto( | 112 void EndFilterDisplayItem::AsValueInto( |
| 115 const gfx::Rect& visual_rect, | 113 const gfx::Rect& visual_rect, |
| 116 base::trace_event::TracedValue* array) const { | 114 base::trace_event::TracedValue* array) const { |
| 117 array->AppendString( | 115 array->AppendString( |
| 118 base::StringPrintf("EndFilterDisplayItem visualRect: [%s]", | 116 base::StringPrintf("EndFilterDisplayItem visualRect: [%s]", |
| 119 visual_rect.ToString().c_str())); | 117 visual_rect.ToString().c_str())); |
| 120 } | 118 } |
| 121 | 119 |
| 122 size_t EndFilterDisplayItem::ExternalMemoryUsage() const { | 120 size_t EndFilterDisplayItem::ExternalMemoryUsage() const { |
| 123 return 0; | 121 return 0; |
| 124 } | 122 } |
| 125 | 123 |
| 126 } // namespace cc | 124 } // namespace cc |
| OLD | NEW |