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 SKIA_EXT_SKIA_UTILS_WIN_H_ | 5 #ifndef SKIA_EXT_SKIA_UTILS_WIN_H_ |
6 #define SKIA_EXT_SKIA_UTILS_WIN_H_ | 6 #define SKIA_EXT_SKIA_UTILS_WIN_H_ |
7 | 7 |
| 8 #include "third_party/skia/include/core/SkBitmap.h" |
8 #include "third_party/skia/include/core/SkColor.h" | 9 #include "third_party/skia/include/core/SkColor.h" |
| 10 #include "third_party/skia/include/core/SkRefCnt.h" |
9 | 11 |
10 #include "build/build_config.h" | 12 #include "build/build_config.h" |
11 #include <windows.h> | 13 #include <windows.h> |
12 | 14 |
13 struct SkIRect; | 15 struct SkIRect; |
14 struct SkPoint; | 16 struct SkPoint; |
15 struct SkRect; | 17 struct SkRect; |
| 18 class SkSurface; |
16 typedef unsigned long DWORD; | 19 typedef unsigned long DWORD; |
17 typedef DWORD COLORREF; | 20 typedef DWORD COLORREF; |
18 typedef struct tagPOINT POINT; | 21 typedef struct tagPOINT POINT; |
19 typedef struct tagRECT RECT; | 22 typedef struct tagRECT RECT; |
20 | 23 |
21 namespace skia { | 24 namespace skia { |
22 | 25 |
23 // Converts a Skia point to a Windows POINT. | 26 // Converts a Skia point to a Windows POINT. |
24 POINT SkPointToPOINT(const SkPoint& point); | 27 POINT SkPointToPOINT(const SkPoint& point); |
25 | 28 |
(...skipping 16 matching lines...) Expand all Loading... |
42 | 45 |
43 // Converts COLORREFs (0BGR) to the ARGB layout Skia expects. | 46 // Converts COLORREFs (0BGR) to the ARGB layout Skia expects. |
44 SK_API SkColor COLORREFToSkColor(COLORREF color); | 47 SK_API SkColor COLORREFToSkColor(COLORREF color); |
45 | 48 |
46 // Converts ARGB to COLORREFs (0BGR). | 49 // Converts ARGB to COLORREFs (0BGR). |
47 SK_API COLORREF SkColorToCOLORREF(SkColor color); | 50 SK_API COLORREF SkColorToCOLORREF(SkColor color); |
48 | 51 |
49 // Initializes the default settings and colors in a device context. | 52 // Initializes the default settings and colors in a device context. |
50 SK_API void InitializeDC(HDC context); | 53 SK_API void InitializeDC(HDC context); |
51 | 54 |
| 55 // Creates a surface writing to the pixels backing the HDC's bitmap. |
| 56 // Returns nullptr on error. |
| 57 SK_API sk_sp<SkSurface> MapPlatformSurface(HDC context); |
| 58 |
| 59 // Creates a bitmap backed by the same pixels backing the HDC's bitmap. |
| 60 // Returns an empty bitmap on error. |
| 61 SK_API SkBitmap MapPlatformBitmap(HDC context); |
| 62 |
| 63 // Creates an offscreen HDC suitable for writing to via MapPlatformSurface(). |
| 64 // Caller is responsible for calling DeleteDC() when done. |
| 65 SK_API HDC CreateOffscreenSurface(int width, int height); |
| 66 |
| 67 // Fills in a BITMAPINFOHEADER structure given the bitmap's size. |
| 68 SK_API void CreateBitmapHeader(int width, int height, BITMAPINFOHEADER* hdr); |
| 69 |
52 } // namespace skia | 70 } // namespace skia |
53 | 71 |
54 #endif // SKIA_EXT_SKIA_UTILS_WIN_H_ | 72 #endif // SKIA_EXT_SKIA_UTILS_WIN_H_ |
55 | 73 |
OLD | NEW |