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/paint/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" | 11 #include "third_party/skia/include/core/SkCanvas.h" |
12 #include "ui/gfx/skia_util.h" | 12 #include "ui/gfx/skia_util.h" |
13 | 13 |
14 namespace cc { | 14 namespace cc { |
15 | 15 |
16 FloatClipDisplayItem::FloatClipDisplayItem(const gfx::RectF& clip_rect) | 16 FloatClipDisplayItem::FloatClipDisplayItem(const gfx::RectF& clip_rect) |
17 : DisplayItem(FLOAT_CLIP) { | 17 : DisplayItem(FLOAT_CLIP) { |
18 SetNew(clip_rect); | 18 SetNew(clip_rect); |
19 } | 19 } |
20 | 20 |
21 FloatClipDisplayItem::~FloatClipDisplayItem() { | 21 FloatClipDisplayItem::~FloatClipDisplayItem() {} |
22 } | |
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(SkCanvas* canvas, |
29 SkPicture::AbortCallback* callback) const { | 28 SkPicture::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 EndFloatClipDisplayItem::EndFloatClipDisplayItem() | 33 EndFloatClipDisplayItem::EndFloatClipDisplayItem() |
35 : DisplayItem(END_FLOAT_CLIP) {} | 34 : DisplayItem(END_FLOAT_CLIP) {} |
36 | 35 |
37 EndFloatClipDisplayItem::~EndFloatClipDisplayItem() { | 36 EndFloatClipDisplayItem::~EndFloatClipDisplayItem() {} |
38 } | |
39 | 37 |
40 void EndFloatClipDisplayItem::Raster( | 38 void EndFloatClipDisplayItem::Raster(SkCanvas* canvas, |
41 SkCanvas* canvas, | 39 SkPicture::AbortCallback* callback) const { |
42 SkPicture::AbortCallback* callback) const { | |
43 canvas->restore(); | 40 canvas->restore(); |
44 } | 41 } |
45 | 42 |
46 } // namespace cc | 43 } // namespace cc |
OLD | NEW |