| 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/playback/clip_path_display_item.h" | 5 #include "cc/playback/clip_path_display_item.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| 11 #include "base/trace_event/trace_event_argument.h" | 11 #include "base/trace_event/trace_event_argument.h" |
| 12 #include "third_party/skia/include/core/SkCanvas.h" | |
| 13 | 12 |
| 14 namespace cc { | 13 namespace cc { |
| 15 | 14 |
| 16 ClipPathDisplayItem::ClipPathDisplayItem(const SkPath& clip_path, | 15 ClipPathDisplayItem::ClipPathDisplayItem(const SkPath& clip_path, |
| 17 bool antialias) | 16 bool antialias) |
| 18 : DisplayItem(CLIP_PATH) { | 17 : DisplayItem(CLIP_PATH) { |
| 19 SetNew(clip_path, antialias); | 18 SetNew(clip_path, antialias); |
| 20 } | 19 } |
| 21 | 20 |
| 22 ClipPathDisplayItem::~ClipPathDisplayItem() { | 21 ClipPathDisplayItem::~ClipPathDisplayItem() { |
| 23 } | 22 } |
| 24 | 23 |
| 25 void ClipPathDisplayItem::SetNew(const SkPath& clip_path, | 24 void ClipPathDisplayItem::SetNew(const SkPath& clip_path, |
| 26 bool antialias) { | 25 bool antialias) { |
| 27 clip_path_ = clip_path; | 26 clip_path_ = clip_path; |
| 28 antialias_ = antialias; | 27 antialias_ = antialias; |
| 29 } | 28 } |
| 30 | 29 |
| 31 void ClipPathDisplayItem::Raster(SkCanvas* canvas, | 30 void ClipPathDisplayItem::Raster(PaintCanvas* canvas, |
| 32 SkPicture::AbortCallback* callback) const { | 31 PaintRecord::AbortCallback* callback) const { |
| 33 canvas->save(); | 32 canvas->save(); |
| 34 canvas->clipPath(clip_path_, antialias_); | 33 canvas->clipPath(clip_path_, antialias_); |
| 35 } | 34 } |
| 36 | 35 |
| 37 void ClipPathDisplayItem::AsValueInto( | 36 void ClipPathDisplayItem::AsValueInto( |
| 38 const gfx::Rect& visual_rect, | 37 const gfx::Rect& visual_rect, |
| 39 base::trace_event::TracedValue* array) const { | 38 base::trace_event::TracedValue* array) const { |
| 40 array->AppendString(base::StringPrintf( | 39 array->AppendString(base::StringPrintf( |
| 41 "ClipPathDisplayItem length: %d visualRect: [%s]", | 40 "ClipPathDisplayItem length: %d visualRect: [%s]", |
| 42 clip_path_.countPoints(), visual_rect.ToString().c_str())); | 41 clip_path_.countPoints(), visual_rect.ToString().c_str())); |
| 43 } | 42 } |
| 44 | 43 |
| 45 EndClipPathDisplayItem::EndClipPathDisplayItem() : DisplayItem(END_CLIP_PATH) {} | 44 EndClipPathDisplayItem::EndClipPathDisplayItem() : DisplayItem(END_CLIP_PATH) {} |
| 46 | 45 |
| 47 EndClipPathDisplayItem::~EndClipPathDisplayItem() { | 46 EndClipPathDisplayItem::~EndClipPathDisplayItem() { |
| 48 } | 47 } |
| 49 | 48 |
| 50 void EndClipPathDisplayItem::Raster( | 49 void EndClipPathDisplayItem::Raster( |
| 51 SkCanvas* canvas, | 50 PaintCanvas* canvas, |
| 52 SkPicture::AbortCallback* callback) const { | 51 PaintRecord::AbortCallback* callback) const { |
| 53 canvas->restore(); | 52 canvas->restore(); |
| 54 } | 53 } |
| 55 | 54 |
| 56 void EndClipPathDisplayItem::AsValueInto( | 55 void EndClipPathDisplayItem::AsValueInto( |
| 57 const gfx::Rect& visual_rect, | 56 const gfx::Rect& visual_rect, |
| 58 base::trace_event::TracedValue* array) const { | 57 base::trace_event::TracedValue* array) const { |
| 59 array->AppendString( | 58 array->AppendString( |
| 60 base::StringPrintf("EndClipPathDisplayItem visualRect: [%s]", | 59 base::StringPrintf("EndClipPathDisplayItem visualRect: [%s]", |
| 61 visual_rect.ToString().c_str())); | 60 visual_rect.ToString().c_str())); |
| 62 } | 61 } |
| 63 | 62 |
| 64 } // namespace cc | 63 } // namespace cc |
| OLD | NEW |