OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/test/solid_color_content_layer_client.h" | 5 #include "cc/test/solid_color_content_layer_client.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "cc/playback/display_item_list_settings.h" | 9 #include "cc/playback/display_item_list_settings.h" |
10 #include "cc/playback/drawing_display_item.h" | 10 #include "cc/playback/drawing_display_item.h" |
11 #include "third_party/skia/include/core/SkCanvas.h" | 11 #include "third_party/skia/include/core/SkCanvas.h" |
12 #include "third_party/skia/include/core/SkPaint.h" | 12 #include "third_party/skia/include/core/SkPaint.h" |
13 #include "third_party/skia/include/core/SkPictureRecorder.h" | 13 #include "third_party/skia/include/core/SkPictureRecorder.h" |
14 #include "ui/gfx/geometry/rect.h" | 14 #include "ui/gfx/geometry/rect.h" |
15 #include "ui/gfx/geometry/rect_f.h" | 15 #include "ui/gfx/geometry/rect_f.h" |
16 #include "ui/gfx/skia_util.h" | 16 #include "ui/gfx/skia_util.h" |
17 | 17 |
18 namespace cc { | 18 namespace cc { |
19 | 19 |
20 gfx::Rect SolidColorContentLayerClient::PaintableRegion() { | 20 gfx::Rect SolidColorContentLayerClient::PaintableRegion() { |
21 return gfx::Rect(size_); | 21 return gfx::Rect(size_); |
22 } | 22 } |
23 | 23 |
24 scoped_refptr<DisplayItemList> | 24 scoped_refptr<DisplayItemList> |
25 SolidColorContentLayerClient::PaintContentsToDisplayList( | 25 SolidColorContentLayerClient::PaintContentsToDisplayList( |
26 PaintingControlSetting painting_control) { | 26 PaintingControlSetting painting_control) { |
27 SkPictureRecorder recorder; | 27 SkPictureRecorder recorder; |
28 gfx::Rect clip(PaintableRegion()); | 28 gfx::Rect clip(PaintableRegion()); |
29 sk_sp<SkCanvas> canvas = | 29 SkCanvas* canvas = recorder.beginRecording(gfx::RectToSkRect(clip)); |
30 sk_ref_sp(recorder.beginRecording(gfx::RectToSkRect(clip))); | |
31 | 30 |
32 canvas->clear(SK_ColorTRANSPARENT); | 31 canvas->clear(SK_ColorTRANSPARENT); |
33 | 32 |
34 if (border_size_ != 0) { | 33 if (border_size_ != 0) { |
35 SkPaint paint; | 34 SkPaint paint; |
36 paint.setStyle(SkPaint::kFill_Style); | 35 paint.setStyle(SkPaint::kFill_Style); |
37 paint.setColor(border_color_); | 36 paint.setColor(border_color_); |
38 canvas->drawRect( | 37 canvas->drawRect( |
39 SkRect::MakeXYWH(clip.x(), clip.y(), clip.width(), clip.height()), | 38 SkRect::MakeXYWH(clip.x(), clip.y(), clip.width(), clip.height()), |
40 paint); | 39 paint); |
(...skipping 22 matching lines...) Expand all Loading... |
63 | 62 |
64 bool SolidColorContentLayerClient::FillsBoundsCompletely() const { | 63 bool SolidColorContentLayerClient::FillsBoundsCompletely() const { |
65 return false; | 64 return false; |
66 } | 65 } |
67 | 66 |
68 size_t SolidColorContentLayerClient::GetApproximateUnsharedMemoryUsage() const { | 67 size_t SolidColorContentLayerClient::GetApproximateUnsharedMemoryUsage() const { |
69 return 0; | 68 return 0; |
70 } | 69 } |
71 | 70 |
72 } // namespace cc | 71 } // namespace cc |
OLD | NEW |