OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #ifndef APP_GFX_SKBITMAP_OPERATIONS_H_ | 5 #ifndef APP_GFX_SKBITMAP_OPERATIONS_H_ |
6 #define APP_GFX_SKBITMAP_OPERATIONS_H_ | 6 #define APP_GFX_SKBITMAP_OPERATIONS_H_ |
7 | 7 |
8 #include "gfx/color_utils.h" | 8 #include "gfx/color_utils.h" |
9 #include "testing/gtest/include/gtest/gtest_prod.h" | 9 #include "testing/gtest/include/gtest/gtest_prod.h" |
10 | 10 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 int dst_w, int dst_h); | 71 int dst_w, int dst_h); |
72 | 72 |
73 // Iteratively downsamples by 2 until the bitmap is no smaller than the | 73 // Iteratively downsamples by 2 until the bitmap is no smaller than the |
74 // input size. The normal use of this is to downsample the bitmap "close" to | 74 // input size. The normal use of this is to downsample the bitmap "close" to |
75 // the final size, and then use traditional resampling on the result. | 75 // the final size, and then use traditional resampling on the result. |
76 // Because the bitmap will be closer to the final size, it will be faster, | 76 // Because the bitmap will be closer to the final size, it will be faster, |
77 // and linear interpolation will generally work well as a second step. | 77 // and linear interpolation will generally work well as a second step. |
78 static SkBitmap DownsampleByTwoUntilSize(const SkBitmap& bitmap, | 78 static SkBitmap DownsampleByTwoUntilSize(const SkBitmap& bitmap, |
79 int min_w, int min_h); | 79 int min_w, int min_h); |
80 | 80 |
81 private: | |
82 SkBitmapOperations(); // Class for scoping only. | |
83 | |
84 // Makes a bitmap half has large in each direction by averaging groups of | 81 // Makes a bitmap half has large in each direction by averaging groups of |
85 // 4 pixels. This is one step in generating a mipmap. | 82 // 4 pixels. This is one step in generating a mipmap. |
86 static SkBitmap DownsampleByTwo(const SkBitmap& bitmap); | 83 static SkBitmap DownsampleByTwo(const SkBitmap& bitmap); |
| 84 private: |
| 85 SkBitmapOperations(); // Class for scoping only. |
87 | 86 |
88 FRIEND_TEST(SkBitmapOperationsTest, DownsampleByTwo); | 87 FRIEND_TEST(SkBitmapOperationsTest, DownsampleByTwo); |
89 FRIEND_TEST(SkBitmapOperationsTest, DownsampleByTwoSmall); | 88 FRIEND_TEST(SkBitmapOperationsTest, DownsampleByTwoSmall); |
90 }; | 89 }; |
91 | 90 |
92 #endif // APP_GFX_SKBITMAP_OPERATIONS_H_ | 91 #endif // APP_GFX_SKBITMAP_OPERATIONS_H_ |
93 | |
OLD | NEW |