| 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 16 matching lines...) Expand all Loading... |
| 27 filters_ = filters; | 27 filters_ = filters; |
| 28 bounds_ = bounds; | 28 bounds_ = bounds; |
| 29 | 29 |
| 30 size_t memory_usage = | 30 size_t memory_usage = |
| 31 sizeof(skia::RefPtr<SkImageFilter>) + sizeof(gfx::RectF); | 31 sizeof(skia::RefPtr<SkImageFilter>) + sizeof(gfx::RectF); |
| 32 DisplayItem::SetNew(true /* suitable_for_gpu_raster */, 1 /* op_count */, | 32 DisplayItem::SetNew(true /* suitable_for_gpu_raster */, 1 /* op_count */, |
| 33 memory_usage); | 33 memory_usage); |
| 34 } | 34 } |
| 35 | 35 |
| 36 void FilterDisplayItem::Raster(SkCanvas* canvas, | 36 void FilterDisplayItem::Raster(SkCanvas* canvas, |
| 37 const gfx::Rect& canvas_target_playback_rect, |
| 37 SkPicture::AbortCallback* callback) const { | 38 SkPicture::AbortCallback* callback) const { |
| 38 canvas->save(); | 39 canvas->save(); |
| 39 canvas->translate(bounds_.x(), bounds_.y()); | 40 canvas->translate(bounds_.x(), bounds_.y()); |
| 40 | 41 |
| 41 skia::RefPtr<SkImageFilter> image_filter = | 42 skia::RefPtr<SkImageFilter> image_filter = |
| 42 RenderSurfaceFilters::BuildImageFilter( | 43 RenderSurfaceFilters::BuildImageFilter( |
| 43 filters_, gfx::SizeF(bounds_.width(), bounds_.height())); | 44 filters_, gfx::SizeF(bounds_.width(), bounds_.height())); |
| 44 SkRect boundaries; | 45 SkRect boundaries; |
| 45 image_filter->computeFastBounds( | 46 image_filter->computeFastBounds( |
| 46 SkRect::MakeWH(bounds_.width(), bounds_.height()), &boundaries); | 47 SkRect::MakeWH(bounds_.width(), bounds_.height()), &boundaries); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 61 | 62 |
| 62 EndFilterDisplayItem::EndFilterDisplayItem() { | 63 EndFilterDisplayItem::EndFilterDisplayItem() { |
| 63 DisplayItem::SetNew(true /* suitable_for_gpu_raster */, 0 /* op_count */, | 64 DisplayItem::SetNew(true /* suitable_for_gpu_raster */, 0 /* op_count */, |
| 64 0 /* memory_usage */); | 65 0 /* memory_usage */); |
| 65 } | 66 } |
| 66 | 67 |
| 67 EndFilterDisplayItem::~EndFilterDisplayItem() { | 68 EndFilterDisplayItem::~EndFilterDisplayItem() { |
| 68 } | 69 } |
| 69 | 70 |
| 70 void EndFilterDisplayItem::Raster(SkCanvas* canvas, | 71 void EndFilterDisplayItem::Raster(SkCanvas* canvas, |
| 72 const gfx::Rect& canvas_target_playback_rect, |
| 71 SkPicture::AbortCallback* callback) const { | 73 SkPicture::AbortCallback* callback) const { |
| 72 canvas->restore(); | 74 canvas->restore(); |
| 73 canvas->restore(); | 75 canvas->restore(); |
| 74 } | 76 } |
| 75 | 77 |
| 76 void EndFilterDisplayItem::AsValueInto( | 78 void EndFilterDisplayItem::AsValueInto( |
| 77 base::trace_event::TracedValue* array) const { | 79 base::trace_event::TracedValue* array) const { |
| 78 array->AppendString("EndFilterDisplayItem"); | 80 array->AppendString("EndFilterDisplayItem"); |
| 79 } | 81 } |
| 80 | 82 |
| 81 } // namespace cc | 83 } // namespace cc |
| OLD | NEW |