Chromium Code Reviews| 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 "build/build_config.h" | 5 #include "build/build_config.h" |
| 6 #include "cc/layers/content_layer.h" | 6 #include "cc/layers/content_layer.h" |
| 7 #include "cc/layers/solid_color_layer.h" | 7 #include "cc/layers/solid_color_layer.h" |
| 8 #include "cc/layers/texture_layer.h" | 8 #include "cc/layers/texture_layer.h" |
| 9 #include "cc/output/copy_output_request.h" | 9 #include "cc/output/copy_output_request.h" |
| 10 #include "cc/output/copy_output_result.h" | 10 #include "cc/output/copy_output_result.h" |
| (...skipping 1091 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1102 EXPECT_EQ(device_scale_factor_, layer_tree_host()->device_scale_factor()); | 1102 EXPECT_EQ(device_scale_factor_, layer_tree_host()->device_scale_factor()); |
| 1103 if (TestEnded()) | 1103 if (TestEnded()) |
| 1104 return; | 1104 return; |
| 1105 | 1105 |
| 1106 gfx::Rect device_viewport_copy_rect( | 1106 gfx::Rect device_viewport_copy_rect( |
| 1107 layer_tree_host()->device_viewport_size()); | 1107 layer_tree_host()->device_viewport_size()); |
| 1108 if (!device_viewport_copy_subrect_.IsEmpty()) | 1108 if (!device_viewport_copy_subrect_.IsEmpty()) |
| 1109 device_viewport_copy_rect.Intersect(device_viewport_copy_subrect_); | 1109 device_viewport_copy_rect.Intersect(device_viewport_copy_subrect_); |
| 1110 | 1110 |
| 1111 scoped_ptr<SkBitmap> bitmap(new SkBitmap); | 1111 scoped_ptr<SkBitmap> bitmap(new SkBitmap); |
| 1112 bitmap->setConfig(SkBitmap::kARGB_8888_Config, | 1112 bitmap->allocN32Pixels(device_viewport_copy_rect.width(), |
| 1113 device_viewport_copy_rect.width(), | 1113 device_viewport_copy_rect.height()); |
| 1114 device_viewport_copy_rect.height()); | 1114 layer_tree_host()->CompositeAndReadback(bitmap->getPixels(), |
| 1115 bitmap->allocPixels(); | 1115 device_viewport_copy_rect); |
| 1116 { | |
| 1117 scoped_ptr<SkAutoLockPixels> lock(new SkAutoLockPixels(*bitmap)); | |
|
danakj
2014/03/25 16:13:59
So what will unlock the bitmap's pixels, or why do
reed1
2014/03/25 17:19:41
allocPixels() guarantees to lock the pixels automa
danakj
2014/03/25 17:31:29
Ya, I wasn't aware of that before, but doing a sco
reed1
2014/03/25 17:35:53
For non-lazy bitmaps (as when they are the target
| |
| 1118 layer_tree_host()->CompositeAndReadback(bitmap->getPixels(), | |
| 1119 device_viewport_copy_rect); | |
| 1120 } | |
| 1121 | 1116 |
| 1122 result_bitmap_ = bitmap.Pass(); | 1117 result_bitmap_ = bitmap.Pass(); |
| 1123 EndTest(); | 1118 EndTest(); |
| 1124 } | 1119 } |
| 1125 | 1120 |
| 1126 virtual void DrawLayersOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { | 1121 virtual void DrawLayersOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { |
| 1127 LayerImpl* root_impl = host_impl->active_tree()->root_layer(); | 1122 LayerImpl* root_impl = host_impl->active_tree()->root_layer(); |
| 1128 | 1123 |
| 1129 LayerImpl* background_impl = root_impl->children()[0]; | 1124 LayerImpl* background_impl = root_impl->children()[0]; |
| 1130 EXPECT_EQ(device_scale_factor_, background_impl->contents_scale_x()); | 1125 EXPECT_EQ(device_scale_factor_, background_impl->contents_scale_x()); |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1293 background, | 1288 background, |
| 1294 green.get(), | 1289 green.get(), |
| 1295 base::FilePath(FILE_PATH_LITERAL( | 1290 base::FilePath(FILE_PATH_LITERAL( |
| 1296 "green_with_blue_corner.png"))); | 1291 "green_with_blue_corner.png"))); |
| 1297 } | 1292 } |
| 1298 | 1293 |
| 1299 } // namespace | 1294 } // namespace |
| 1300 } // namespace cc | 1295 } // namespace cc |
| 1301 | 1296 |
| 1302 #endif // OS_ANDROID | 1297 #endif // OS_ANDROID |
| OLD | NEW |