OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 BASE_GFX_SKIA_UTILS_H__ | 5 // This file contains cross-platform Skia helper routines. |
6 #define BASE_GFX_SKIA_UTILS_H__ | |
7 | 6 |
8 #include "SkColor.h" | 7 #ifndef SKIA_EXT_SKIA_UTILS_H_ |
| 8 #define SKIA_EXT_SKIA_UTILS_H_ |
| 9 |
9 #include "SkShader.h" | 10 #include "SkShader.h" |
10 | 11 |
11 struct SkIRect; | 12 namespace skia { |
12 struct SkPoint; | |
13 struct SkRect; | |
14 typedef unsigned long DWORD; | |
15 typedef DWORD COLORREF; | |
16 typedef struct tagPOINT POINT; | |
17 typedef struct tagRECT RECT; | |
18 | |
19 namespace gfx { | |
20 | |
21 // Converts a Skia point to a Windows POINT. | |
22 POINT SkPointToPOINT(const SkPoint& point); | |
23 | |
24 // Converts a Windows RECT to a Skia rect. | |
25 SkRect RECTToSkRect(const RECT& rect); | |
26 | |
27 // Converts a Windows RECT to a Skia rect. | |
28 // Both use same in-memory format. Verified by COMPILE_ASSERT() in | |
29 // skia_utils.cc. | |
30 inline const SkIRect& RECTToSkIRect(const RECT& rect) { | |
31 return reinterpret_cast<const SkIRect&>(rect); | |
32 } | |
33 | |
34 // Converts a Skia rect to a Windows RECT. | |
35 // Both use same in-memory format. Verified by COMPILE_ASSERT() in | |
36 // skia_utils.cc. | |
37 inline const RECT& SkIRectToRECT(const SkIRect& rect) { | |
38 return reinterpret_cast<const RECT&>(rect); | |
39 } | |
40 | 13 |
41 // Creates a vertical gradient shader. The caller owns the shader. | 14 // Creates a vertical gradient shader. The caller owns the shader. |
42 SkShader* CreateGradientShader(int start_point, | 15 SkShader* CreateGradientShader(int start_point, |
43 int end_point, | 16 int end_point, |
44 SkColor start_color, | 17 SkColor start_color, |
45 SkColor end_color); | 18 SkColor end_color); |
46 | 19 |
47 // Converts COLORREFs (0BGR) to the ARGB layout Skia expects. | 20 } // namespace skia |
48 SkColor COLORREFToSkColor(COLORREF color); | |
49 | 21 |
50 // Converts ARGB to COLORREFs (0BGR). | 22 #endif // SKIA_EXT_SKIA_UTILS_H_ |
51 COLORREF SkColorToCOLORREF(SkColor color); | |
52 | 23 |
53 } // namespace gfx | |
54 | |
55 #endif | |
56 | |
OLD | NEW |