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 <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 Loading... |
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 |
OLD | NEW |