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

Side by Side Diff: cc/trees/layer_tree_host_pixeltest_scrollbars.cc

Issue 2276633003: Move scaling of ui resources for scrollbars to the time of upload (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@scrollbarpixeltests
Patch Set: uploadscale: fixmath Created 4 years, 3 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/trees/layer_tree_host_impl.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 #include "cc/input/scrollbar.h" 9 #include "cc/input/scrollbar.h"
10 #include "cc/layers/painted_scrollbar_layer.h" 10 #include "cc/layers/painted_scrollbar_layer.h"
11 #include "cc/layers/solid_color_layer.h" 11 #include "cc/layers/solid_color_layer.h"
12 #include "cc/test/layer_tree_pixel_test.h" 12 #include "cc/test/layer_tree_pixel_test.h"
13 #include "cc/test/pixel_comparator.h"
13 #include "cc/test/test_in_process_context_provider.h" 14 #include "cc/test/test_in_process_context_provider.h"
14 #include "gpu/command_buffer/client/gles2_interface.h" 15 #include "gpu/command_buffer/client/gles2_interface.h"
15 16
16 #if !defined(OS_ANDROID) 17 #if !defined(OS_ANDROID)
17 18
18 namespace cc { 19 namespace cc {
19 namespace { 20 namespace {
20 21
21 class LayerTreeHostScrollbarsPixelTest : public LayerTreePixelTest { 22 class LayerTreeHostScrollbarsPixelTest : public LayerTreePixelTest {
22 protected: 23 protected:
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 157
157 // Let's show the bottom right of the layer, so we know the texture wasn't 158 // Let's show the bottom right of the layer, so we know the texture wasn't
158 // just cut off. 159 // just cut off.
159 layer->SetPosition( 160 layer->SetPosition(
160 gfx::PointF(-10.f * scale + 400.f, -400.f * scale + 400.f)); 161 gfx::PointF(-10.f * scale + 400.f, -400.f * scale + 400.f));
161 162
162 gfx::Transform scale_transform; 163 gfx::Transform scale_transform;
163 scale_transform.Scale(scale, scale); 164 scale_transform.Scale(scale, scale);
164 layer->SetTransform(scale_transform); 165 layer->SetTransform(scale_transform);
165 166
167 // The inner edge is antialiased and gets off-by-one differences.
168 float percentage_pixels_large_error = 0.42f;
169 float percentage_pixels_small_error = 0.f;
170 float average_error_allowed_in_bad_pixels = 1.f;
171 int large_error_allowed = 1;
172 int small_error_allowed = 0;
173 pixel_comparator_.reset(new FuzzyPixelComparator(
174 true, // discard_alpha
175 percentage_pixels_large_error, percentage_pixels_small_error,
176 average_error_allowed_in_bad_pixels, large_error_allowed,
177 small_error_allowed));
178
166 RunPixelTest(PIXEL_TEST_GL, background, 179 RunPixelTest(PIXEL_TEST_GL, background,
167 base::FilePath(FILE_PATH_LITERAL("spiral_64_scale.png"))); 180 base::FilePath(FILE_PATH_LITERAL("spiral_64_scale.png")));
168 } 181 }
169 182
170 } // namespace 183 } // namespace
171 } // namespace cc 184 } // namespace cc
172 185
173 #endif // OS_ANDROID 186 #endif // OS_ANDROID
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698