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/paint/display_item_list.h" | 10 #include "cc/paint/display_item_list.h" |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 LayerTreeHostTilesTestPartialInvalidation() | 150 LayerTreeHostTilesTestPartialInvalidation() |
151 : client_(gfx::Size(200, 200)), | 151 : client_(gfx::Size(200, 200)), |
152 picture_layer_(PictureLayer::Create(&client_)) { | 152 picture_layer_(PictureLayer::Create(&client_)) { |
153 picture_layer_->SetBounds(gfx::Size(200, 200)); | 153 picture_layer_->SetBounds(gfx::Size(200, 200)); |
154 picture_layer_->SetIsDrawable(true); | 154 picture_layer_->SetIsDrawable(true); |
155 } | 155 } |
156 | 156 |
157 void DidCommitAndDrawFrame() override { | 157 void DidCommitAndDrawFrame() override { |
158 switch (layer_tree_host()->SourceFrameNumber()) { | 158 switch (layer_tree_host()->SourceFrameNumber()) { |
159 case 1: | 159 case 1: |
160 // We have done one frame, so the layer's content has been rastered. | 160 // We have done one frame, but the resource may not be available for |
161 // Now we change the picture behind it to record something completely | 161 // partial raster yet. Force a second frame. |
162 // different, but we give a smaller invalidation rect. The layer should | 162 picture_layer_->SetNeedsDisplayRect(gfx::Rect(50, 50, 100, 100)); |
163 // only re-raster the stuff in the rect. If it doesn't do partial raster | 163 break; |
164 // it would re-raster the whole thing instead. | 164 case 2: |
| 165 // We have done two frames, so the layer's content has been rastered |
| 166 // twice and the first frame's resource is available for partial |
| 167 // raster. Now we change the picture behind it to record something |
| 168 // completely different, but we give a smaller invalidation rect. The |
| 169 // layer should only re-raster the stuff in the rect. If it doesn't do |
| 170 // partial raster it would re-raster the whole thing instead. |
165 client_.set_blue_top(false); | 171 client_.set_blue_top(false); |
166 Finish(); | 172 Finish(); |
167 picture_layer_->SetNeedsDisplayRect(gfx::Rect(50, 50, 100, 100)); | 173 picture_layer_->SetNeedsDisplayRect(gfx::Rect(50, 50, 100, 100)); |
168 | 174 |
169 // Add a copy request to see what happened! | 175 // Add a copy request to see what happened! |
170 DoReadback(); | 176 DoReadback(); |
171 break; | 177 break; |
172 } | 178 } |
173 } | 179 } |
174 | 180 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 FullRaster_SingleThread_GpuRaster) { | 263 FullRaster_SingleThread_GpuRaster) { |
258 RunRasterPixelTest( | 264 RunRasterPixelTest( |
259 false, FULL_GPU, picture_layer_, | 265 false, FULL_GPU, picture_layer_, |
260 base::FilePath(FILE_PATH_LITERAL("blue_yellow_flipped.png"))); | 266 base::FilePath(FILE_PATH_LITERAL("blue_yellow_flipped.png"))); |
261 } | 267 } |
262 | 268 |
263 } // namespace | 269 } // namespace |
264 } // namespace cc | 270 } // namespace cc |
265 | 271 |
266 #endif // !defined(OS_ANDROID) | 272 #endif // !defined(OS_ANDROID) |
OLD | NEW |