| 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 29 matching lines...) Expand all Loading... |
| 40 // the correct scale factor. | 40 // the correct scale factor. |
| 41 // The shader's local matrix should not be changed after the shader is created. | 41 // The shader's local matrix should not be changed after the shader is created. |
| 42 // TODO(pkotwicz): Allow shader's local matrix to be changed after the shader | 42 // TODO(pkotwicz): Allow shader's local matrix to be changed after the shader |
| 43 // is created. | 43 // is created. |
| 44 // | 44 // |
| 45 GFX_EXPORT skia::RefPtr<SkShader> CreateImageRepShader( | 45 GFX_EXPORT skia::RefPtr<SkShader> CreateImageRepShader( |
| 46 const gfx::ImageSkiaRep& image_rep, | 46 const gfx::ImageSkiaRep& image_rep, |
| 47 SkShader::TileMode tile_mode, | 47 SkShader::TileMode tile_mode, |
| 48 const SkMatrix& local_matrix); | 48 const SkMatrix& local_matrix); |
| 49 | 49 |
| 50 // Creates a bitmap shader for the image rep with the passed in scale factor. |
| 51 GFX_EXPORT skia::RefPtr<SkShader> CreateImageRepShaderForScale( |
| 52 const gfx::ImageSkiaRep& image_rep, |
| 53 SkShader::TileMode tile_mode, |
| 54 const SkMatrix& local_matrix, |
| 55 SkScalar scale); |
| 56 |
| 50 // Creates a vertical gradient shader. The caller owns the shader. | 57 // Creates a vertical gradient shader. The caller owns the shader. |
| 51 // Example usage to avoid leaks: | 58 // Example usage to avoid leaks: |
| 52 GFX_EXPORT skia::RefPtr<SkShader> CreateGradientShader(int start_point, | 59 GFX_EXPORT skia::RefPtr<SkShader> CreateGradientShader(int start_point, |
| 53 int end_point, | 60 int end_point, |
| 54 SkColor start_color, | 61 SkColor start_color, |
| 55 SkColor end_color); | 62 SkColor end_color); |
| 56 | 63 |
| 57 // Creates a draw looper to generate |shadows|. The caller owns the draw looper. | 64 // Creates a draw looper to generate |shadows|. The caller owns the draw looper. |
| 58 // NULL is returned if |shadows| is empty since no draw looper is needed in | 65 // NULL is returned if |shadows| is empty since no draw looper is needed in |
| 59 // this case. | 66 // this case. |
| 60 GFX_EXPORT skia::RefPtr<SkDrawLooper> CreateShadowDrawLooper( | 67 GFX_EXPORT skia::RefPtr<SkDrawLooper> CreateShadowDrawLooper( |
| 61 const std::vector<ShadowValue>& shadows); | 68 const std::vector<ShadowValue>& shadows); |
| 62 | 69 |
| 63 // Returns true if the two bitmaps contain the same pixels. | 70 // Returns true if the two bitmaps contain the same pixels. |
| 64 GFX_EXPORT bool BitmapsAreEqual(const SkBitmap& bitmap1, | 71 GFX_EXPORT bool BitmapsAreEqual(const SkBitmap& bitmap1, |
| 65 const SkBitmap& bitmap2); | 72 const SkBitmap& bitmap2); |
| 66 | 73 |
| 67 // Converts Skia ARGB format pixels in |skia| to RGBA. | 74 // Converts Skia ARGB format pixels in |skia| to RGBA. |
| 68 GFX_EXPORT void ConvertSkiaToRGBA(const unsigned char* skia, | 75 GFX_EXPORT void ConvertSkiaToRGBA(const unsigned char* skia, |
| 69 int pixel_width, | 76 int pixel_width, |
| 70 unsigned char* rgba); | 77 unsigned char* rgba); |
| 71 | 78 |
| 72 } // namespace gfx | 79 } // namespace gfx |
| 73 | 80 |
| 74 #endif // UI_GFX_SKIA_UTIL_H_ | 81 #endif // UI_GFX_SKIA_UTIL_H_ |
| OLD | NEW |