| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 EXPECT_TRUE(proxy()->IsMainThread()); | 51 EXPECT_TRUE(proxy()->IsMainThread()); |
| 52 EXPECT_TRUE(result->HasBitmap()); | 52 EXPECT_TRUE(result->HasBitmap()); |
| 53 result_bitmap_ = result->TakeBitmap().Pass(); | 53 result_bitmap_ = result->TakeBitmap().Pass(); |
| 54 EndTest(); | 54 EndTest(); |
| 55 } | 55 } |
| 56 | 56 |
| 57 void ReadbackResultAsTexture(scoped_ptr<CopyOutputResult> result) { | 57 void ReadbackResultAsTexture(scoped_ptr<CopyOutputResult> result) { |
| 58 EXPECT_TRUE(proxy()->IsMainThread()); | 58 EXPECT_TRUE(proxy()->IsMainThread()); |
| 59 EXPECT_TRUE(result->HasTexture()); | 59 EXPECT_TRUE(result->HasTexture()); |
| 60 | 60 |
| 61 scoped_ptr<TextureMailbox> texture_mailbox = result->TakeTexture().Pass(); | 61 TextureMailbox texture_mailbox; |
| 62 EXPECT_TRUE(texture_mailbox->IsValid()); | 62 ScopedReleaseCallback release_callback; |
| 63 EXPECT_TRUE(texture_mailbox->IsTexture()); | 63 result->TakeTexture(&texture_mailbox, &release_callback); |
| 64 EXPECT_TRUE(texture_mailbox.IsValid()); |
| 65 EXPECT_TRUE(texture_mailbox.IsTexture()); |
| 64 | 66 |
| 65 scoped_ptr<SkBitmap> bitmap = | 67 scoped_ptr<SkBitmap> bitmap = |
| 66 CopyTextureMailboxToBitmap(result->size(), *texture_mailbox); | 68 CopyTextureMailboxToBitmap(result->size(), texture_mailbox); |
| 67 texture_mailbox->RunReleaseCallback(0, false); | 69 release_callback.RunAndReset(0, false); |
| 68 | 70 |
| 69 ReadbackResultAsBitmap(CopyOutputResult::CreateBitmapResult(bitmap.Pass())); | 71 ReadbackResultAsBitmap(CopyOutputResult::CreateBitmapResult(bitmap.Pass())); |
| 70 } | 72 } |
| 71 | 73 |
| 72 gfx::Rect copy_subrect_; | 74 gfx::Rect copy_subrect_; |
| 73 }; | 75 }; |
| 74 | 76 |
| 75 TEST_F(LayerTreeHostReadbackPixelTest, ReadbackRootLayer_Software) { | 77 TEST_F(LayerTreeHostReadbackPixelTest, ReadbackRootLayer_Software) { |
| 76 scoped_refptr<SolidColorLayer> background = CreateSolidColorLayer( | 78 scoped_refptr<SolidColorLayer> background = CreateSolidColorLayer( |
| 77 gfx::Rect(200, 200), SK_ColorWHITE); | 79 gfx::Rect(200, 200), SK_ColorWHITE); |
| (...skipping 799 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 877 background, | 879 background, |
| 878 texture.get(), | 880 texture.get(), |
| 879 base::FilePath(FILE_PATH_LITERAL( | 881 base::FilePath(FILE_PATH_LITERAL( |
| 880 "green_with_blue_corner.png"))); | 882 "green_with_blue_corner.png"))); |
| 881 } | 883 } |
| 882 | 884 |
| 883 } // namespace | 885 } // namespace |
| 884 } // namespace cc | 886 } // namespace cc |
| 885 | 887 |
| 886 #endif // OS_ANDROID | 888 #endif // OS_ANDROID |
| OLD | NEW |