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/file_util.h" | 5 #include "base/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 "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 const base::FilePath& ref_file, | 35 const base::FilePath& ref_file, |
36 const PixelComparator& comparator); | 36 const PixelComparator& comparator); |
37 | 37 |
38 bool RunPixelTestWithReadbackTarget( | 38 bool RunPixelTestWithReadbackTarget( |
39 RenderPassList* pass_list, | 39 RenderPassList* pass_list, |
40 RenderPass* target, | 40 RenderPass* target, |
41 OffscreenContextOption provide_offscreen_context, | 41 OffscreenContextOption provide_offscreen_context, |
42 const base::FilePath& ref_file, | 42 const base::FilePath& ref_file, |
43 const PixelComparator& comparator); | 43 const PixelComparator& comparator); |
44 | 44 |
| 45 LayerTreeSettings settings_; |
45 gfx::Size device_viewport_size_; | 46 gfx::Size device_viewport_size_; |
46 class PixelTestRendererClient; | 47 class PixelTestRendererClient; |
47 scoped_ptr<OutputSurface> output_surface_; | 48 scoped_ptr<OutputSurface> output_surface_; |
48 scoped_ptr<ResourceProvider> resource_provider_; | 49 scoped_ptr<ResourceProvider> resource_provider_; |
49 scoped_ptr<PixelTestRendererClient> fake_client_; | 50 scoped_ptr<PixelTestRendererClient> fake_client_; |
50 scoped_ptr<DirectRenderer> renderer_; | 51 scoped_ptr<DirectRenderer> renderer_; |
51 scoped_ptr<SkBitmap> result_bitmap_; | 52 scoped_ptr<SkBitmap> result_bitmap_; |
52 | 53 |
53 void SetUpGLRenderer(bool use_skia_gpu_backend); | 54 void SetUpGLRenderer(bool use_skia_gpu_backend); |
54 void SetUpSoftwareRenderer(); | 55 void SetUpSoftwareRenderer(); |
(...skipping 23 matching lines...) Expand all Loading... |
78 | 79 |
79 protected: | 80 protected: |
80 virtual void SetUp() OVERRIDE; | 81 virtual void SetUp() OVERRIDE; |
81 }; | 82 }; |
82 | 83 |
83 // A simple wrapper to differentiate a renderer that should use ganesh | 84 // A simple wrapper to differentiate a renderer that should use ganesh |
84 // and one that shouldn't in templates. | 85 // and one that shouldn't in templates. |
85 class GLRendererWithSkiaGPUBackend : public GLRenderer { | 86 class GLRendererWithSkiaGPUBackend : public GLRenderer { |
86 public: | 87 public: |
87 GLRendererWithSkiaGPUBackend(RendererClient* client, | 88 GLRendererWithSkiaGPUBackend(RendererClient* client, |
88 OutputSurface* output_surface, | 89 const LayerTreeSettings* settings, |
89 ResourceProvider* resource_provider, | 90 OutputSurface* output_surface, |
90 int highp_threshold_min) | 91 ResourceProvider* resource_provider, |
| 92 int highp_threshold_min) |
91 : GLRenderer(client, | 93 : GLRenderer(client, |
| 94 settings, |
92 output_surface, | 95 output_surface, |
93 resource_provider, | 96 resource_provider, |
94 highp_threshold_min) {} | 97 highp_threshold_min) {} |
95 }; | 98 }; |
96 | 99 |
97 // Wrappers to differentiate renderers where the the output surface and viewport | 100 // Wrappers to differentiate renderers where the the output surface and viewport |
98 // have an externally determined size and offset. | 101 // have an externally determined size and offset. |
99 class GLRendererWithExpandedViewport : public GLRenderer { | 102 class GLRendererWithExpandedViewport : public GLRenderer { |
100 public: | 103 public: |
101 GLRendererWithExpandedViewport(RendererClient* client, | 104 GLRendererWithExpandedViewport(RendererClient* client, |
102 OutputSurface* output_surface, | 105 const LayerTreeSettings* settings, |
103 ResourceProvider* resource_provider, | 106 OutputSurface* output_surface, |
104 int highp_threshold_min) | 107 ResourceProvider* resource_provider, |
| 108 int highp_threshold_min) |
105 : GLRenderer(client, | 109 : GLRenderer(client, |
| 110 settings, |
106 output_surface, | 111 output_surface, |
107 resource_provider, | 112 resource_provider, |
108 highp_threshold_min) {} | 113 highp_threshold_min) {} |
109 }; | 114 }; |
110 | 115 |
111 class SoftwareRendererWithExpandedViewport : public SoftwareRenderer { | 116 class SoftwareRendererWithExpandedViewport : public SoftwareRenderer { |
112 public: | 117 public: |
113 SoftwareRendererWithExpandedViewport(RendererClient* client, | 118 SoftwareRendererWithExpandedViewport(RendererClient* client, |
114 OutputSurface* output_surface, | 119 const LayerTreeSettings* settings, |
115 ResourceProvider* resource_provider) | 120 OutputSurface* output_surface, |
116 : SoftwareRenderer(client, | 121 ResourceProvider* resource_provider) |
117 output_surface, | 122 : SoftwareRenderer(client, settings, output_surface, resource_provider) {} |
118 resource_provider) {} | |
119 }; | 123 }; |
120 | 124 |
121 | |
122 template<> | 125 template<> |
123 inline void RendererPixelTest<GLRenderer>::SetUp() { | 126 inline void RendererPixelTest<GLRenderer>::SetUp() { |
124 SetUpGLRenderer(false); | 127 SetUpGLRenderer(false); |
125 DCHECK(!renderer()->CanUseSkiaGPUBackend()); | 128 DCHECK(!renderer()->CanUseSkiaGPUBackend()); |
126 } | 129 } |
127 | 130 |
128 template<> | 131 template<> |
129 inline bool RendererPixelTest<GLRenderer>::UseSkiaGPUBackend() const { | 132 inline bool RendererPixelTest<GLRenderer>::UseSkiaGPUBackend() const { |
130 return false; | 133 return false; |
131 } | 134 } |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 } | 208 } |
206 | 209 |
207 typedef RendererPixelTest<GLRenderer> GLRendererPixelTest; | 210 typedef RendererPixelTest<GLRenderer> GLRendererPixelTest; |
208 typedef RendererPixelTest<GLRendererWithSkiaGPUBackend> | 211 typedef RendererPixelTest<GLRendererWithSkiaGPUBackend> |
209 GLRendererSkiaGPUBackendPixelTest; | 212 GLRendererSkiaGPUBackendPixelTest; |
210 typedef RendererPixelTest<SoftwareRenderer> SoftwareRendererPixelTest; | 213 typedef RendererPixelTest<SoftwareRenderer> SoftwareRendererPixelTest; |
211 | 214 |
212 } // namespace cc | 215 } // namespace cc |
213 | 216 |
214 #endif // CC_TEST_PIXEL_TEST_H_ | 217 #endif // CC_TEST_PIXEL_TEST_H_ |
OLD | NEW |