| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/clip_path_display_item.h" | 5 #include "cc/resources/clip_path_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 "third_party/skia/include/core/SkCanvas.h" | 9 #include "third_party/skia/include/core/SkCanvas.h" |
| 10 | 10 |
| 11 namespace cc { | 11 namespace cc { |
| 12 | 12 |
| 13 ClipPathDisplayItem::ClipPathDisplayItem(const SkPath& clip_path, | 13 ClipPathDisplayItem::ClipPathDisplayItem() { |
| 14 SkRegion::Op clip_op, | |
| 15 bool antialias) | |
| 16 : clip_path_(clip_path), clip_op_(clip_op), antialias_(antialias) { | |
| 17 } | 14 } |
| 18 | 15 |
| 19 ClipPathDisplayItem::~ClipPathDisplayItem() { | 16 ClipPathDisplayItem::~ClipPathDisplayItem() { |
| 20 } | 17 } |
| 21 | 18 |
| 19 void ClipPathDisplayItem::SetNew(const SkPath& clip_path, |
| 20 SkRegion::Op clip_op, |
| 21 bool antialias) { |
| 22 clip_path_ = clip_path; |
| 23 clip_op_ = clip_op; |
| 24 antialias_ = antialias; |
| 25 } |
| 26 |
| 22 void ClipPathDisplayItem::Raster(SkCanvas* canvas, | 27 void ClipPathDisplayItem::Raster(SkCanvas* canvas, |
| 23 SkDrawPictureCallback* callback) const { | 28 SkDrawPictureCallback* callback) const { |
| 24 canvas->save(); | 29 canvas->save(); |
| 25 canvas->clipPath(clip_path_, clip_op_, antialias_); | 30 canvas->clipPath(clip_path_, clip_op_, antialias_); |
| 26 } | 31 } |
| 27 | 32 |
| 28 bool ClipPathDisplayItem::IsSuitableForGpuRasterization() const { | 33 bool ClipPathDisplayItem::IsSuitableForGpuRasterization() const { |
| 29 return true; | 34 return true; |
| 30 } | 35 } |
| 31 | 36 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 size_t EndClipPathDisplayItem::PictureMemoryUsage() const { | 71 size_t EndClipPathDisplayItem::PictureMemoryUsage() const { |
| 67 return 0; | 72 return 0; |
| 68 } | 73 } |
| 69 | 74 |
| 70 void EndClipPathDisplayItem::AsValueInto( | 75 void EndClipPathDisplayItem::AsValueInto( |
| 71 base::trace_event::TracedValue* array) const { | 76 base::trace_event::TracedValue* array) const { |
| 72 array->AppendString("EndClipPathDisplayItem"); | 77 array->AppendString("EndClipPathDisplayItem"); |
| 73 } | 78 } |
| 74 | 79 |
| 75 } // namespace cc | 80 } // namespace cc |
| OLD | NEW |