0

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}
This commit is contained in:
tomhudson
2015-12-04 06:34:16 -08:00
committed by Commit bot
parent 0c2a94ab87
commit 828dddbb19
12 changed files with 59 additions and 53 deletions

@ -11,7 +11,7 @@
#include "base/win/scoped_gdi_object.h"
#include "base/win/scoped_hdc.h"
#include "base/win/scoped_select_object.h"
#include "skia/ext/platform_device.h"
#include "skia/ext/skia_utils_win.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/gfx/codec/jpeg_codec.h"
#include "ui/gfx/codec/png_codec.h"

@ -8,7 +8,7 @@
#include "base/win/scoped_hdc.h"
#include "base/win/scoped_select_object.h"
#include "printing/metafile.h"
#include "skia/ext/platform_device.h"
#include "skia/ext/skia_utils_win.h"
#include "ui/gfx/gdi_util.h" // EMF support
#include "ui/gfx/geometry/rect.h"

@ -9,7 +9,7 @@
#include "printing/printed_pages_source.h"
#include "printing/printed_page.h"
#include "printing/units.h"
#include "skia/ext/platform_device.h"
#include "skia/ext/skia_utils_win.h"
namespace {

@ -8,7 +8,7 @@
#include "base/message_loop/message_loop.h"
#include "printing/backend/win_helper.h"
#include "printing/print_settings_initializer_win.h"
#include "skia/ext/platform_device.h"
#include "skia/ext/skia_utils_win.h"
namespace printing {

@ -16,7 +16,7 @@
#include "printing/printing_context_system_dialog_win.h"
#include "printing/printing_utils.h"
#include "printing/units.h"
#include "skia/ext/platform_device.h"
#include "skia/ext/skia_utils_win.h"
#include "ui/aura/remote_window_tree_host_win.h"
#include "ui/aura/window.h"

@ -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"

@ -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

@ -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;
}

@ -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

@ -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_

@ -5,13 +5,15 @@
#include "ui/views/background.h"
#include "base/logging.h"
#include "skia/ext/skia_utils_win.h"
#include "third_party/skia/include/core/SkPaint.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/color_utils.h"
#include "ui/views/painter.h"
#include "ui/views/view.h"
#if defined(OS_WIN)
#include "skia/ext/skia_utils_win.h"
#endif
namespace views {
// SolidBackground is a trivial Background implementation that fills the

@ -4,7 +4,6 @@
#include "ui/views/controls/single_split_view.h"
#include "skia/ext/skia_utils_win.h"
#include "ui/accessibility/ax_view_state.h"
#include "ui/base/cursor/cursor.h"
#include "ui/gfx/canvas.h"
@ -12,6 +11,10 @@
#include "ui/views/controls/single_split_view_listener.h"
#include "ui/views/native_cursor.h"
#if defined(OS_WIN)
#include "skia/ext/skia_utils_win.h"
#endif
namespace views {
// static