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