Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(507)

Side by Side Diff: cc/test/pixel_test.h

Issue 2254543003: cc: Delete the RendererClient class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@setvisible-browser
Patch Set: deleterendererclient: rebase Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/test/fake_renderer_client.h ('k') | cc/test/pixel_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
12 #include "ui/gfx/geometry/size.h" 12 #include "ui/gfx/geometry/size.h"
13 #include "ui/gl/gl_implementation.h" 13 #include "ui/gl/gl_implementation.h"
14 14
15 #ifndef CC_TEST_PIXEL_TEST_H_ 15 #ifndef CC_TEST_PIXEL_TEST_H_
16 #define CC_TEST_PIXEL_TEST_H_ 16 #define CC_TEST_PIXEL_TEST_H_
17 17
18 namespace cc { 18 namespace cc {
19 class CopyOutputResult; 19 class CopyOutputResult;
20 class DirectRenderer; 20 class DirectRenderer;
21 class FakeOutputSurfaceClient; 21 class FakeOutputSurfaceClient;
22 class OutputSurface; 22 class OutputSurface;
23 class ResourceProvider; 23 class ResourceProvider;
24 class SoftwareRenderer; 24 class SoftwareRenderer;
25 class TestGpuMemoryBufferManager; 25 class TestGpuMemoryBufferManager;
26 class TestSharedBitmapManager; 26 class TestSharedBitmapManager;
27 27
28 class PixelTest : public testing::Test, public RendererClient { 28 class PixelTest : public testing::Test {
29 protected: 29 protected:
30 PixelTest(); 30 PixelTest();
31 ~PixelTest() override; 31 ~PixelTest() override;
32 32
33 bool RunPixelTest(RenderPassList* pass_list, 33 bool RunPixelTest(RenderPassList* pass_list,
34 const base::FilePath& ref_file, 34 const base::FilePath& ref_file,
35 const PixelComparator& comparator); 35 const PixelComparator& comparator);
36 36
37 bool RunPixelTestWithReadbackTarget( 37 bool RunPixelTestWithReadbackTarget(
38 RenderPassList* pass_list, 38 RenderPassList* pass_list,
39 RenderPass* target, 39 RenderPass* target,
40 const base::FilePath& ref_file, 40 const base::FilePath& ref_file,
41 const PixelComparator& comparator); 41 const PixelComparator& comparator);
42 42
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;
53 std::unique_ptr<FakeOutputSurfaceClient> output_surface_client_; 52 std::unique_ptr<FakeOutputSurfaceClient> output_surface_client_;
54 std::unique_ptr<OutputSurface> output_surface_; 53 std::unique_ptr<OutputSurface> output_surface_;
55 std::unique_ptr<TestSharedBitmapManager> shared_bitmap_manager_; 54 std::unique_ptr<TestSharedBitmapManager> shared_bitmap_manager_;
56 std::unique_ptr<TestGpuMemoryBufferManager> gpu_memory_buffer_manager_; 55 std::unique_ptr<TestGpuMemoryBufferManager> gpu_memory_buffer_manager_;
57 std::unique_ptr<BlockingTaskRunner> main_thread_task_runner_; 56 std::unique_ptr<BlockingTaskRunner> main_thread_task_runner_;
58 std::unique_ptr<ResourceProvider> resource_provider_; 57 std::unique_ptr<ResourceProvider> resource_provider_;
59 std::unique_ptr<TextureMailboxDeleter> texture_mailbox_deleter_; 58 std::unique_ptr<TextureMailboxDeleter> texture_mailbox_deleter_;
60 std::unique_ptr<DirectRenderer> renderer_; 59 std::unique_ptr<DirectRenderer> renderer_;
61 SoftwareRenderer* software_renderer_ = nullptr; 60 SoftwareRenderer* software_renderer_ = nullptr;
62 std::unique_ptr<SkBitmap> result_bitmap_; 61 std::unique_ptr<SkBitmap> result_bitmap_;
63 gfx::Vector2d external_device_viewport_offset_; 62 gfx::Vector2d external_device_viewport_offset_;
64 gfx::Rect external_device_clip_rect_; 63 gfx::Rect external_device_clip_rect_;
65 64
66 void SetUpGLRenderer(bool use_skia_gpu_backend, bool flipped_output_surface); 65 void SetUpGLRenderer(bool use_skia_gpu_backend, bool flipped_output_surface);
67 void SetUpSoftwareRenderer(); 66 void SetUpSoftwareRenderer();
68 67
69 void ForceExpandedViewport(const gfx::Size& surface_expansion); 68 void ForceExpandedViewport(const gfx::Size& surface_expansion);
70 void ForceViewportOffset(const gfx::Vector2d& viewport_offset); 69 void ForceViewportOffset(const gfx::Vector2d& viewport_offset);
71 void ForceDeviceClip(const gfx::Rect& clip); 70 void ForceDeviceClip(const gfx::Rect& clip);
72 void EnableExternalStencilTest(); 71 void EnableExternalStencilTest();
73 72
74 // RendererClient implementation.
75 void SetFullRootLayerDamage() override {}
76
77 private: 73 private:
78 void ReadbackResult(base::Closure quit_run_loop, 74 void ReadbackResult(base::Closure quit_run_loop,
79 std::unique_ptr<CopyOutputResult> result); 75 std::unique_ptr<CopyOutputResult> result);
80 76
81 bool PixelsMatchReference(const base::FilePath& ref_file, 77 bool PixelsMatchReference(const base::FilePath& ref_file,
82 const PixelComparator& comparator); 78 const PixelComparator& comparator);
83 79
84 std::unique_ptr<gl::DisableNullDrawGLBindings> enable_pixel_output_; 80 std::unique_ptr<gl::DisableNullDrawGLBindings> enable_pixel_output_;
85 }; 81 };
86 82
87 template<typename RendererType> 83 template<typename RendererType>
88 class RendererPixelTest : public PixelTest { 84 class RendererPixelTest : public PixelTest {
89 public: 85 public:
90 RendererType* renderer() { 86 RendererType* renderer() {
91 return static_cast<RendererType*>(renderer_.get()); 87 return static_cast<RendererType*>(renderer_.get());
92 } 88 }
93 89
94 protected: 90 protected:
95 void SetUp() override; 91 void SetUp() override;
96 }; 92 };
97 93
98 // Wrappers to differentiate renderers where the the output surface and viewport 94 // Wrappers to differentiate renderers where the the output surface and viewport
99 // have an externally determined size and offset. 95 // have an externally determined size and offset.
100 class GLRendererWithExpandedViewport : public GLRenderer { 96 class GLRendererWithExpandedViewport : public GLRenderer {
101 public: 97 public:
102 GLRendererWithExpandedViewport(RendererClient* client, 98 GLRendererWithExpandedViewport(const RendererSettings* settings,
103 const RendererSettings* settings,
104 OutputSurface* output_surface, 99 OutputSurface* output_surface,
105 ResourceProvider* resource_provider, 100 ResourceProvider* resource_provider,
106 TextureMailboxDeleter* texture_mailbox_deleter, 101 TextureMailboxDeleter* texture_mailbox_deleter,
107 int highp_threshold_min) 102 int highp_threshold_min)
108 : GLRenderer(client, 103 : GLRenderer(settings,
109 settings,
110 output_surface, 104 output_surface,
111 resource_provider, 105 resource_provider,
112 texture_mailbox_deleter, 106 texture_mailbox_deleter,
113 highp_threshold_min) {} 107 highp_threshold_min) {}
114 }; 108 };
115 109
116 class SoftwareRendererWithExpandedViewport : public SoftwareRenderer { 110 class SoftwareRendererWithExpandedViewport : public SoftwareRenderer {
117 public: 111 public:
118 SoftwareRendererWithExpandedViewport(RendererClient* client, 112 SoftwareRendererWithExpandedViewport(const RendererSettings* settings,
119 const RendererSettings* settings,
120 OutputSurface* output_surface, 113 OutputSurface* output_surface,
121 ResourceProvider* resource_provider) 114 ResourceProvider* resource_provider)
122 : SoftwareRenderer(client, settings, output_surface, resource_provider) {} 115 : SoftwareRenderer(settings, output_surface, resource_provider) {}
123 }; 116 };
124 117
125 class GLRendererWithFlippedSurface : public GLRenderer { 118 class GLRendererWithFlippedSurface : public GLRenderer {
126 public: 119 public:
127 GLRendererWithFlippedSurface(RendererClient* client, 120 GLRendererWithFlippedSurface(const RendererSettings* settings,
128 const RendererSettings* settings,
129 OutputSurface* output_surface, 121 OutputSurface* output_surface,
130 ResourceProvider* resource_provider, 122 ResourceProvider* resource_provider,
131 TextureMailboxDeleter* texture_mailbox_deleter, 123 TextureMailboxDeleter* texture_mailbox_deleter,
132 int highp_threshold_min) 124 int highp_threshold_min)
133 : GLRenderer(client, 125 : GLRenderer(settings,
134 settings,
135 output_surface, 126 output_surface,
136 resource_provider, 127 resource_provider,
137 texture_mailbox_deleter, 128 texture_mailbox_deleter,
138 highp_threshold_min) {} 129 highp_threshold_min) {}
139 }; 130 };
140 131
141 template<> 132 template<>
142 inline void RendererPixelTest<GLRenderer>::SetUp() { 133 inline void RendererPixelTest<GLRenderer>::SetUp() {
143 SetUpGLRenderer(false, false); 134 SetUpGLRenderer(false, false);
144 } 135 }
(...skipping 21 matching lines...) Expand all
166 ForceExpandedViewport(gfx::Size(50, 50)); 157 ForceExpandedViewport(gfx::Size(50, 50));
167 ForceViewportOffset(gfx::Vector2d(10, 20)); 158 ForceViewportOffset(gfx::Vector2d(10, 20));
168 } 159 }
169 160
170 typedef RendererPixelTest<GLRenderer> GLRendererPixelTest; 161 typedef RendererPixelTest<GLRenderer> GLRendererPixelTest;
171 typedef RendererPixelTest<SoftwareRenderer> SoftwareRendererPixelTest; 162 typedef RendererPixelTest<SoftwareRenderer> SoftwareRendererPixelTest;
172 163
173 } // namespace cc 164 } // namespace cc
174 165
175 #endif // CC_TEST_PIXEL_TEST_H_ 166 #endif // CC_TEST_PIXEL_TEST_H_
OLDNEW
« no previous file with comments | « cc/test/fake_renderer_client.h ('k') | cc/test/pixel_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698