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 "base/string16.h" | 11 #include "base/string16.h" |
12 #include "third_party/skia/include/core/SkColor.h" | 12 #include "third_party/skia/include/core/SkColor.h" |
13 #include "third_party/skia/include/core/SkRect.h" | 13 #include "third_party/skia/include/core/SkRect.h" |
14 #include "ui/base/ui_export.h" | 14 #include "ui/base/ui_export.h" |
15 | 15 |
16 class SkBitmap; | 16 class SkBitmap; |
17 class SkShader; | 17 class SkShader; |
18 | 18 |
19 namespace gfx { | 19 namespace gfx { |
20 | 20 |
21 class Rect; | 21 class Rect; |
22 | 22 |
23 // Convert between Skia and gfx rect types. | 23 // Convert between Skia and gfx rect types. |
24 UI_EXPORT SkRect RectToSkRect(const gfx::Rect& rect); | 24 UI_EXPORT SkRect RectToSkRect(const gfx::Rect& rect); |
25 UI_EXPORT SkIRect RectToSkIRect(const gfx::Rect& rect); | |
26 UI_EXPORT gfx::Rect SkRectToRect(const SkRect& rect); | 25 UI_EXPORT gfx::Rect SkRectToRect(const SkRect& rect); |
27 | 26 |
28 // Creates a vertical gradient shader. The caller owns the shader. | 27 // Creates a vertical gradient shader. The caller owns the shader. |
29 // Example usage to avoid leaks: | 28 // Example usage to avoid leaks: |
30 // SkSafeUnref(paint.setShader(gfx::CreateGradientShader(0, 10, red, blue))); | 29 // SkSafeUnref(paint.setShader(gfx::CreateGradientShader(0, 10, red, blue))); |
31 // | 30 // |
32 // (The old shader in the paint, if any, needs to be freed, and SkSafeUnref will | 31 // (The old shader in the paint, if any, needs to be freed, and SkSafeUnref will |
33 // handle the NULL case.) | 32 // handle the NULL case.) |
34 UI_EXPORT SkShader* CreateGradientShader(int start_point, | 33 UI_EXPORT SkShader* CreateGradientShader(int start_point, |
35 int end_point, | 34 int end_point, |
(...skipping 10 matching lines...) Expand all Loading... |
46 // and span of the last accelerated character, respectively, or -1 and 0 if | 45 // and span of the last accelerated character, respectively, or -1 and 0 if |
47 // there was none. | 46 // there was none. |
48 UI_EXPORT string16 RemoveAcceleratorChar(const string16& s, | 47 UI_EXPORT string16 RemoveAcceleratorChar(const string16& s, |
49 char16 accelerator_char, | 48 char16 accelerator_char, |
50 int* accelerated_char_pos, | 49 int* accelerated_char_pos, |
51 int* accelerated_char_span); | 50 int* accelerated_char_span); |
52 | 51 |
53 } // namespace gfx | 52 } // namespace gfx |
54 | 53 |
55 #endif // UI_GFX_SKIA_UTIL_H_ | 54 #endif // UI_GFX_SKIA_UTIL_H_ |
OLD | NEW |