| 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 GFX_SKBITMAP_OPERATIONS_H_ | 5 #ifndef GFX_SKBITMAP_OPERATIONS_H_ |
| 6 #define GFX_SKBITMAP_OPERATIONS_H_ | 6 #define 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 // 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 |
| 82 // 4 pixels. This is one step in generating a mipmap. | 82 // 4 pixels. This is one step in generating a mipmap. |
| 83 static SkBitmap DownsampleByTwo(const SkBitmap& bitmap); | 83 static SkBitmap DownsampleByTwo(const SkBitmap& bitmap); |
| 84 | 84 |
| 85 // Unpremultiplies all pixels in |bitmap|. You almost never want to call |
| 86 // this, as |SkBitmap|s are always premultiplied by conversion. Call this |
| 87 // only if you will pass the bitmap's data into a system function that |
| 88 // doesn't expect premultiplied colors. |
| 89 static SkBitmap UnPreMultiply(const SkBitmap& bitmap); |
| 90 |
| 85 private: | 91 private: |
| 86 SkBitmapOperations(); // Class for scoping only. | 92 SkBitmapOperations(); // Class for scoping only. |
| 87 | 93 |
| 88 FRIEND_TEST(SkBitmapOperationsTest, DownsampleByTwo); | 94 FRIEND_TEST(SkBitmapOperationsTest, DownsampleByTwo); |
| 89 FRIEND_TEST(SkBitmapOperationsTest, DownsampleByTwoSmall); | 95 FRIEND_TEST(SkBitmapOperationsTest, DownsampleByTwoSmall); |
| 90 }; | 96 }; |
| 91 | 97 |
| 92 #endif // GFX_SKBITMAP_OPERATIONS_H_ | 98 #endif // GFX_SKBITMAP_OPERATIONS_H_ |
| OLD | NEW |