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