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 <stddef.h> | 5 #include <stddef.h> |
6 | 6 |
7 #include "cc/layers/content_layer_client.h" | 7 #include "cc/layers/content_layer_client.h" |
8 #include "cc/layers/picture_layer.h" | 8 #include "cc/layers/picture_layer.h" |
9 #include "cc/output/copy_output_request.h" | 9 #include "cc/output/copy_output_request.h" |
10 #include "cc/playback/display_item_list.h" | 10 #include "cc/playback/display_item_list.h" |
11 #include "cc/playback/display_item_list_settings.h" | 11 #include "cc/playback/display_item_list_settings.h" |
12 #include "cc/playback/drawing_display_item.h" | 12 #include "cc/playback/drawing_display_item.h" |
13 #include "cc/test/layer_tree_pixel_test.h" | 13 #include "cc/test/layer_tree_pixel_test.h" |
14 #include "cc/test/test_compositor_frame_sink.h" | |
14 #include "third_party/skia/include/core/SkCanvas.h" | 15 #include "third_party/skia/include/core/SkCanvas.h" |
15 #include "third_party/skia/include/core/SkPictureRecorder.h" | 16 #include "third_party/skia/include/core/SkPictureRecorder.h" |
16 | 17 |
17 #if !defined(OS_ANDROID) | 18 #if !defined(OS_ANDROID) |
18 | 19 |
19 namespace cc { | 20 namespace cc { |
20 namespace { | 21 namespace { |
21 | 22 |
22 enum RasterMode { | 23 enum RasterMode { |
23 PARTIAL_ONE_COPY, | 24 PARTIAL_ONE_COPY, |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
153 LayerTreeHostTilesTestPartialInvalidation() | 154 LayerTreeHostTilesTestPartialInvalidation() |
154 : client_(gfx::Size(200, 200)), | 155 : client_(gfx::Size(200, 200)), |
155 picture_layer_(PictureLayer::Create(&client_)) { | 156 picture_layer_(PictureLayer::Create(&client_)) { |
156 picture_layer_->SetBounds(gfx::Size(200, 200)); | 157 picture_layer_->SetBounds(gfx::Size(200, 200)); |
157 picture_layer_->SetIsDrawable(true); | 158 picture_layer_->SetIsDrawable(true); |
158 } | 159 } |
159 | 160 |
160 void DidCommitAndDrawFrame() override { | 161 void DidCommitAndDrawFrame() override { |
161 switch (layer_tree_host()->SourceFrameNumber()) { | 162 switch (layer_tree_host()->SourceFrameNumber()) { |
162 case 1: | 163 case 1: |
163 // We have done one frame, so the layer's content has been rastered. | 164 // We have done one frame, but the resource may not be available for |
164 // Now we change the picture behind it to record something completely | 165 // partial raster yet. Force a seocnd frame. |
165 // different, but we give a smaller invalidation rect. The layer should | 166 picture_layer_->SetNeedsDisplayRect(gfx::Rect(50, 50, 100, 100)); |
ericrk
2017/01/04 18:10:48
Updated the partial raster test - we now give it t
| |
166 // only re-raster the stuff in the rect. If it doesn't do partial raster | 167 break; |
167 // it would re-raster the whole thing instead. | 168 |
169 case 2: | |
170 // We have done two frames, so the layer's content has been rastered | |
171 // twice and the first frame's resource is available for partial | |
172 // raster. Now we change the picture behind it to record something | |
173 // completely different, but we give a smaller invalidation rect. The | |
174 // layer should only re-raster the stuff in the rect. If it doesn't do | |
175 // partial raster it would re-raster the whole thing instead. | |
168 client_.set_blue_top(false); | 176 client_.set_blue_top(false); |
169 Finish(); | 177 Finish(); |
170 picture_layer_->SetNeedsDisplayRect(gfx::Rect(50, 50, 100, 100)); | 178 picture_layer_->SetNeedsDisplayRect(gfx::Rect(50, 50, 100, 100)); |
171 | 179 |
172 // Add a copy request to see what happened! | 180 // Add a copy request to see what happened! |
173 DoReadback(); | 181 DoReadback(); |
174 break; | 182 break; |
175 } | 183 } |
176 } | 184 } |
177 | 185 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
233 FullRaster_SingleThread_GpuRaster) { | 241 FullRaster_SingleThread_GpuRaster) { |
234 RunRasterPixelTest( | 242 RunRasterPixelTest( |
235 false, FULL_GPU, picture_layer_, | 243 false, FULL_GPU, picture_layer_, |
236 base::FilePath(FILE_PATH_LITERAL("blue_yellow_flipped.png"))); | 244 base::FilePath(FILE_PATH_LITERAL("blue_yellow_flipped.png"))); |
237 } | 245 } |
238 | 246 |
239 } // namespace | 247 } // namespace |
240 } // namespace cc | 248 } // namespace cc |
241 | 249 |
242 #endif // !defined(OS_ANDROID) | 250 #endif // !defined(OS_ANDROID) |
OLD | NEW |