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

Side by Side Diff: cc/output/renderer_pixeltest.cc

Issue 15579002: Implement transform/clip support for Android WebView. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Turn on fuzzy comparator for new SoftwareRenderer tests Created 7 years, 6 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
OLDNEW
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.h" 5 #include "base/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/resources/platform_color.h" 10 #include "cc/resources/platform_color.h"
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 0, // mask_resource_id 87 0, // mask_resource_id
88 rect, // contents_changed_since_last_frame 88 rect, // contents_changed_since_last_frame
89 gfx::RectF(), // mask_uv_rect 89 gfx::RectF(), // mask_uv_rect
90 WebKit::WebFilterOperations(), // foreground filters 90 WebKit::WebFilterOperations(), // foreground filters
91 skia::RefPtr<SkImageFilter>(), // foreground filter 91 skia::RefPtr<SkImageFilter>(), // foreground filter
92 WebKit::WebFilterOperations()); // background filters 92 WebKit::WebFilterOperations()); // background filters
93 93
94 return quad.PassAs<DrawQuad>(); 94 return quad.PassAs<DrawQuad>();
95 } 95 }
96 96
97 typedef ::testing::Types<GLRenderer, SoftwareRenderer> RendererTypes; 97 typedef ::testing::Types<GLRenderer,
98 SoftwareRenderer,
99 GLRendererWithExpandedViewport,
100 SoftwareRendererWithExpandedViewport> RendererTypes;
98 TYPED_TEST_CASE(RendererPixelTest, RendererTypes); 101 TYPED_TEST_CASE(RendererPixelTest, RendererTypes);
99 102
100 typedef ::testing::Types<GLRenderer, 103 typedef ::testing::Types<GLRenderer,
101 GLRendererWithSkiaGPUBackend, 104 GLRendererWithSkiaGPUBackend,
102 SoftwareRenderer> RendererTypesWithSkiaGPUBackend; 105 SoftwareRenderer> RendererTypesWithSkiaGPUBackend;
103 template <typename RendererType> 106 template <typename RendererType>
104 class RendererPixelTestWithSkiaGPUBackend 107 class RendererPixelTestWithSkiaGPUBackend
105 : public RendererPixelTest<RendererType> { 108 : public RendererPixelTest<RendererType> {
106 }; 109 };
107 TYPED_TEST_CASE(RendererPixelTestWithSkiaGPUBackend, 110 TYPED_TEST_CASE(RendererPixelTestWithSkiaGPUBackend,
(...skipping 20 matching lines...) Expand all
128 ExactPixelComparator exact_; 131 ExactPixelComparator exact_;
129 }; 132 };
130 133
131 template<> 134 template<>
132 bool FuzzyForSoftwareOnlyPixelComparator<SoftwareRenderer>::Compare( 135 bool FuzzyForSoftwareOnlyPixelComparator<SoftwareRenderer>::Compare(
133 const SkBitmap& actual_bmp, 136 const SkBitmap& actual_bmp,
134 const SkBitmap& expected_bmp) const { 137 const SkBitmap& expected_bmp) const {
135 return fuzzy_.Compare(actual_bmp, expected_bmp); 138 return fuzzy_.Compare(actual_bmp, expected_bmp);
136 } 139 }
137 140
141 template <>
142 bool FuzzyForSoftwareOnlyPixelComparator<
143 SoftwareRendererWithExpandedViewport>::Compare(
144 const SkBitmap& actual_bmp,
145 const SkBitmap& expected_bmp) const {
146 return fuzzy_.Compare(actual_bmp, expected_bmp);
147 }
148
138 template<typename RendererType> 149 template<typename RendererType>
139 bool FuzzyForSoftwareOnlyPixelComparator<RendererType>::Compare( 150 bool FuzzyForSoftwareOnlyPixelComparator<RendererType>::Compare(
140 const SkBitmap& actual_bmp, 151 const SkBitmap& actual_bmp,
141 const SkBitmap& expected_bmp) const { 152 const SkBitmap& expected_bmp) const {
142 return exact_.Compare(actual_bmp, expected_bmp); 153 return exact_.Compare(actual_bmp, expected_bmp);
143 } 154 }
144 155
145 #if !defined(OS_ANDROID) 156 #if !defined(OS_ANDROID)
146 TYPED_TEST(RendererPixelTest, SimpleGreenRect) { 157 TYPED_TEST(RendererPixelTest, SimpleGreenRect) {
147 gfx::Rect rect(this->device_viewport_size_); 158 gfx::Rect rect(this->device_viewport_size_);
(...skipping 825 matching lines...) Expand 10 before | Expand all | Expand 10 after
973 984
974 EXPECT_TRUE(this->RunPixelTest( 985 EXPECT_TRUE(this->RunPixelTest(
975 &pass_list, 986 &pass_list,
976 base::FilePath(FILE_PATH_LITERAL("four_blue_green_checkers.png")), 987 base::FilePath(FILE_PATH_LITERAL("four_blue_green_checkers.png")),
977 ExactPixelComparator(true))); 988 ExactPixelComparator(true)));
978 } 989 }
979 #endif // !defined(OS_ANDROID) 990 #endif // !defined(OS_ANDROID)
980 991
981 } // namespace 992 } // namespace
982 } // namespace cc 993 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698