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/layers/append_quads_data.h" | 5 #include "cc/layers/append_quads_data.h" |
6 #include "cc/layers/content_layer_client.h" | 6 #include "cc/layers/content_layer_client.h" |
7 #include "cc/layers/picture_layer.h" | 7 #include "cc/layers/picture_layer.h" |
8 #include "cc/layers/picture_layer_impl.h" | 8 #include "cc/layers/picture_layer_impl.h" |
9 #include "cc/quads/draw_quad.h" | 9 #include "cc/quads/draw_quad.h" |
10 #include "cc/test/layer_tree_pixel_test.h" | 10 #include "cc/test/layer_tree_pixel_test.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 void RunOnDemandRasterPixelTest(); | 54 void RunOnDemandRasterPixelTest(); |
55 }; | 55 }; |
56 | 56 |
57 class BlueYellowLayerClient : public ContentLayerClient { | 57 class BlueYellowLayerClient : public ContentLayerClient { |
58 public: | 58 public: |
59 explicit BlueYellowLayerClient(gfx::Rect layer_rect) | 59 explicit BlueYellowLayerClient(gfx::Rect layer_rect) |
60 : layer_rect_(layer_rect) {} | 60 : layer_rect_(layer_rect) {} |
61 | 61 |
62 bool FillsBoundsCompletely() const override { return false; } | 62 bool FillsBoundsCompletely() const override { return false; } |
63 | 63 |
64 void PaintContents( | 64 void PaintContents(SkCanvas* canvas, |
65 SkCanvas* canvas, | 65 const gfx::Rect& clip, |
66 const gfx::Rect& clip, | 66 PaintingControlSetting picture_control) override { |
67 ContentLayerClient::GraphicsContextStatus gc_status) override { | |
68 SkPaint paint; | 67 SkPaint paint; |
69 paint.setColor(SK_ColorBLUE); | 68 paint.setColor(SK_ColorBLUE); |
70 canvas->drawRect(SkRect::MakeWH(layer_rect_.width(), | 69 canvas->drawRect(SkRect::MakeWH(layer_rect_.width(), |
71 layer_rect_.height() / 2), | 70 layer_rect_.height() / 2), |
72 paint); | 71 paint); |
73 | 72 |
74 paint.setColor(SK_ColorYELLOW); | 73 paint.setColor(SK_ColorYELLOW); |
75 canvas->drawRect( | 74 canvas->drawRect( |
76 SkRect::MakeXYWH(0, | 75 SkRect::MakeXYWH(0, |
77 layer_rect_.height() / 2, | 76 layer_rect_.height() / 2, |
78 layer_rect_.width(), | 77 layer_rect_.width(), |
79 layer_rect_.height() / 2), | 78 layer_rect_.height() / 2), |
80 paint); | 79 paint); |
81 } | 80 } |
82 | 81 |
83 scoped_refptr<DisplayItemList> PaintContentsToDisplayList( | 82 scoped_refptr<DisplayItemList> PaintContentsToDisplayList( |
84 const gfx::Rect& clip, | 83 const gfx::Rect& clip, |
85 GraphicsContextStatus gc_status) override { | 84 PaintingControlSetting picture_control) override { |
86 NOTIMPLEMENTED(); | 85 NOTIMPLEMENTED(); |
87 return DisplayItemList::Create(); | 86 return DisplayItemList::Create(); |
88 } | 87 } |
89 | 88 |
90 private: | 89 private: |
91 gfx::Rect layer_rect_; | 90 gfx::Rect layer_rect_; |
92 }; | 91 }; |
93 | 92 |
94 void LayerTreeHostOnDemandRasterPixelTest::RunOnDemandRasterPixelTest() { | 93 void LayerTreeHostOnDemandRasterPixelTest::RunOnDemandRasterPixelTest() { |
95 // Use multiple colors in a single layer to prevent bypassing on-demand | 94 // Use multiple colors in a single layer to prevent bypassing on-demand |
(...skipping 12 matching lines...) Expand all Loading... |
108 } | 107 } |
109 | 108 |
110 TEST_F(LayerTreeHostOnDemandRasterPixelTest, RasterPictureLayer) { | 109 TEST_F(LayerTreeHostOnDemandRasterPixelTest, RasterPictureLayer) { |
111 RunOnDemandRasterPixelTest(); | 110 RunOnDemandRasterPixelTest(); |
112 } | 111 } |
113 | 112 |
114 } // namespace | 113 } // namespace |
115 } // namespace cc | 114 } // namespace cc |
116 | 115 |
117 #endif // OS_ANDROID | 116 #endif // OS_ANDROID |
OLD | NEW |