| 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 |
| 47 // TODO(senorblanco): remove this once callsites updated (crbug.com/525748) |
| 46 SkRect boundaries; | 48 SkRect boundaries; |
| 47 image_filter->computeFastBounds( | 49 image_filter->computeFastBounds( |
| 48 SkRect::MakeWH(bounds_.width(), bounds_.height()), &boundaries); | 50 SkRect::MakeWH(bounds_.width(), bounds_.height()), &boundaries); |
| 51 #else |
| 52 SkRect boundaries = SkRect::MakeWH(bounds_.width(), bounds_.height()); |
| 53 #endif |
| 49 | 54 |
| 50 SkPaint paint; | 55 SkPaint paint; |
| 51 paint.setXfermodeMode(SkXfermode::kSrcOver_Mode); | 56 paint.setXfermodeMode(SkXfermode::kSrcOver_Mode); |
| 52 paint.setImageFilter(image_filter.get()); | 57 paint.setImageFilter(image_filter.get()); |
| 53 canvas->saveLayer(&boundaries, &paint); | 58 canvas->saveLayer(&boundaries, &paint); |
| 54 | 59 |
| 55 canvas->translate(-bounds_.x(), -bounds_.y()); | 60 canvas->translate(-bounds_.x(), -bounds_.y()); |
| 56 } | 61 } |
| 57 | 62 |
| 58 void FilterDisplayItem::AsValueInto( | 63 void FilterDisplayItem::AsValueInto( |
| (...skipping 16 matching lines...) Expand all Loading... |
| 75 canvas->restore(); | 80 canvas->restore(); |
| 76 canvas->restore(); | 81 canvas->restore(); |
| 77 } | 82 } |
| 78 | 83 |
| 79 void EndFilterDisplayItem::AsValueInto( | 84 void EndFilterDisplayItem::AsValueInto( |
| 80 base::trace_event::TracedValue* array) const { | 85 base::trace_event::TracedValue* array) const { |
| 81 array->AppendString("EndFilterDisplayItem"); | 86 array->AppendString("EndFilterDisplayItem"); |
| 82 } | 87 } |
| 83 | 88 |
| 84 } // namespace cc | 89 } // namespace cc |
| OLD | NEW |