| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 UI_GFX_SKIA_UTIL_H_ | 5 #ifndef UI_GFX_SKIA_UTIL_H_ |
| 6 #define UI_GFX_SKIA_UTIL_H_ | 6 #define UI_GFX_SKIA_UTIL_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 // Creates a vertical gradient shader. The caller owns the shader. | 68 // Creates a vertical gradient shader. The caller owns the shader. |
| 69 // Example usage to avoid leaks: | 69 // Example usage to avoid leaks: |
| 70 GFX_EXPORT sk_sp<SkShader> CreateGradientShader(int start_point, | 70 GFX_EXPORT sk_sp<SkShader> CreateGradientShader(int start_point, |
| 71 int end_point, | 71 int end_point, |
| 72 SkColor start_color, | 72 SkColor start_color, |
| 73 SkColor end_color); | 73 SkColor end_color); |
| 74 | 74 |
| 75 // Creates a draw looper to generate |shadows|. The caller owns the draw looper. | 75 // Creates a draw looper to generate |shadows|. The caller owns the draw looper. |
| 76 // NULL is returned if |shadows| is empty since no draw looper is needed in | 76 // NULL is returned if |shadows| is empty since no draw looper is needed in |
| 77 // this case. | 77 // this case. |
| 78 // DEPRECATED: See below. TODO(estade): remove this: crbug.com/624175 |
| 78 GFX_EXPORT sk_sp<SkDrawLooper> CreateShadowDrawLooper( | 79 GFX_EXPORT sk_sp<SkDrawLooper> CreateShadowDrawLooper( |
| 79 const std::vector<ShadowValue>& shadows); | 80 const std::vector<ShadowValue>& shadows); |
| 80 | 81 |
| 82 // Creates a draw looper to generate |shadows|. This creates a looper with the |
| 83 // correct amount of blur. Callers of the existing CreateShadowDrawLooper may |
| 84 // rely on the wrong amount of blur being applied but new code should use this |
| 85 // function. |
| 86 GFX_EXPORT sk_sp<SkDrawLooper> CreateShadowDrawLooperCorrectBlur( |
| 87 const std::vector<ShadowValue>& shadows); |
| 88 |
| 81 // Returns true if the two bitmaps contain the same pixels. | 89 // Returns true if the two bitmaps contain the same pixels. |
| 82 GFX_EXPORT bool BitmapsAreEqual(const SkBitmap& bitmap1, | 90 GFX_EXPORT bool BitmapsAreEqual(const SkBitmap& bitmap1, |
| 83 const SkBitmap& bitmap2); | 91 const SkBitmap& bitmap2); |
| 84 | 92 |
| 85 // Converts Skia ARGB format pixels in |skia| to RGBA. | 93 // Converts Skia ARGB format pixels in |skia| to RGBA. |
| 86 GFX_EXPORT void ConvertSkiaToRGBA(const unsigned char* skia, | 94 GFX_EXPORT void ConvertSkiaToRGBA(const unsigned char* skia, |
| 87 int pixel_width, | 95 int pixel_width, |
| 88 unsigned char* rgba); | 96 unsigned char* rgba); |
| 89 | 97 |
| 90 // Converts a Skia floating-point value to an int appropriate for hb_position_t. | 98 // Converts a Skia floating-point value to an int appropriate for hb_position_t. |
| 91 GFX_EXPORT int SkiaScalarToHarfBuzzUnits(SkScalar value); | 99 GFX_EXPORT int SkiaScalarToHarfBuzzUnits(SkScalar value); |
| 92 | 100 |
| 93 // Converts an hb_position_t to a Skia floating-point value. | 101 // Converts an hb_position_t to a Skia floating-point value. |
| 94 GFX_EXPORT SkScalar HarfBuzzUnitsToSkiaScalar(int value); | 102 GFX_EXPORT SkScalar HarfBuzzUnitsToSkiaScalar(int value); |
| 95 | 103 |
| 96 // Converts an hb_position_t to a float. | 104 // Converts an hb_position_t to a float. |
| 97 GFX_EXPORT float HarfBuzzUnitsToFloat(int value); | 105 GFX_EXPORT float HarfBuzzUnitsToFloat(int value); |
| 98 | 106 |
| 99 } // namespace gfx | 107 } // namespace gfx |
| 100 | 108 |
| 101 #endif // UI_GFX_SKIA_UTIL_H_ | 109 #endif // UI_GFX_SKIA_UTIL_H_ |
| OLD | NEW |