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/resources/filter_display_item.h" | 5 #include "cc/resources/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 "skia/ext/refptr.h" | 10 #include "skia/ext/refptr.h" |
11 #include "third_party/skia/include/core/SkCanvas.h" | 11 #include "third_party/skia/include/core/SkCanvas.h" |
12 #include "third_party/skia/include/core/SkImageFilter.h" | 12 #include "third_party/skia/include/core/SkImageFilter.h" |
13 #include "third_party/skia/include/core/SkPaint.h" | 13 #include "third_party/skia/include/core/SkPaint.h" |
14 #include "third_party/skia/include/core/SkXfermode.h" | 14 #include "third_party/skia/include/core/SkXfermode.h" |
15 #include "ui/gfx/skia_util.h" | 15 #include "ui/gfx/skia_util.h" |
16 | 16 |
17 namespace cc { | 17 namespace cc { |
18 | 18 |
19 FilterDisplayItem::FilterDisplayItem(const FilterOperations& filters, | 19 FilterDisplayItem::FilterDisplayItem() { |
20 gfx::RectF bounds) | |
21 : filters_(filters), bounds_(bounds) { | |
22 } | 20 } |
23 | 21 |
24 FilterDisplayItem::~FilterDisplayItem() { | 22 FilterDisplayItem::~FilterDisplayItem() { |
25 } | 23 } |
26 | 24 |
| 25 void FilterDisplayItem::SetNew(const FilterOperations& filters, |
| 26 const gfx::RectF& bounds) { |
| 27 filters_ = filters; |
| 28 bounds_ = bounds; |
| 29 } |
| 30 |
27 void FilterDisplayItem::Raster(SkCanvas* canvas, | 31 void FilterDisplayItem::Raster(SkCanvas* canvas, |
28 SkDrawPictureCallback* callback) const { | 32 SkDrawPictureCallback* callback) const { |
29 canvas->save(); | 33 canvas->save(); |
30 canvas->translate(bounds_.x(), bounds_.y()); | 34 canvas->translate(bounds_.x(), bounds_.y()); |
31 | 35 |
32 skia::RefPtr<SkImageFilter> image_filter = | 36 skia::RefPtr<SkImageFilter> image_filter = |
33 RenderSurfaceFilters::BuildImageFilter( | 37 RenderSurfaceFilters::BuildImageFilter( |
34 filters_, gfx::SizeF(bounds_.width(), bounds_.height())); | 38 filters_, gfx::SizeF(bounds_.width(), bounds_.height())); |
35 SkRect boundaries; | 39 SkRect boundaries; |
36 image_filter->computeFastBounds( | 40 image_filter->computeFastBounds( |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 size_t EndFilterDisplayItem::PictureMemoryUsage() const { | 89 size_t EndFilterDisplayItem::PictureMemoryUsage() const { |
86 return 0; | 90 return 0; |
87 } | 91 } |
88 | 92 |
89 void EndFilterDisplayItem::AsValueInto( | 93 void EndFilterDisplayItem::AsValueInto( |
90 base::trace_event::TracedValue* array) const { | 94 base::trace_event::TracedValue* array) const { |
91 array->AppendString("EndFilterDisplayItem"); | 95 array->AppendString("EndFilterDisplayItem"); |
92 } | 96 } |
93 | 97 |
94 } // namespace cc | 98 } // namespace cc |
OLD | NEW |