diff options
Diffstat (limited to 'core/fxge')
-rw-r--r-- | core/fxge/cfx_renderdevice.cpp | 58 | ||||
-rw-r--r-- | core/fxge/cfx_renderdevice.h | 1 | ||||
-rw-r--r-- | core/fxge/fx_font.h | 4 | ||||
-rw-r--r-- | core/fxge/fx_ge_text.cpp | 6 | ||||
-rw-r--r-- | core/fxge/renderdevicedriver_iface.cpp | 4 | ||||
-rw-r--r-- | core/fxge/renderdevicedriver_iface.h | 1 |
6 files changed, 14 insertions, 60 deletions
diff --git a/core/fxge/cfx_renderdevice.cpp b/core/fxge/cfx_renderdevice.cpp index 2e279d636f..2fd48d2c80 100644 --- a/core/fxge/cfx_renderdevice.cpp +++ b/core/fxge/cfx_renderdevice.cpp @@ -425,10 +425,6 @@ int CFX_RenderDevice::GetDeviceCaps(int caps_id) const { return m_pDeviceDriver->GetDeviceCaps(caps_id); } -CFX_Matrix CFX_RenderDevice::GetCTM() const { - return m_pDeviceDriver->GetCTM(); -} - RetainPtr<CFX_DIBitmap> CFX_RenderDevice::GetBitmap() const { return m_pBitmap; } @@ -634,16 +630,12 @@ bool CFX_RenderDevice::DrawFillStrokePath(const CFX_PathData* pPathData, if (pObject2Device) bbox = pObject2Device->TransformRect(bbox); - CFX_Matrix ctm = GetCTM(); - float fScaleX = fabs(ctm.a); - float fScaleY = fabs(ctm.d); FX_RECT rect = bbox.GetOuterRect(); auto bitmap = pdfium::MakeRetain<CFX_DIBitmap>(); auto Backdrop = pdfium::MakeRetain<CFX_DIBitmap>(); - if (!CreateCompatibleBitmap(bitmap, FXSYS_round(rect.Width() * fScaleX), - FXSYS_round(rect.Height() * fScaleY))) { + if (!CreateCompatibleBitmap(bitmap, rect.Width(), rect.Height())) return false; - } + if (bitmap->HasAlpha()) { bitmap->Clear(0); Backdrop->Copy(bitmap); @@ -659,7 +651,6 @@ bool CFX_RenderDevice::DrawFillStrokePath(const CFX_PathData* pPathData, if (pObject2Device) matrix = *pObject2Device; matrix.Translate(-rect.left, -rect.top); - matrix.Concat(CFX_Matrix(fScaleX, 0, 0, fScaleY, 0, 0)); if (!bitmap_device.GetDeviceDriver()->DrawPath( pPathData, &matrix, pGraphState, fill_color, stroke_color, fill_mode, blend_type)) { @@ -668,8 +659,7 @@ bool CFX_RenderDevice::DrawFillStrokePath(const CFX_PathData* pPathData, #if defined _SKIA_SUPPORT_ || defined _SKIA_SUPPORT_PATHS_ bitmap_device.GetDeviceDriver()->Flush(); #endif - FX_RECT src_rect(0, 0, FXSYS_round(rect.Width() * fScaleX), - FXSYS_round(rect.Height() * fScaleY)); + FX_RECT src_rect(0, 0, rect.Width(), rect.Height()); return m_pDeviceDriver->SetDIBits(bitmap, 0, &src_rect, rect.left, rect.top, FXDIB_BLEND_NORMAL); } @@ -734,12 +724,8 @@ bool CFX_RenderDevice::SetDIBitsWithBlend( int top, int blend_mode) { ASSERT(!pBitmap->IsAlphaMask()); - CFX_Matrix ctm = GetCTM(); - float fScaleX = fabs(ctm.a); - float fScaleY = fabs(ctm.d); - FX_RECT dest_rect(left, top, - FXSYS_round(left + pBitmap->GetWidth() / fScaleX), - FXSYS_round(top + pBitmap->GetHeight() / fScaleY)); + FX_RECT dest_rect(left, top, left + pBitmap->GetWidth(), + top + pBitmap->GetHeight()); dest_rect.Intersect(m_ClipBox); if (dest_rect.IsEmpty()) return true; @@ -747,10 +733,6 @@ bool CFX_RenderDevice::SetDIBitsWithBlend( FX_RECT src_rect(dest_rect.left - left, dest_rect.top - top, dest_rect.left - left + dest_rect.Width(), dest_rect.top - top + dest_rect.Height()); - src_rect.left = FXSYS_round(src_rect.left * fScaleX); - src_rect.top = FXSYS_round(src_rect.top * fScaleY); - src_rect.right = FXSYS_round(src_rect.right * fScaleX); - src_rect.bottom = FXSYS_round(src_rect.bottom * fScaleY); if ((blend_mode == FXDIB_BLEND_NORMAL || (m_RenderCaps & FXRC_BLEND_MODE)) && (!pBitmap->HasAlpha() || (m_RenderCaps & FXRC_ALPHA_IMAGE))) { return m_pDeviceDriver->SetDIBits(pBitmap, 0, &src_rect, dest_rect.left, @@ -759,8 +741,8 @@ bool CFX_RenderDevice::SetDIBitsWithBlend( if (!(m_RenderCaps & FXRC_GET_BITS)) return false; - int bg_pixel_width = FXSYS_round(dest_rect.Width() * fScaleX); - int bg_pixel_height = FXSYS_round(dest_rect.Height() * fScaleY); + int bg_pixel_width = dest_rect.Width(); + int bg_pixel_height = dest_rect.Height(); auto background = pdfium::MakeRetain<CFX_DIBitmap>(); if (!background->Create( bg_pixel_width, bg_pixel_height, @@ -934,13 +916,7 @@ bool CFX_RenderDevice::DrawNormalText(int nChars, } } std::vector<FXTEXT_GLYPHPOS> glyphs(nChars); - CFX_Matrix matrixCTM = GetCTM(); - float scale_x = fabs(matrixCTM.a); - float scale_y = fabs(matrixCTM.d); CFX_Matrix deviceCtm = char2device; - CFX_Matrix m(scale_x, 0, 0, scale_y, 0, 0); - deviceCtm.Concat(m); - text2Device.Concat(m); for (size_t i = 0; i < glyphs.size(); ++i) { FXTEXT_GLYPHPOS& glyph = glyphs[i]; @@ -970,25 +946,15 @@ bool CFX_RenderDevice::DrawNormalText(int nChars, if (anti_alias < FXFT_RENDER_MODE_LCD && glyphs.size() > 1) AdjustGlyphSpace(&glyphs); - FX_RECT bmp_rect1 = FXGE_GetGlyphsBBox(glyphs, anti_alias, 1.0f, 1.0f); - if (scale_x > 1 && scale_y > 1) { - --bmp_rect1.left; - --bmp_rect1.top; - ++bmp_rect1.right; - ++bmp_rect1.bottom; - } - FX_RECT bmp_rect(FXSYS_round((float)(bmp_rect1.left) / scale_x), - FXSYS_round((float)(bmp_rect1.top) / scale_y), - FXSYS_round((float)bmp_rect1.right / scale_x), - FXSYS_round((float)bmp_rect1.bottom / scale_y)); + FX_RECT bmp_rect = FXGE_GetGlyphsBBox(glyphs, anti_alias); bmp_rect.Intersect(m_ClipBox); if (bmp_rect.IsEmpty()) return true; - int pixel_width = FXSYS_round(bmp_rect.Width() * scale_x); - int pixel_height = FXSYS_round(bmp_rect.Height() * scale_y); - int pixel_left = FXSYS_round(bmp_rect.left * scale_x); - int pixel_top = FXSYS_round(bmp_rect.top * scale_y); + int pixel_width = bmp_rect.Width(); + int pixel_height = bmp_rect.Height(); + int pixel_left = bmp_rect.left; + int pixel_top = bmp_rect.top; if (anti_alias == FXFT_RENDER_MODE_MONO) { auto bitmap = pdfium::MakeRetain<CFX_DIBitmap>(); if (!bitmap->Create(pixel_width, pixel_height, FXDIB_1bppMask)) diff --git a/core/fxge/cfx_renderdevice.h b/core/fxge/cfx_renderdevice.h index eed72eb036..124e5e9995 100644 --- a/core/fxge/cfx_renderdevice.h +++ b/core/fxge/cfx_renderdevice.h @@ -114,7 +114,6 @@ class CFX_RenderDevice { int GetDeviceClass() const { return m_DeviceClass; } int GetRenderCaps() const { return m_RenderCaps; } int GetDeviceCaps(int id) const; - CFX_Matrix GetCTM() const; RetainPtr<CFX_DIBitmap> GetBitmap() const; void SetBitmap(const RetainPtr<CFX_DIBitmap>& pBitmap); bool CreateCompatibleBitmap(const RetainPtr<CFX_DIBitmap>& pDIB, diff --git a/core/fxge/fx_font.h b/core/fxge/fx_font.h index c617376757..cee870f62a 100644 --- a/core/fxge/fx_font.h +++ b/core/fxge/fx_font.h @@ -95,9 +95,7 @@ class FXTEXT_GLYPHPOS { }; FX_RECT FXGE_GetGlyphsBBox(const std::vector<FXTEXT_GLYPHPOS>& glyphs, - int anti_alias, - float retinaScaleX, - float retinaScaleY); + int anti_alias); ByteString GetNameFromTT(const uint8_t* name_table, uint32_t name_table_size, diff --git a/core/fxge/fx_ge_text.cpp b/core/fxge/fx_ge_text.cpp index 3739e11393..a74b8fb9b9 100644 --- a/core/fxge/fx_ge_text.cpp +++ b/core/fxge/fx_ge_text.cpp @@ -43,9 +43,7 @@ ScopedFontTransform::~ScopedFontTransform() { } FX_RECT FXGE_GetGlyphsBBox(const std::vector<FXTEXT_GLYPHPOS>& glyphs, - int anti_alias, - float retinaScaleX, - float retinaScaleY) { + int anti_alias) { FX_RECT rect(0, 0, 0, 0); bool bStarted = false; for (const FXTEXT_GLYPHPOS& glyph : glyphs) { @@ -59,7 +57,6 @@ FX_RECT FXGE_GetGlyphsBBox(const std::vector<FXTEXT_GLYPHPOS>& glyphs, continue; FX_SAFE_INT32 char_width = pGlyph->m_pBitmap->GetWidth(); - char_width /= retinaScaleX; if (anti_alias == FXFT_RENDER_MODE_LCD) char_width /= 3; if (!char_width.IsValid()) @@ -75,7 +72,6 @@ FX_RECT FXGE_GetGlyphsBBox(const std::vector<FXTEXT_GLYPHPOS>& glyphs, continue; FX_SAFE_INT32 char_height = pGlyph->m_pBitmap->GetHeight(); - char_height /= retinaScaleY; if (!char_height.IsValid()) continue; diff --git a/core/fxge/renderdevicedriver_iface.cpp b/core/fxge/renderdevicedriver_iface.cpp index d1cd65d4e6..b4d7fb0d2c 100644 --- a/core/fxge/renderdevicedriver_iface.cpp +++ b/core/fxge/renderdevicedriver_iface.cpp @@ -12,10 +12,6 @@ RenderDeviceDriverIface::~RenderDeviceDriverIface() {} -CFX_Matrix RenderDeviceDriverIface::GetCTM() const { - return CFX_Matrix(); -} - bool RenderDeviceDriverIface::StartRendering() { return true; } diff --git a/core/fxge/renderdevicedriver_iface.h b/core/fxge/renderdevicedriver_iface.h index 7dd7a104f3..2d255f6e24 100644 --- a/core/fxge/renderdevicedriver_iface.h +++ b/core/fxge/renderdevicedriver_iface.h @@ -30,7 +30,6 @@ class RenderDeviceDriverIface { virtual ~RenderDeviceDriverIface(); virtual int GetDeviceCaps(int caps_id) const = 0; - virtual CFX_Matrix GetCTM() const; virtual bool StartRendering(); virtual void EndRendering(); |