Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(539)

Unified Diff: skia/ext/skia_utils_win.h

Issue 1492353002: Consolidate Windows bitmap and DC code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@move-printing-dc-from-device
Patch Set: remove !_WIN64 restriction on error reporting Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: skia/ext/skia_utils_win.h
diff --git a/skia/ext/skia_utils_win.h b/skia/ext/skia_utils_win.h
index b116efe19e2625cb896bcbd33f93d11e59266407..fb935866c50d376d40b795f910b66ad80da25f76 100644
--- a/skia/ext/skia_utils_win.h
+++ b/skia/ext/skia_utils_win.h
@@ -5,7 +5,9 @@
#ifndef SKIA_EXT_SKIA_UTILS_WIN_H_
#define SKIA_EXT_SKIA_UTILS_WIN_H_
+#include "third_party/skia/include/core/SkBitmap.h"
#include "third_party/skia/include/core/SkColor.h"
+#include "third_party/skia/include/core/SkRefCnt.h"
#include "build/build_config.h"
#include <windows.h>
@@ -13,6 +15,7 @@
struct SkIRect;
struct SkPoint;
struct SkRect;
+class SkSurface;
typedef unsigned long DWORD;
typedef DWORD COLORREF;
typedef struct tagPOINT POINT;
@@ -49,6 +52,21 @@ SK_API COLORREF SkColorToCOLORREF(SkColor color);
// Initializes the default settings and colors in a device context.
SK_API void InitializeDC(HDC context);
+// Creates a surface writing to the pixels backing the HDC's bitmap.
+// Returns nullptr on error.
+SK_API sk_sp<SkSurface> MapPlatformSurface(HDC context);
+
+// Creates a bitmap backed by the same pixels backing the HDC's bitmap.
+// Returns an empty bitmap on error.
+SK_API SkBitmap MapPlatformBitmap(HDC context);
+
+// Creates an offscreen HDC suitable for writing to via MapPlatformSurface().
+// Caller is responsible for calling DeleteDC() when done.
+SK_API HDC CreateOffscreenSurface(int width, int height);
+
+// Creates a BITMAPINFOHEADER structure given the bitmap's size.
+SK_API void CreateBitmapHeader(int width, int height, BITMAPINFOHEADER* hdr);
+
} // namespace skia
#endif // SKIA_EXT_SKIA_UTILS_WIN_H_
« no previous file with comments | « printing/emf_win.cc ('k') | skia/ext/skia_utils_win.cc » ('j') | skia/ext/skia_utils_win.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698