OLD | NEW |
---|---|
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/message_loop/message_loop.h" | 5 #include "base/message_loop/message_loop.h" |
6 #include "cc/layers/append_quads_data.h" | 6 #include "cc/layers/append_quads_data.h" |
7 #include "cc/output/gl_renderer.h" | 7 #include "cc/output/gl_renderer.h" |
8 #include "cc/quads/draw_quad.h" | 8 #include "cc/quads/draw_quad.h" |
9 #include "cc/quads/picture_draw_quad.h" | 9 #include "cc/quads/picture_draw_quad.h" |
10 #include "cc/quads/texture_draw_quad.h" | 10 #include "cc/quads/texture_draw_quad.h" |
11 #include "cc/test/fake_picture_pile_impl.h" | 11 #include "cc/test/fake_picture_pile_impl.h" |
12 #include "cc/test/pixel_test.h" | 12 #include "cc/test/pixel_test.h" |
13 #include "gpu/GLES2/gl2extchromium.h" | 13 #include "gpu/GLES2/gl2extchromium.h" |
14 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" | 14 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" |
15 #include "third_party/skia/include/core/SkImageFilter.h" | 15 #include "third_party/skia/include/core/SkImageFilter.h" |
16 #include "third_party/skia/include/core/SkMatrix.h" | 16 #include "third_party/skia/include/core/SkMatrix.h" |
17 #include "third_party/skia/include/effects/SkColorFilterImageFilter.h" | 17 #include "third_party/skia/include/effects/SkColorFilterImageFilter.h" |
18 #include "third_party/skia/include/effects/SkColorMatrixFilter.h" | 18 #include "third_party/skia/include/effects/SkColorMatrixFilter.h" |
19 #include "ui/gfx/rect_conversions.h" | 19 #include "ui/gfx/rect_conversions.h" |
20 | 20 |
21 namespace cc { | 21 namespace cc { |
22 namespace { | 22 namespace { |
23 | 23 |
24 #if !defined(OS_ANDROID) | |
24 scoped_ptr<RenderPass> CreateTestRootRenderPass(RenderPass::Id id, | 25 scoped_ptr<RenderPass> CreateTestRootRenderPass(RenderPass::Id id, |
25 gfx::Rect rect) { | 26 gfx::Rect rect) { |
26 scoped_ptr<RenderPass> pass = RenderPass::Create(); | 27 scoped_ptr<RenderPass> pass = RenderPass::Create(); |
27 const gfx::Rect output_rect = rect; | 28 const gfx::Rect output_rect = rect; |
28 const gfx::RectF damage_rect = rect; | 29 const gfx::RectF damage_rect = rect; |
29 const gfx::Transform transform_to_root_target; | 30 const gfx::Transform transform_to_root_target; |
30 pass->SetNew(id, output_rect, damage_rect, transform_to_root_target); | 31 pass->SetNew(id, output_rect, damage_rect, transform_to_root_target); |
31 return pass.Pass(); | 32 return pass.Pass(); |
32 } | 33 } |
33 | 34 |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
128 gfx::Rect(), | 129 gfx::Rect(), |
129 resource, | 130 resource, |
130 premultiplied_alpha, | 131 premultiplied_alpha, |
131 gfx::PointF(0.0f, 0.0f), // uv_top_left | 132 gfx::PointF(0.0f, 0.0f), // uv_top_left |
132 gfx::PointF(1.0f, 1.0f), // uv_bottom_right | 133 gfx::PointF(1.0f, 1.0f), // uv_bottom_right |
133 background_color, | 134 background_color, |
134 vertex_opacity, | 135 vertex_opacity, |
135 false); // flipped | 136 false); // flipped |
136 return quad.Pass(); | 137 return quad.Pass(); |
137 } | 138 } |
139 #endif // !defined(OS_ANDROID) | |
138 | 140 |
139 typedef ::testing::Types<GLRenderer, | 141 typedef ::testing::Types<GLRenderer, |
140 SoftwareRenderer, | 142 SoftwareRenderer, |
141 GLRendererWithExpandedViewport, | 143 GLRendererWithExpandedViewport, |
142 SoftwareRendererWithExpandedViewport> RendererTypes; | 144 SoftwareRendererWithExpandedViewport> RendererTypes; |
143 TYPED_TEST_CASE(RendererPixelTest, RendererTypes); | 145 TYPED_TEST_CASE(RendererPixelTest, RendererTypes); |
144 | 146 |
145 typedef ::testing::Types<GLRenderer, | 147 typedef ::testing::Types<GLRenderer, |
146 GLRendererWithSkiaGPUBackend, | 148 GLRendererWithSkiaGPUBackend, |
147 SoftwareRenderer> RendererTypesWithSkiaGPUBackend; | 149 SoftwareRenderer> RendererTypesWithSkiaGPUBackend; |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
188 return fuzzy_.Compare(actual_bmp, expected_bmp); | 190 return fuzzy_.Compare(actual_bmp, expected_bmp); |
189 } | 191 } |
190 | 192 |
191 template<typename RendererType> | 193 template<typename RendererType> |
192 bool FuzzyForSoftwareOnlyPixelComparator<RendererType>::Compare( | 194 bool FuzzyForSoftwareOnlyPixelComparator<RendererType>::Compare( |
193 const SkBitmap& actual_bmp, | 195 const SkBitmap& actual_bmp, |
194 const SkBitmap& expected_bmp) const { | 196 const SkBitmap& expected_bmp) const { |
195 return exact_.Compare(actual_bmp, expected_bmp); | 197 return exact_.Compare(actual_bmp, expected_bmp); |
196 } | 198 } |
197 | 199 |
198 #if !defined(OS_ANDROID) | 200 #if !defined(OS_ANDROID) |
Nico
2013/11/10 05:07:09
I just moved this one to line 24. Does that not wo
hans
2013/11/11 19:29:51
Looks like that should work. I'll do that.
| |
199 TYPED_TEST(RendererPixelTest, SimpleGreenRect) { | 201 TYPED_TEST(RendererPixelTest, SimpleGreenRect) { |
200 gfx::Rect rect(this->device_viewport_size_); | 202 gfx::Rect rect(this->device_viewport_size_); |
201 | 203 |
202 RenderPass::Id id(1, 1); | 204 RenderPass::Id id(1, 1); |
203 scoped_ptr<RenderPass> pass = CreateTestRootRenderPass(id, rect); | 205 scoped_ptr<RenderPass> pass = CreateTestRootRenderPass(id, rect); |
204 | 206 |
205 scoped_ptr<SharedQuadState> shared_state = | 207 scoped_ptr<SharedQuadState> shared_state = |
206 CreateTestSharedQuadState(gfx::Transform(), rect); | 208 CreateTestSharedQuadState(gfx::Transform(), rect); |
207 | 209 |
208 scoped_ptr<SolidColorDrawQuad> color_quad = SolidColorDrawQuad::Create(); | 210 scoped_ptr<SolidColorDrawQuad> color_quad = SolidColorDrawQuad::Create(); |
(...skipping 1799 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2008 EXPECT_TRUE(this->RunPixelTest( | 2010 EXPECT_TRUE(this->RunPixelTest( |
2009 &pass_list, | 2011 &pass_list, |
2010 PixelTest::NoOffscreenContext, | 2012 PixelTest::NoOffscreenContext, |
2011 base::FilePath(FILE_PATH_LITERAL("four_blue_green_checkers.png")), | 2013 base::FilePath(FILE_PATH_LITERAL("four_blue_green_checkers.png")), |
2012 ExactPixelComparator(true))); | 2014 ExactPixelComparator(true))); |
2013 } | 2015 } |
2014 #endif // !defined(OS_ANDROID) | 2016 #endif // !defined(OS_ANDROID) |
2015 | 2017 |
2016 } // namespace | 2018 } // namespace |
2017 } // namespace cc | 2019 } // namespace cc |
OLD | NEW |