From 095d346ff71ebe0385dfe7fa77baad6a1ce91fcb Mon Sep 17 00:00:00 2001 From: weili Date: Tue, 21 Jun 2016 11:24:24 -0700 Subject: Move ifx_renderdevicedriver to a separate file to share Move ifx_renderdevicedriver class to its own file to share with multiple devices to reduce code duplication. Review-Url: https://codereview.chromium.org/2078783002 --- core/fxge/apple/apple_int.h | 5 +++-- core/fxge/apple/fx_quartz_device.cpp | 20 ++++++++------------ 2 files changed, 11 insertions(+), 14 deletions(-) (limited to 'core/fxge/apple') diff --git a/core/fxge/apple/apple_int.h b/core/fxge/apple/apple_int.h index c19282b12b..0462938d5a 100644 --- a/core/fxge/apple/apple_int.h +++ b/core/fxge/apple/apple_int.h @@ -11,7 +11,8 @@ #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ -#include "core/fxge/include/fx_ge.h" +#include "core/fxge/include/fx_dib.h" +#include "core/fxge/include/ifx_renderdevicedriver.h" #if _FX_OS_ == _FX_MACOSX_ #include @@ -85,7 +86,7 @@ class CFX_QuartzDeviceDriver : public IFX_RenderDeviceDriver { ~CFX_QuartzDeviceDriver() override; // IFX_RenderDeviceDriver - int GetDeviceCaps(int caps_id) override; + int GetDeviceCaps(int caps_id) const override; CFX_Matrix GetCTM() const override; void SaveState() override; void RestoreState(bool bKeepSaved) override; diff --git a/core/fxge/apple/fx_quartz_device.cpp b/core/fxge/apple/fx_quartz_device.cpp index 8adf6326c1..b3591a3da1 100644 --- a/core/fxge/apple/fx_quartz_device.cpp +++ b/core/fxge/apple/fx_quartz_device.cpp @@ -190,24 +190,20 @@ CFX_QuartzDeviceDriver::~CFX_QuartzDeviceDriver() { CGContextRelease(m_context); } } -int CFX_QuartzDeviceDriver::GetDeviceCaps(int capsID) { +int CFX_QuartzDeviceDriver::GetDeviceCaps(int capsID) const { switch (capsID) { - case FXDC_DEVICE_CLASS: { + case FXDC_DEVICE_CLASS: return m_deviceClass; - } - case FXDC_PIXEL_WIDTH: { + case FXDC_PIXEL_WIDTH: return m_width; - } - case FXDC_PIXEL_HEIGHT: { + case FXDC_PIXEL_HEIGHT: return m_height; - } - case FXDC_BITS_PIXEL: { + case FXDC_BITS_PIXEL: return 32; - } - case FXDC_RENDER_CAPS: { + case FXDC_RENDER_CAPS: return m_renderCaps; - } - default: { return 0; } + default: + return 0; } } CFX_Matrix CFX_QuartzDeviceDriver::GetCTM() const { -- cgit v1.2.3