| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 const proto::FilterDisplayItem& details = proto.filter_item(); | 51 const proto::FilterDisplayItem& details = proto.filter_item(); |
| 52 gfx::RectF bounds = ProtoToRectF(details.bounds()); | 52 gfx::RectF bounds = ProtoToRectF(details.bounds()); |
| 53 | 53 |
| 54 // TODO(dtrainor): Support deserializing FilterOperations (crbug.com/541321). | 54 // TODO(dtrainor): Support deserializing FilterOperations (crbug.com/541321). |
| 55 FilterOperations filters; | 55 FilterOperations filters; |
| 56 | 56 |
| 57 SetNew(filters, bounds); | 57 SetNew(filters, bounds); |
| 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 22 matching lines...) Expand all Loading... |
| 94 | 93 |
| 95 void EndFilterDisplayItem::ToProtobuf(proto::DisplayItem* proto) const { | 94 void EndFilterDisplayItem::ToProtobuf(proto::DisplayItem* proto) const { |
| 96 proto->set_type(proto::DisplayItem::Type_EndFilter); | 95 proto->set_type(proto::DisplayItem::Type_EndFilter); |
| 97 } | 96 } |
| 98 | 97 |
| 99 void EndFilterDisplayItem::FromProtobuf(const proto::DisplayItem& proto) { | 98 void EndFilterDisplayItem::FromProtobuf(const proto::DisplayItem& proto) { |
| 100 DCHECK_EQ(proto::DisplayItem::Type_EndFilter, proto.type()); | 99 DCHECK_EQ(proto::DisplayItem::Type_EndFilter, proto.type()); |
| 101 } | 100 } |
| 102 | 101 |
| 103 void EndFilterDisplayItem::Raster(SkCanvas* canvas, | 102 void EndFilterDisplayItem::Raster(SkCanvas* canvas, |
| 104 const gfx::Rect& canvas_target_playback_rect, | |
| 105 SkPicture::AbortCallback* callback) const { | 103 SkPicture::AbortCallback* callback) const { |
| 106 canvas->restore(); | 104 canvas->restore(); |
| 107 canvas->restore(); | 105 canvas->restore(); |
| 108 } | 106 } |
| 109 | 107 |
| 110 void EndFilterDisplayItem::AsValueInto( | 108 void EndFilterDisplayItem::AsValueInto( |
| 111 const gfx::Rect& visual_rect, | 109 const gfx::Rect& visual_rect, |
| 112 base::trace_event::TracedValue* array) const { | 110 base::trace_event::TracedValue* array) const { |
| 113 array->AppendString( | 111 array->AppendString( |
| 114 base::StringPrintf("EndFilterDisplayItem visualRect: [%s]", | 112 base::StringPrintf("EndFilterDisplayItem visualRect: [%s]", |
| 115 visual_rect.ToString().c_str())); | 113 visual_rect.ToString().c_str())); |
| 116 } | 114 } |
| 117 | 115 |
| 118 } // namespace cc | 116 } // namespace cc |
| OLD | NEW |