diff options
author | tomhudson <tomhudson@google.com> | 2015-12-04 06:34:16 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-12-04 14:35:16 +0000 |
commit | 828dddbb199eabef7cefe94a33bdd187470fef04 (patch) | |
tree | ac5823d9130d88f58ad635205c4d4ad9a0de9103 /skia | |
parent | 0c2a94ab87e6351b924a19932442e85a8f786fa0 (diff) | |
download | chromium_src-828dddbb199eabef7cefe94a33bdd187470fef04.zip chromium_src-828dddbb199eabef7cefe94a33bdd187470fef04.tar.gz chromium_src-828dddbb199eabef7cefe94a33bdd187470fef04.tar.bz2 |
We're getting rid of platform_device.h; most remaining users
were in printing and had no relation to PlatformDevice, but
just needed the Windows-specific InitializeDC() call. That call
doesn't make any use of Skia, so could move elsewhere, but
probably makes sense to leave in skia/ext/.
Also removed were some unnecessary #includes of this platform-
specific header.
BUG=543755
R=bungeman@chromium.org,thestig@chromium.org
TBR=sky@chromium.org
Review URL: https://codereview.chromium.org/1467403002
Cr-Commit-Position: refs/heads/master@{#363205}
Diffstat (limited to 'skia')
-rw-r--r-- | skia/ext/bitmap_platform_device_win.cc | 1 | ||||
-rw-r--r-- | skia/ext/platform_device.h | 6 | ||||
-rw-r--r-- | skia/ext/platform_device_win.cc | 39 | ||||
-rw-r--r-- | skia/ext/skia_utils_win.cc | 39 | ||||
-rw-r--r-- | skia/ext/skia_utils_win.h | 6 |
5 files changed, 46 insertions, 45 deletions
diff --git a/skia/ext/bitmap_platform_device_win.cc b/skia/ext/bitmap_platform_device_win.cc index 9cd3d70..f600b96 100644 --- a/skia/ext/bitmap_platform_device_win.cc +++ b/skia/ext/bitmap_platform_device_win.cc @@ -10,6 +10,7 @@ #include "base/win/win_util.h" #include "skia/ext/bitmap_platform_device_win.h" #include "skia/ext/platform_canvas.h" +#include "skia/ext/skia_utils_win.h" #include "third_party/skia/include/core/SkMatrix.h" #include "third_party/skia/include/core/SkRefCnt.h" #include "third_party/skia/include/core/SkRegion.h" diff --git a/skia/ext/platform_device.h b/skia/ext/platform_device.h index 5b718d2..628732b 100644 --- a/skia/ext/platform_device.h +++ b/skia/ext/platform_device.h @@ -38,12 +38,6 @@ SK_API void SetPlatformDevice(SkBaseDevice* device, PlatformDevice* platform_device); SK_API PlatformDevice* GetPlatformDevice(SkBaseDevice* device); - -#if defined(OS_WIN) -// Initializes the default settings and colors in a device context. -SK_API void InitializeDC(HDC context); -#endif - // A SkBitmapDevice is basically a wrapper around SkBitmap that provides a // surface for SkCanvas to draw into. PlatformDevice provides a surface // Windows can also write to. It also provides functionality to play well diff --git a/skia/ext/platform_device_win.cc b/skia/ext/platform_device_win.cc index 79b2c30..d1b37ef 100644 --- a/skia/ext/platform_device_win.cc +++ b/skia/ext/platform_device_win.cc @@ -11,45 +11,6 @@ namespace skia { -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); -} - PlatformSurface PlatformDevice::BeginPlatformPaint() { return 0; } diff --git a/skia/ext/skia_utils_win.cc b/skia/ext/skia_utils_win.cc index 3089b24..9873373 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 diff --git a/skia/ext/skia_utils_win.h b/skia/ext/skia_utils_win.h index 379cba12..b116efe 100644 --- a/skia/ext/skia_utils_win.h +++ b/skia/ext/skia_utils_win.h @@ -7,6 +7,9 @@ #include "third_party/skia/include/core/SkColor.h" +#include "build/build_config.h" +#include <windows.h> + struct SkIRect; struct SkPoint; struct SkRect; @@ -43,6 +46,9 @@ SK_API SkColor COLORREFToSkColor(COLORREF color); // Converts ARGB to COLORREFs (0BGR). SK_API COLORREF SkColorToCOLORREF(SkColor color); +// Initializes the default settings and colors in a device context. +SK_API void InitializeDC(HDC context); + } // namespace skia #endif // SKIA_EXT_SKIA_UTILS_WIN_H_ |