| 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 "base/files/file_util.h" | 5 #include "base/files/file_util.h" |
| 6 #include "cc/output/gl_renderer.h" | 6 #include "cc/output/gl_renderer.h" |
| 7 #include "cc/output/software_renderer.h" | 7 #include "cc/output/software_renderer.h" |
| 8 #include "cc/quads/render_pass.h" | 8 #include "cc/quads/render_pass.h" |
| 9 #include "cc/test/pixel_comparator.h" | 9 #include "cc/test/pixel_comparator.h" |
| 10 #include "cc/trees/layer_tree_settings.h" | 10 #include "cc/trees/layer_tree_settings.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 bool RunPixelTestWithReadbackTargetAndArea(RenderPassList* pass_list, | 43 bool RunPixelTestWithReadbackTargetAndArea(RenderPassList* pass_list, |
| 44 RenderPass* target, | 44 RenderPass* target, |
| 45 const base::FilePath& ref_file, | 45 const base::FilePath& ref_file, |
| 46 const PixelComparator& comparator, | 46 const PixelComparator& comparator, |
| 47 const gfx::Rect* copy_rect); | 47 const gfx::Rect* copy_rect); |
| 48 | 48 |
| 49 LayerTreeSettings settings_; | 49 LayerTreeSettings settings_; |
| 50 gfx::Size device_viewport_size_; | 50 gfx::Size device_viewport_size_; |
| 51 bool disable_picture_quad_image_filtering_; | 51 bool disable_picture_quad_image_filtering_; |
| 52 class PixelTestRendererClient; | 52 class PixelTestRendererClient; |
| 53 scoped_ptr<FakeOutputSurfaceClient> output_surface_client_; | 53 std::unique_ptr<FakeOutputSurfaceClient> output_surface_client_; |
| 54 scoped_ptr<OutputSurface> output_surface_; | 54 std::unique_ptr<OutputSurface> output_surface_; |
| 55 scoped_ptr<TestSharedBitmapManager> shared_bitmap_manager_; | 55 std::unique_ptr<TestSharedBitmapManager> shared_bitmap_manager_; |
| 56 scoped_ptr<TestGpuMemoryBufferManager> gpu_memory_buffer_manager_; | 56 std::unique_ptr<TestGpuMemoryBufferManager> gpu_memory_buffer_manager_; |
| 57 scoped_ptr<BlockingTaskRunner> main_thread_task_runner_; | 57 std::unique_ptr<BlockingTaskRunner> main_thread_task_runner_; |
| 58 scoped_ptr<ResourceProvider> resource_provider_; | 58 std::unique_ptr<ResourceProvider> resource_provider_; |
| 59 scoped_ptr<TextureMailboxDeleter> texture_mailbox_deleter_; | 59 std::unique_ptr<TextureMailboxDeleter> texture_mailbox_deleter_; |
| 60 scoped_ptr<DirectRenderer> renderer_; | 60 std::unique_ptr<DirectRenderer> renderer_; |
| 61 scoped_ptr<SkBitmap> result_bitmap_; | 61 std::unique_ptr<SkBitmap> result_bitmap_; |
| 62 gfx::Vector2d external_device_viewport_offset_; | 62 gfx::Vector2d external_device_viewport_offset_; |
| 63 gfx::Rect external_device_clip_rect_; | 63 gfx::Rect external_device_clip_rect_; |
| 64 | 64 |
| 65 void SetUpGLRenderer(bool use_skia_gpu_backend, bool flipped_output_surface); | 65 void SetUpGLRenderer(bool use_skia_gpu_backend, bool flipped_output_surface); |
| 66 void SetUpSoftwareRenderer(); | 66 void SetUpSoftwareRenderer(); |
| 67 | 67 |
| 68 void ForceExpandedViewport(const gfx::Size& surface_expansion); | 68 void ForceExpandedViewport(const gfx::Size& surface_expansion); |
| 69 void ForceViewportOffset(const gfx::Vector2d& viewport_offset); | 69 void ForceViewportOffset(const gfx::Vector2d& viewport_offset); |
| 70 void ForceDeviceClip(const gfx::Rect& clip); | 70 void ForceDeviceClip(const gfx::Rect& clip); |
| 71 void EnableExternalStencilTest(); | 71 void EnableExternalStencilTest(); |
| 72 | 72 |
| 73 // RendererClient implementation. | 73 // RendererClient implementation. |
| 74 void SetFullRootLayerDamage() override {} | 74 void SetFullRootLayerDamage() override {} |
| 75 | 75 |
| 76 private: | 76 private: |
| 77 void ReadbackResult(base::Closure quit_run_loop, | 77 void ReadbackResult(base::Closure quit_run_loop, |
| 78 scoped_ptr<CopyOutputResult> result); | 78 std::unique_ptr<CopyOutputResult> result); |
| 79 | 79 |
| 80 bool PixelsMatchReference(const base::FilePath& ref_file, | 80 bool PixelsMatchReference(const base::FilePath& ref_file, |
| 81 const PixelComparator& comparator); | 81 const PixelComparator& comparator); |
| 82 | 82 |
| 83 scoped_ptr<gfx::DisableNullDrawGLBindings> enable_pixel_output_; | 83 std::unique_ptr<gfx::DisableNullDrawGLBindings> enable_pixel_output_; |
| 84 }; | 84 }; |
| 85 | 85 |
| 86 template<typename RendererType> | 86 template<typename RendererType> |
| 87 class RendererPixelTest : public PixelTest { | 87 class RendererPixelTest : public PixelTest { |
| 88 public: | 88 public: |
| 89 RendererType* renderer() { | 89 RendererType* renderer() { |
| 90 return static_cast<RendererType*>(renderer_.get()); | 90 return static_cast<RendererType*>(renderer_.get()); |
| 91 } | 91 } |
| 92 | 92 |
| 93 protected: | 93 protected: |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 ForceExpandedViewport(gfx::Size(50, 50)); | 165 ForceExpandedViewport(gfx::Size(50, 50)); |
| 166 ForceViewportOffset(gfx::Vector2d(10, 20)); | 166 ForceViewportOffset(gfx::Vector2d(10, 20)); |
| 167 } | 167 } |
| 168 | 168 |
| 169 typedef RendererPixelTest<GLRenderer> GLRendererPixelTest; | 169 typedef RendererPixelTest<GLRenderer> GLRendererPixelTest; |
| 170 typedef RendererPixelTest<SoftwareRenderer> SoftwareRendererPixelTest; | 170 typedef RendererPixelTest<SoftwareRenderer> SoftwareRendererPixelTest; |
| 171 | 171 |
| 172 } // namespace cc | 172 } // namespace cc |
| 173 | 173 |
| 174 #endif // CC_TEST_PIXEL_TEST_H_ | 174 #endif // CC_TEST_PIXEL_TEST_H_ |
| OLD | NEW |