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 "skia/ext/refptr.h" | 10 #include "skia/ext/refptr.h" |
(...skipping 25 matching lines...) Expand all Loading... | |
36 | 36 |
37 void FilterDisplayItem::Raster(SkCanvas* canvas, | 37 void FilterDisplayItem::Raster(SkCanvas* canvas, |
38 const gfx::Rect& canvas_target_playback_rect, | 38 const gfx::Rect& canvas_target_playback_rect, |
39 SkPicture::AbortCallback* callback) const { | 39 SkPicture::AbortCallback* callback) const { |
40 canvas->save(); | 40 canvas->save(); |
41 canvas->translate(bounds_.x(), bounds_.y()); | 41 canvas->translate(bounds_.x(), bounds_.y()); |
42 | 42 |
43 skia::RefPtr<SkImageFilter> image_filter = | 43 skia::RefPtr<SkImageFilter> image_filter = |
44 RenderSurfaceFilters::BuildImageFilter( | 44 RenderSurfaceFilters::BuildImageFilter( |
45 filters_, gfx::SizeF(bounds_.width(), bounds_.height())); | 45 filters_, gfx::SizeF(bounds_.width(), bounds_.height())); |
46 #ifdef SK_SAVE_LAYER_BOUNDS_ARE_FILTERED | |
danakj
2015/08/27 18:34:02
leave a TODO pointing to the bug to remove this
Stephen White
2015/08/27 19:26:39
Done.
| |
46 SkRect boundaries; | 47 SkRect boundaries; |
47 image_filter->computeFastBounds( | 48 image_filter->computeFastBounds( |
48 SkRect::MakeWH(bounds_.width(), bounds_.height()), &boundaries); | 49 SkRect::MakeWH(bounds_.width(), bounds_.height()), &boundaries); |
50 #else | |
51 SkRect boundaries = SkRect::MakeWH(bounds_.width(), bounds_.height()); | |
52 #endif | |
49 | 53 |
50 SkPaint paint; | 54 SkPaint paint; |
51 paint.setXfermodeMode(SkXfermode::kSrcOver_Mode); | 55 paint.setXfermodeMode(SkXfermode::kSrcOver_Mode); |
52 paint.setImageFilter(image_filter.get()); | 56 paint.setImageFilter(image_filter.get()); |
53 canvas->saveLayer(&boundaries, &paint); | 57 canvas->saveLayer(&boundaries, &paint); |
54 | 58 |
55 canvas->translate(-bounds_.x(), -bounds_.y()); | 59 canvas->translate(-bounds_.x(), -bounds_.y()); |
56 } | 60 } |
57 | 61 |
58 void FilterDisplayItem::AsValueInto( | 62 void FilterDisplayItem::AsValueInto( |
(...skipping 16 matching lines...) Expand all Loading... | |
75 canvas->restore(); | 79 canvas->restore(); |
76 canvas->restore(); | 80 canvas->restore(); |
77 } | 81 } |
78 | 82 |
79 void EndFilterDisplayItem::AsValueInto( | 83 void EndFilterDisplayItem::AsValueInto( |
80 base::trace_event::TracedValue* array) const { | 84 base::trace_event::TracedValue* array) const { |
81 array->AppendString("EndFilterDisplayItem"); | 85 array->AppendString("EndFilterDisplayItem"); |
82 } | 86 } |
83 | 87 |
84 } // namespace cc | 88 } // namespace cc |
OLD | NEW |