OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "third_party/skia/include/core/SkColor.h" | 11 #include "third_party/skia/include/core/SkColor.h" |
12 #include "third_party/skia/include/core/SkRect.h" | 12 #include "third_party/skia/include/core/SkRect.h" |
| 13 #include "ui/ui_api.h" |
13 | 14 |
14 class SkBitmap; | 15 class SkBitmap; |
15 class SkShader; | 16 class SkShader; |
16 | 17 |
17 namespace gfx { | 18 namespace gfx { |
18 | 19 |
19 class Rect; | 20 class Rect; |
20 | 21 |
21 // Convert between Skia and gfx rect types. | 22 // Convert between Skia and gfx rect types. |
22 SkRect RectToSkRect(const gfx::Rect& rect); | 23 UI_API SkRect RectToSkRect(const gfx::Rect& rect); |
23 gfx::Rect SkRectToRect(const SkRect& rect); | 24 UI_API gfx::Rect SkRectToRect(const SkRect& rect); |
24 | 25 |
25 // Creates a vertical gradient shader. The caller owns the shader. | 26 // Creates a vertical gradient shader. The caller owns the shader. |
26 // Example usage to avoid leaks: | 27 // Example usage to avoid leaks: |
27 // SkSafeUnref(paint.setShader(gfx::CreateGradientShader(0, 10, red, blue))); | 28 // SkSafeUnref(paint.setShader(gfx::CreateGradientShader(0, 10, red, blue))); |
28 // | 29 // |
29 // (The old shader in the paint, if any, needs to be freed, and SkSafeUnref will | 30 // (The old shader in the paint, if any, needs to be freed, and SkSafeUnref will |
30 // handle the NULL case.) | 31 // handle the NULL case.) |
31 SkShader* CreateGradientShader(int start_point, | 32 UI_API SkShader* CreateGradientShader(int start_point, |
32 int end_point, | 33 int end_point, |
33 SkColor start_color, | 34 SkColor start_color, |
34 SkColor end_color); | 35 SkColor end_color); |
35 | 36 |
36 // Returns true if the two bitmaps contain the same pixels. | 37 // Returns true if the two bitmaps contain the same pixels. |
37 bool BitmapsAreEqual(const SkBitmap& bitmap1, const SkBitmap& bitmap2); | 38 UI_API bool BitmapsAreEqual(const SkBitmap& bitmap1, const SkBitmap& bitmap2); |
38 | 39 |
39 // Strip the accelerator char (typically '&') from a menu string. A | 40 // Strip the accelerator char (typically '&') from a menu string. A |
40 // double accelerator char ('&&') will be converted to a single char. | 41 // double accelerator char ('&&') will be converted to a single char. |
41 std::string RemoveAcceleratorChar(const std::string& s, char accelerator_char); | 42 UI_API std::string RemoveAcceleratorChar(const std::string& s, |
| 43 char accelerator_char); |
42 | 44 |
43 } // namespace gfx; | 45 } // namespace gfx; |
44 | 46 |
45 #endif // UI_GFX_SKIA_UTIL_H_ | 47 #endif // UI_GFX_SKIA_UTIL_H_ |
OLD | NEW |