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

Side by Side Diff: cc/tiles/tile_manager_unittest.cc

Issue 1721403002: Scale test Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 | « no previous file | 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 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 <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "base/thread_task_runner_handle.h" 9 #include "base/thread_task_runner_handle.h"
10 #include "cc/playback/display_list_raster_source.h" 10 #include "cc/playback/display_list_raster_source.h"
(...skipping 1942 matching lines...) Expand 10 before | Expand all | Expand 10 after
1953 true /* partial_raster_enabled */); 1953 true /* partial_raster_enabled */);
1954 } 1954 }
1955 1955
1956 // Ensures that the tile manager does not attempt to reuse tiles when partial 1956 // Ensures that the tile manager does not attempt to reuse tiles when partial
1957 // raster is disabled. 1957 // raster is disabled.
1958 TEST_F(TileManagerTest, PartialRasterSuccessfullyDisabled) { 1958 TEST_F(TileManagerTest, PartialRasterSuccessfullyDisabled) {
1959 RunPartialRasterCheck(std::move(host_impl_), 1959 RunPartialRasterCheck(std::move(host_impl_),
1960 false /* partial_raster_enabled */); 1960 false /* partial_raster_enabled */);
1961 } 1961 }
1962 1962
1963 #define PRECISION (15)
1964 void TestScale(float lw, float lh, float s) {
1965 long slw = std::lround(lw * s);
1966 long slh = std::lround(lh * s);
1967
1968 std::cout << "\nGiven Scale = " << std::setprecision(PRECISION) << s;
1969 std::cout << "\nLayer Size = " << lw << " x " << lh;
1970 std::cout << "\nScaled Layer Size = " << std::setprecision(PRECISION)
1971 << (lw * s) << " x " << std::setprecision(PRECISION) << (lh * s);
1972 std::cout << "\nRounded Scaled Layer Size = " << slw << " x " << slh;
1973 std::cout << "\nApproximated Scale [sx, sy] = ["
1974 << std::setprecision(PRECISION) << (slw / lw) << ", "
1975 << std::setprecision(PRECISION) << (slh / lh) << "] <====";
1976
1977 std::cout << "\n\n";
1978 }
1979
1980 TEST_F(TileManagerTest, ScaleTestSmallLayerSize) {
1981 // Almost equal scales.
1982 float scale1 = 7.33907556533813f;
1983 float scale2 = 7.33907508850098f;
1984 TestScale(501.f, 502.f, scale1);
1985 TestScale(501.f, 502.f, scale2);
1986 }
1987
1988 TEST_F(TileManagerTest, ScaleTestVeryBigLayerSize) {
1989 // Almost equal scales.
1990 float scale1 = 7.33907556533813f;
1991 float scale2 = 7.33907508850098f;
1992 TestScale(5010000.f, 5020000.f, scale1);
1993 TestScale(5010000.f, 5020000.f, scale2);
1994 }
1995
1963 } // namespace 1996 } // namespace
1964 } // namespace cc 1997 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698