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