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 "base/win/scoped_gdi_object.h" | |
8 #include "third_party/skia/include/core/SkBitmap.h" | 9 #include "third_party/skia/include/core/SkBitmap.h" |
9 #include "third_party/skia/include/core/SkColor.h" | 10 #include "third_party/skia/include/core/SkColor.h" |
10 #include "third_party/skia/include/core/SkMatrix.h" | 11 #include "third_party/skia/include/core/SkMatrix.h" |
11 #include "third_party/skia/include/core/SkRefCnt.h" | 12 #include "third_party/skia/include/core/SkRefCnt.h" |
12 | 13 |
13 #include "build/build_config.h" | 14 #include "build/build_config.h" |
14 #include <windows.h> | 15 #include <windows.h> |
15 | 16 |
16 struct SkIRect; | 17 struct SkIRect; |
17 struct SkPoint; | 18 struct SkPoint; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
66 // Creates a surface writing to the pixels backing |context|'s bitmap. | 67 // Creates a surface writing to the pixels backing |context|'s bitmap. |
67 // Returns null on error. | 68 // Returns null on error. |
68 SK_API sk_sp<SkSurface> MapPlatformSurface(HDC context); | 69 SK_API sk_sp<SkSurface> MapPlatformSurface(HDC context); |
69 | 70 |
70 // Creates a bitmap backed by the same pixels backing the HDC's bitmap. | 71 // Creates a bitmap backed by the same pixels backing the HDC's bitmap. |
71 // Returns an empty bitmap on error. | 72 // Returns an empty bitmap on error. |
72 SK_API SkBitmap MapPlatformBitmap(HDC context); | 73 SK_API SkBitmap MapPlatformBitmap(HDC context); |
73 | 74 |
74 // Creates an offscreen HDC suitable for writing to via MapPlatformSurface(). | 75 // Creates an offscreen HDC suitable for writing to via MapPlatformSurface(). |
75 // Caller is responsible for calling DeleteDC() when done. | 76 // Caller is responsible for calling DeleteDC() when done. |
77 // The |bitmap| is a pointer to the ScopedBitmap instance that caller must | |
78 // provide so that the bitmap is deleted when returned HDC gets deleted. | |
76 // Will return null if any errors are encountered. | 79 // Will return null if any errors are encountered. |
77 // TODO(fmalita): consider returning ScopedCreateDC() when that type is | 80 // TODO(fmalita): consider returning ScopedCreateDC() when that type is |
78 // returnable (https://crbug.com/622442) | 81 // returnable (https://crbug.com/622442) |
79 SK_API HDC CreateOffscreenSurface(int width, int height); | 82 SK_API HDC CreateOffscreenSurface(base::win::ScopedBitmap* bitmap, |
Peter Kasting
2016/09/23 18:45:00
Nit: Outparam should go last.
| |
83 int width, | |
84 int height); | |
80 | 85 |
81 // Fills in a BITMAPINFOHEADER structure given the bitmap's size. | 86 // Fills in a BITMAPINFOHEADER structure given the bitmap's size. |
82 SK_API void CreateBitmapHeader(int width, int height, BITMAPINFOHEADER* hdr); | 87 SK_API void CreateBitmapHeader(int width, int height, BITMAPINFOHEADER* hdr); |
83 | 88 |
84 SK_API HBITMAP CreateHBitmap(int width, int height, bool is_opaque, | 89 SK_API HBITMAP CreateHBitmap(int width, int height, bool is_opaque, |
85 HANDLE shared_section = nullptr, | 90 HANDLE shared_section = nullptr, |
86 void** data = nullptr); | 91 void** data = nullptr); |
87 | 92 |
88 } // namespace skia | 93 } // namespace skia |
89 | 94 |
90 #endif // SKIA_EXT_SKIA_UTILS_WIN_H_ | 95 #endif // SKIA_EXT_SKIA_UTILS_WIN_H_ |
91 | 96 |
OLD | NEW |