OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "cc/resources/float_clip_display_item.h" | |
6 | |
7 #include "base/strings/stringprintf.h" | |
8 #include "base/trace_event/trace_event_argument.h" | |
9 #include "third_party/skia/include/core/SkCanvas.h" | |
10 #include "ui/gfx/skia_util.h" | |
11 | |
12 namespace cc { | |
13 | |
14 FloatClipDisplayItem::FloatClipDisplayItem(gfx::RectF clip_rect) | |
15 : clip_rect_(clip_rect) { | |
16 } | |
17 | |
18 FloatClipDisplayItem::~FloatClipDisplayItem() { | |
19 } | |
20 | |
21 void FloatClipDisplayItem::Raster(SkCanvas* canvas, | |
22 SkDrawPictureCallback* callback) const { | |
23 canvas->save(); | |
24 canvas->clipRect(gfx::RectFToSkRect(clip_rect_)); | |
25 } | |
26 | |
27 bool FloatClipDisplayItem::IsSuitableForGpuRasterization() const { | |
28 return true; | |
29 } | |
30 | |
31 int FloatClipDisplayItem::ApproximateOpCount() const { | |
32 return 1; | |
33 } | |
34 | |
35 size_t FloatClipDisplayItem::PictureMemoryUsage() const { | |
36 return sizeof(gfx::RectF); | |
37 } | |
38 | |
39 void FloatClipDisplayItem::AsValueInto( | |
40 base::trace_event::TracedValue* array) const { | |
41 array->AppendString(base::StringPrintf("FloatClipDisplayItem rect: [%s]", | |
42 clip_rect_.ToString().c_str())); | |
43 } | |
44 | |
45 EndFloatClipDisplayItem::EndFloatClipDisplayItem() { | |
46 } | |
47 | |
48 EndFloatClipDisplayItem::~EndFloatClipDisplayItem() { | |
49 } | |
50 | |
51 void EndFloatClipDisplayItem::Raster(SkCanvas* canvas, | |
52 SkDrawPictureCallback* callback) const { | |
53 canvas->restore(); | |
54 } | |
55 | |
56 bool EndFloatClipDisplayItem::IsSuitableForGpuRasterization() const { | |
57 return true; | |
58 } | |
59 | |
60 int EndFloatClipDisplayItem::ApproximateOpCount() const { | |
61 return 0; | |
62 } | |
63 | |
64 size_t EndFloatClipDisplayItem::PictureMemoryUsage() const { | |
65 return 0; | |
66 } | |
67 | |
68 void EndFloatClipDisplayItem::AsValueInto( | |
69 base::trace_event::TracedValue* array) const { | |
70 array->AppendString("EndFloatClipDisplayItem"); | |
71 } | |
72 | |
73 } // namespace cc | |
OLD | NEW |