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

Unified Diff: skia/ext/skia_utils_win.cc

Issue 1467403002: Move Windows DC-initialization to skia_utils_win.h (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@move-metafile-from-device
Patch Set: Rebase again Created 5 years, 1 month 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
« no previous file with comments | « skia/ext/skia_utils_win.h ('k') | ui/views/background.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: skia/ext/skia_utils_win.cc
diff --git a/skia/ext/skia_utils_win.cc b/skia/ext/skia_utils_win.cc
index 3089b242c2626febb0a485c5dd8ff50c138c558b..9873373725705fe6f8e4491a54ebd56916829276 100644
--- a/skia/ext/skia_utils_win.cc
+++ b/skia/ext/skia_utils_win.cc
@@ -58,5 +58,44 @@ COLORREF SkColorToCOLORREF(SkColor color) {
#endif
}
+void InitializeDC(HDC context) {
+ // Enables world transformation.
+ // If the GM_ADVANCED graphics mode is set, GDI always draws arcs in the
+ // counterclockwise direction in logical space. This is equivalent to the
+ // statement that, in the GM_ADVANCED graphics mode, both arc control points
+ // and arcs themselves fully respect the device context's world-to-device
+ // transformation.
+ BOOL res = SetGraphicsMode(context, GM_ADVANCED);
+ SkASSERT(res != 0);
+
+ // Enables dithering.
+ res = SetStretchBltMode(context, HALFTONE);
+ SkASSERT(res != 0);
+ // As per SetStretchBltMode() documentation, SetBrushOrgEx() must be called
+ // right after.
+ res = SetBrushOrgEx(context, 0, 0, NULL);
+ SkASSERT(res != 0);
+
+ // Sets up default orientation.
+ res = SetArcDirection(context, AD_CLOCKWISE);
+ SkASSERT(res != 0);
+
+ // Sets up default colors.
+ res = SetBkColor(context, RGB(255, 255, 255));
+ SkASSERT(res != CLR_INVALID);
+ res = SetTextColor(context, RGB(0, 0, 0));
+ SkASSERT(res != CLR_INVALID);
+ res = SetDCBrushColor(context, RGB(255, 255, 255));
+ SkASSERT(res != CLR_INVALID);
+ res = SetDCPenColor(context, RGB(0, 0, 0));
+ SkASSERT(res != CLR_INVALID);
+
+ // Sets up default transparency.
+ res = SetBkMode(context, OPAQUE);
+ SkASSERT(res != 0);
+ res = SetROP2(context, R2_COPYPEN);
+ SkASSERT(res != 0);
+}
+
} // namespace skia
« no previous file with comments | « skia/ext/skia_utils_win.h ('k') | ui/views/background.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698