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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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, | 61 const gfx::Rect& canvas_target_playback_rect, |
62 SkPicture::AbortCallback* callback) const { | 62 SkPicture::AbortCallback* callback) const { |
63 canvas->save(); | 63 canvas->save(); |
64 canvas->translate(bounds_.x(), bounds_.y()); | 64 canvas->translate(bounds_.x(), bounds_.y()); |
65 | 65 |
66 skia::RefPtr<SkImageFilter> image_filter = | 66 sk_sp<SkImageFilter> image_filter = RenderSurfaceFilters::BuildImageFilter( |
67 RenderSurfaceFilters::BuildImageFilter( | 67 filters_, gfx::SizeF(bounds_.width(), bounds_.height())); |
68 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; |
72 paint.setXfermodeMode(SkXfermode::kSrcOver_Mode); | 71 paint.setXfermodeMode(SkXfermode::kSrcOver_Mode); |
73 paint.setImageFilter(image_filter.get()); | 72 paint.setImageFilter(std::move(image_filter)); |
74 canvas->saveLayer(&boundaries, &paint); | 73 canvas->saveLayer(&boundaries, &paint); |
75 | 74 |
76 canvas->translate(-bounds_.x(), -bounds_.y()); | 75 canvas->translate(-bounds_.x(), -bounds_.y()); |
77 } | 76 } |
78 | 77 |
79 void FilterDisplayItem::AsValueInto( | 78 void FilterDisplayItem::AsValueInto( |
80 const gfx::Rect& visual_rect, | 79 const gfx::Rect& visual_rect, |
81 base::trace_event::TracedValue* array) const { | 80 base::trace_event::TracedValue* array) const { |
82 array->AppendString(base::StringPrintf( | 81 array->AppendString(base::StringPrintf( |
83 "FilterDisplayItem bounds: [%s] visualRect: [%s]", | 82 "FilterDisplayItem bounds: [%s] visualRect: [%s]", |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 array->AppendString( | 116 array->AppendString( |
118 base::StringPrintf("EndFilterDisplayItem visualRect: [%s]", | 117 base::StringPrintf("EndFilterDisplayItem visualRect: [%s]", |
119 visual_rect.ToString().c_str())); | 118 visual_rect.ToString().c_str())); |
120 } | 119 } |
121 | 120 |
122 size_t EndFilterDisplayItem::ExternalMemoryUsage() const { | 121 size_t EndFilterDisplayItem::ExternalMemoryUsage() const { |
123 return 0; | 122 return 0; |
124 } | 123 } |
125 | 124 |
126 } // namespace cc | 125 } // namespace cc |
OLD | NEW |