Clean up CQuartz2D. - Remove unused methods. - Rename remaining method names to follow Google C++ style. - Fix lint errors. Change-Id: I7179086526c2b7d11ddc0d4c25f5c0b161158a68 Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/55719 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
diff --git a/core/fxge/apple/apple_int.h b/core/fxge/apple/apple_int.h index 5869421..c58e75c 100644 --- a/core/fxge/apple/apple_int.h +++ b/core/fxge/apple/apple_int.h
@@ -19,21 +19,19 @@ class CQuartz2D { public: - void* createGraphics(const RetainPtr<CFX_DIBitmap>& bitmap); - void destroyGraphics(void* graphics); + void* CreateGraphics(const RetainPtr<CFX_DIBitmap>& bitmap); + void DestroyGraphics(void* graphics); void* CreateFont(const uint8_t* pFontData, uint32_t dwFontSize); void DestroyFont(void* pFont); void SetGraphicsTextMatrix(void* graphics, const CFX_Matrix& matrix); - bool drawGraphicsString(void* graphics, + bool DrawGraphicsString(void* graphics, void* font, float fontSize, uint16_t* glyphIndices, CGPoint* glyphPositions, int32_t chars, FX_ARGB argb); - void saveGraphicsState(void* graphics); - void restoreGraphicsState(void* graphics); }; class CApplePlatform : public CFX_GEModule::PlatformIface {
diff --git a/core/fxge/apple/fx_apple_platform.cpp b/core/fxge/apple/fx_apple_platform.cpp index b3a0214..7b253a6 100644 --- a/core/fxge/apple/fx_apple_platform.cpp +++ b/core/fxge/apple/fx_apple_platform.cpp
@@ -77,7 +77,7 @@ new_matrix.d = -new_matrix.d; } quartz2d.SetGraphicsTextMatrix(pContext, new_matrix); - return quartz2d.drawGraphicsString(pContext, pFont->GetPlatformFont(), + return quartz2d.DrawGraphicsString(pContext, pFont->GetPlatformFont(), font_size, glyph_indices.data(), glyph_positions.data(), nChars, argb); } @@ -88,7 +88,7 @@ CQuartz2D& quartz2d = static_cast<CApplePlatform*>(CFX_GEModule::Get()->GetPlatform()) ->m_quartz2d; - m_pPlatformGraphics = quartz2d.createGraphics(m_pBitmap); + m_pPlatformGraphics = quartz2d.CreateGraphics(m_pBitmap); } void CFX_AggDeviceDriver::DestroyPlatform() { @@ -96,7 +96,7 @@ static_cast<CApplePlatform*>(CFX_GEModule::Get()->GetPlatform()) ->m_quartz2d; if (m_pPlatformGraphics) { - quartz2d.destroyGraphics(m_pPlatformGraphics); + quartz2d.DestroyGraphics(m_pPlatformGraphics); m_pPlatformGraphics = nullptr; } }
diff --git a/core/fxge/apple/fx_quartz_device.cpp b/core/fxge/apple/fx_quartz_device.cpp index 6a8d6bd..2281ba5 100644 --- a/core/fxge/apple/fx_quartz_device.cpp +++ b/core/fxge/apple/fx_quartz_device.cpp
@@ -21,7 +21,7 @@ #error Expected CGFLOAT_IS_DOUBLE to be defined by CoreGraphics headers #endif -void* CQuartz2D::createGraphics(const RetainPtr<CFX_DIBitmap>& pBitmap) { +void* CQuartz2D::CreateGraphics(const RetainPtr<CFX_DIBitmap>& pBitmap) { if (!pBitmap) return nullptr; CGBitmapInfo bmpInfo = kCGBitmapByteOrder32Little; @@ -41,7 +41,7 @@ return context; } -void CQuartz2D::destroyGraphics(void* graphics) { +void CQuartz2D::DestroyGraphics(void* graphics) { if (graphics) CGContextRelease((CGContextRef)graphics); } @@ -72,7 +72,7 @@ matrix.e, ty)); } -bool CQuartz2D::drawGraphicsString(void* graphics, +bool CQuartz2D::DrawGraphicsString(void* graphics, void* font, float fontSize, uint16_t* glyphIndices, @@ -100,9 +100,10 @@ glyphPositionsCG[index].y = glyphPositions[index].y; } #else - CGPoint* glyphPositionsCG = (CGPoint*)glyphPositions; + CGPoint* glyphPositionsCG = glyphPositions; #endif - CGContextShowGlyphsAtPositions(context, (CGGlyph*)glyphIndices, + CGContextShowGlyphsAtPositions(context, + reinterpret_cast<CGGlyph*>(glyphIndices), glyphPositionsCG, charsCount); #if CGFLOAT_IS_DOUBLE delete[] glyphPositionsCG; @@ -110,13 +111,3 @@ CGContextRestoreGState(context); return true; } - -void CQuartz2D::saveGraphicsState(void* graphics) { - if (graphics) - CGContextSaveGState((CGContextRef)graphics); -} - -void CQuartz2D::restoreGraphicsState(void* graphics) { - if (graphics) - CGContextRestoreGState((CGContextRef)graphics); -}