| 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> | |
| 8 | |
| 9 #include "base/strings/stringprintf.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" | |
| 13 | |
| 14 namespace cc { | 7 namespace cc { |
| 15 | 8 |
| 16 FloatClipDisplayItem::FloatClipDisplayItem(const gfx::RectF& clip_rect) | 9 FloatClipDisplayItem::FloatClipDisplayItem(const gfx::RectF& clip_rect) |
| 17 : DisplayItem(FLOAT_CLIP) { | 10 : DisplayItem(FLOAT_CLIP), clip_rect(clip_rect) {} |
| 18 SetNew(clip_rect); | |
| 19 } | |
| 20 | 11 |
| 21 FloatClipDisplayItem::~FloatClipDisplayItem() { | 12 FloatClipDisplayItem::~FloatClipDisplayItem() = default; |
| 22 } | |
| 23 | |
| 24 void FloatClipDisplayItem::SetNew(const gfx::RectF& clip_rect) { | |
| 25 clip_rect_ = clip_rect; | |
| 26 } | |
| 27 | |
| 28 void FloatClipDisplayItem::Raster(SkCanvas* canvas, | |
| 29 SkPicture::AbortCallback* callback) const { | |
| 30 canvas->save(); | |
| 31 canvas->clipRect(gfx::RectFToSkRect(clip_rect_)); | |
| 32 } | |
| 33 | 13 |
| 34 EndFloatClipDisplayItem::EndFloatClipDisplayItem() | 14 EndFloatClipDisplayItem::EndFloatClipDisplayItem() |
| 35 : DisplayItem(END_FLOAT_CLIP) {} | 15 : DisplayItem(END_FLOAT_CLIP) {} |
| 36 | 16 |
| 37 EndFloatClipDisplayItem::~EndFloatClipDisplayItem() { | 17 EndFloatClipDisplayItem::~EndFloatClipDisplayItem() = default; |
| 38 } | |
| 39 | |
| 40 void EndFloatClipDisplayItem::Raster( | |
| 41 SkCanvas* canvas, | |
| 42 SkPicture::AbortCallback* callback) const { | |
| 43 canvas->restore(); | |
| 44 } | |
| 45 | 18 |
| 46 } // namespace cc | 19 } // namespace cc |
| OLD | NEW |