| 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 #ifndef CC_TEST_LAYER_TREE_PIXEL_TEST_H_ | 5 #ifndef CC_TEST_LAYER_TREE_PIXEL_TEST_H_ |
| 6 #define CC_TEST_LAYER_TREE_PIXEL_TEST_H_ | 6 #define CC_TEST_LAYER_TREE_PIXEL_TEST_H_ |
| 7 | 7 |
| 8 #include <memory> |
| 8 #include <vector> | 9 #include <vector> |
| 9 | 10 |
| 10 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
| 11 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 12 #include "base/memory/scoped_ptr.h" | |
| 13 #include "cc/resources/single_release_callback.h" | 13 #include "cc/resources/single_release_callback.h" |
| 14 #include "cc/test/layer_tree_test.h" | 14 #include "cc/test/layer_tree_test.h" |
| 15 #include "ui/gl/gl_implementation.h" | 15 #include "ui/gl/gl_implementation.h" |
| 16 | 16 |
| 17 class SkBitmap; | 17 class SkBitmap; |
| 18 | 18 |
| 19 namespace gpu { | 19 namespace gpu { |
| 20 class GLInProcessContext; | 20 class GLInProcessContext; |
| 21 } | 21 } |
| 22 | 22 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 33 public: | 33 public: |
| 34 enum PixelTestType { | 34 enum PixelTestType { |
| 35 PIXEL_TEST_GL, | 35 PIXEL_TEST_GL, |
| 36 PIXEL_TEST_SOFTWARE, | 36 PIXEL_TEST_SOFTWARE, |
| 37 }; | 37 }; |
| 38 | 38 |
| 39 protected: | 39 protected: |
| 40 LayerTreePixelTest(); | 40 LayerTreePixelTest(); |
| 41 ~LayerTreePixelTest() override; | 41 ~LayerTreePixelTest() override; |
| 42 | 42 |
| 43 scoped_ptr<OutputSurface> CreateOutputSurface() override; | 43 std::unique_ptr<OutputSurface> CreateOutputSurface() override; |
| 44 void WillCommitCompleteOnThread(LayerTreeHostImpl* impl) override; | 44 void WillCommitCompleteOnThread(LayerTreeHostImpl* impl) override; |
| 45 | 45 |
| 46 virtual scoped_ptr<CopyOutputRequest> CreateCopyOutputRequest(); | 46 virtual std::unique_ptr<CopyOutputRequest> CreateCopyOutputRequest(); |
| 47 | 47 |
| 48 void ReadbackResult(scoped_ptr<CopyOutputResult> result); | 48 void ReadbackResult(std::unique_ptr<CopyOutputResult> result); |
| 49 | 49 |
| 50 void BeginTest() override; | 50 void BeginTest() override; |
| 51 void SetupTree() override; | 51 void SetupTree() override; |
| 52 void AfterTest() override; | 52 void AfterTest() override; |
| 53 void EndTest() override; | 53 void EndTest() override; |
| 54 | 54 |
| 55 void TryEndTest(); | 55 void TryEndTest(); |
| 56 | 56 |
| 57 scoped_refptr<SolidColorLayer> CreateSolidColorLayer(const gfx::Rect& rect, | 57 scoped_refptr<SolidColorLayer> CreateSolidColorLayer(const gfx::Rect& rect, |
| 58 SkColor color); | 58 SkColor color); |
| 59 scoped_refptr<SolidColorLayer> CreateSolidColorLayerWithBorder( | 59 scoped_refptr<SolidColorLayer> CreateSolidColorLayerWithBorder( |
| 60 const gfx::Rect& rect, | 60 const gfx::Rect& rect, |
| 61 SkColor color, | 61 SkColor color, |
| 62 int border_width, | 62 int border_width, |
| 63 SkColor border_color); | 63 SkColor border_color); |
| 64 | 64 |
| 65 void RunPixelTest(PixelTestType type, | 65 void RunPixelTest(PixelTestType type, |
| 66 scoped_refptr<Layer> content_root, | 66 scoped_refptr<Layer> content_root, |
| 67 base::FilePath file_name); | 67 base::FilePath file_name); |
| 68 | 68 |
| 69 void RunSingleThreadedPixelTest(PixelTestType test_type, | 69 void RunSingleThreadedPixelTest(PixelTestType test_type, |
| 70 scoped_refptr<Layer> content_root, | 70 scoped_refptr<Layer> content_root, |
| 71 base::FilePath file_name); | 71 base::FilePath file_name); |
| 72 | 72 |
| 73 void RunPixelTestWithReadbackTarget(PixelTestType type, | 73 void RunPixelTestWithReadbackTarget(PixelTestType type, |
| 74 scoped_refptr<Layer> content_root, | 74 scoped_refptr<Layer> content_root, |
| 75 Layer* target, | 75 Layer* target, |
| 76 base::FilePath file_name); | 76 base::FilePath file_name); |
| 77 | 77 |
| 78 scoped_ptr<SkBitmap> CopyTextureMailboxToBitmap( | 78 std::unique_ptr<SkBitmap> CopyTextureMailboxToBitmap( |
| 79 const gfx::Size& size, | 79 const gfx::Size& size, |
| 80 const TextureMailbox& texture_mailbox); | 80 const TextureMailbox& texture_mailbox); |
| 81 | 81 |
| 82 void Finish(); | 82 void Finish(); |
| 83 | 83 |
| 84 void set_enlarge_texture_amount(const gfx::Vector2d& enlarge_texture_amount) { | 84 void set_enlarge_texture_amount(const gfx::Vector2d& enlarge_texture_amount) { |
| 85 enlarge_texture_amount_ = enlarge_texture_amount; | 85 enlarge_texture_amount_ = enlarge_texture_amount; |
| 86 } | 86 } |
| 87 | 87 |
| 88 // Common CSS colors defined for tests to use. | 88 // Common CSS colors defined for tests to use. |
| 89 static const SkColor kCSSOrange = 0xffffa500; | 89 static const SkColor kCSSOrange = 0xffffa500; |
| 90 static const SkColor kCSSBrown = 0xffa52a2a; | 90 static const SkColor kCSSBrown = 0xffa52a2a; |
| 91 static const SkColor kCSSGreen = 0xff008000; | 91 static const SkColor kCSSGreen = 0xff008000; |
| 92 | 92 |
| 93 gfx::DisableNullDrawGLBindings enable_pixel_output_; | 93 gfx::DisableNullDrawGLBindings enable_pixel_output_; |
| 94 scoped_ptr<PixelComparator> pixel_comparator_; | 94 std::unique_ptr<PixelComparator> pixel_comparator_; |
| 95 PixelTestType test_type_; | 95 PixelTestType test_type_; |
| 96 scoped_refptr<Layer> content_root_; | 96 scoped_refptr<Layer> content_root_; |
| 97 Layer* readback_target_; | 97 Layer* readback_target_; |
| 98 base::FilePath ref_file_; | 98 base::FilePath ref_file_; |
| 99 scoped_ptr<SkBitmap> result_bitmap_; | 99 std::unique_ptr<SkBitmap> result_bitmap_; |
| 100 std::vector<scoped_refptr<TextureLayer>> texture_layers_; | 100 std::vector<scoped_refptr<TextureLayer>> texture_layers_; |
| 101 int pending_texture_mailbox_callbacks_; | 101 int pending_texture_mailbox_callbacks_; |
| 102 gfx::Vector2d enlarge_texture_amount_; | 102 gfx::Vector2d enlarge_texture_amount_; |
| 103 }; | 103 }; |
| 104 | 104 |
| 105 } // namespace cc | 105 } // namespace cc |
| 106 | 106 |
| 107 #endif // CC_TEST_LAYER_TREE_PIXEL_TEST_H_ | 107 #endif // CC_TEST_LAYER_TREE_PIXEL_TEST_H_ |
| OLD | NEW |