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/agg/fx_agg_driver.cpp | 94 +---------------------------------------- core/fxge/agg/fx_agg_driver.h | 5 ++- 2 files changed, 5 insertions(+), 94 deletions(-) (limited to 'core/fxge/agg') diff --git a/core/fxge/agg/fx_agg_driver.cpp b/core/fxge/agg/fx_agg_driver.cpp index f5d7cbbf4c..814cf0ec26 100644 --- a/core/fxge/agg/fx_agg_driver.cpp +++ b/core/fxge/agg/fx_agg_driver.cpp @@ -12,6 +12,7 @@ #include "core/fxge/dib/dib_int.h" #include "core/fxge/ge/fx_text_int.h" #include "core/fxge/include/fx_ge.h" +#include "core/fxge/include/ifx_renderdevicedriver.h" #include "third_party/agg23/agg_conv_dash.h" #include "third_party/agg23/agg_conv_stroke.h" #include "third_party/agg23/agg_curves.h" @@ -416,97 +417,6 @@ static void RasterizeStroke(agg::rasterizer_scanline_aa& rasterizer, } } -IFX_RenderDeviceDriver* IFX_RenderDeviceDriver::CreateFxgeDriver( - CFX_DIBitmap* pBitmap, - FX_BOOL bRgbByteOrder, - CFX_DIBitmap* pOriDevice, - FX_BOOL bGroupKnockout) { - return new CFX_AggDeviceDriver(pBitmap, bRgbByteOrder, pOriDevice, - bGroupKnockout); -} - -IFX_RenderDeviceDriver::~IFX_RenderDeviceDriver() {} - -CFX_Matrix IFX_RenderDeviceDriver::GetCTM() const { - return CFX_Matrix(); -} - -FX_BOOL IFX_RenderDeviceDriver::StartRendering() { - return TRUE; -} - -void IFX_RenderDeviceDriver::EndRendering() {} - -FX_BOOL IFX_RenderDeviceDriver::SetClip_PathStroke( - const CFX_PathData* pPathData, - const CFX_Matrix* pObject2Device, - const CFX_GraphStateData* pGraphState) { - return FALSE; -} - -FX_BOOL IFX_RenderDeviceDriver::SetPixel(int x, int y, uint32_t color) { - return FALSE; -} - -FX_BOOL IFX_RenderDeviceDriver::FillRectWithBlend(const FX_RECT* pRect, - uint32_t fill_color, - int blend_type) { - return FALSE; -} - -FX_BOOL IFX_RenderDeviceDriver::DrawCosmeticLine(FX_FLOAT x1, - FX_FLOAT y1, - FX_FLOAT x2, - FX_FLOAT y2, - uint32_t color, - int blend_type) { - return FALSE; -} - -FX_BOOL IFX_RenderDeviceDriver::GetDIBits(CFX_DIBitmap* pBitmap, - int left, - int top) { - return FALSE; -} -CFX_DIBitmap* IFX_RenderDeviceDriver::GetBackDrop() { - return nullptr; -} - -FX_BOOL IFX_RenderDeviceDriver::ContinueDIBits(void* handle, - IFX_Pause* pPause) { - return FALSE; -} - -void IFX_RenderDeviceDriver::CancelDIBits(void* handle) {} - -FX_BOOL IFX_RenderDeviceDriver::DrawDeviceText(int nChars, - const FXTEXT_CHARPOS* pCharPos, - CFX_Font* pFont, - CFX_FontCache* pCache, - const CFX_Matrix* pObject2Device, - FX_FLOAT font_size, - uint32_t color) { - return FALSE; -} - -void* IFX_RenderDeviceDriver::GetPlatformSurface() const { - return nullptr; -} - -int IFX_RenderDeviceDriver::GetDriverType() const { - return 0; -} - -void IFX_RenderDeviceDriver::ClearDriver() {} - -FX_BOOL IFX_RenderDeviceDriver::DrawShading(const CPDF_ShadingPattern* pPattern, - const CFX_Matrix* pMatrix, - const FX_RECT& clip_rect, - int alpha, - FX_BOOL bAlphaMode) { - return false; -} - CFX_AggDeviceDriver::CFX_AggDeviceDriver(CFX_DIBitmap* pBitmap, FX_BOOL bRgbByteOrder, CFX_DIBitmap* pOriDevice, @@ -554,7 +464,7 @@ FX_BOOL CFX_AggDeviceDriver::DrawDeviceText(int nChars, } #endif // _FXM_PLATFORM_ != _FXM_PLATFORM_APPLE_ -int CFX_AggDeviceDriver::GetDeviceCaps(int caps_id) { +int CFX_AggDeviceDriver::GetDeviceCaps(int caps_id) const { switch (caps_id) { case FXDC_DEVICE_CLASS: return FXDC_DISPLAY; diff --git a/core/fxge/agg/fx_agg_driver.h b/core/fxge/agg/fx_agg_driver.h index 7c2e98047f..15f9706b3f 100644 --- a/core/fxge/agg/fx_agg_driver.h +++ b/core/fxge/agg/fx_agg_driver.h @@ -7,11 +7,12 @@ #ifndef CORE_FXGE_AGG_FX_AGG_DRIVER_H_ #define CORE_FXGE_AGG_FX_AGG_DRIVER_H_ -#include "core/fxge/include/fx_ge.h" +#include "core/fxge/include/ifx_renderdevicedriver.h" #include "third_party/agg23/agg_clip_liang_barsky.h" #include "third_party/agg23/agg_path_storage.h" #include "third_party/agg23/agg_rasterizer_scanline_aa.h" +class CFX_ClipRgn; class CFX_Matrix; class CFX_PathData; @@ -37,7 +38,7 @@ class CFX_AggDeviceDriver : public IFX_RenderDeviceDriver { void DestroyPlatform(); // IFX_RenderDeviceDriver - int GetDeviceCaps(int caps_id) override; + int GetDeviceCaps(int caps_id) const override; void SaveState() override; void RestoreState(bool bKeepSaved) override; FX_BOOL SetClip_PathFill(const CFX_PathData* pPathData, -- cgit v1.2.3