diff options
author | Lei Zhang <thestig@chromium.org> | 2018-04-09 20:21:55 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-04-09 20:21:55 +0000 |
commit | 417f3442593713a87e723379438bea7d842e977a (patch) | |
tree | e154be3a5a5c1db3b19deb968a8a04b65a2a3e6a | |
parent | 40baf04a567236d51b26e2d94f0ed7f2694cfeb1 (diff) | |
download | pdfium-417f3442593713a87e723379438bea7d842e977a.tar.xz |
Remove RenderDeviceDriverIface::GetCTM().
It has no overrides and always returns the identity matrix. Many callers
that use the returned value can be simplified, because they are scaling
by 1 or concatenating an identity matrix.
Change-Id: I7afb7214be210d02638644dfb9b58404420c2ef2
Reviewed-on: https://pdfium-review.googlesource.com/29972
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
-rw-r--r-- | core/fpdfapi/render/cpdf_devicebuffer.cpp | 3 | ||||
-rw-r--r-- | core/fpdfapi/render/cpdf_renderstatus.cpp | 74 | ||||
-rw-r--r-- | core/fpdfapi/render/cpdf_renderstatus.h | 1 | ||||
-rw-r--r-- | core/fpdfapi/render/cpdf_type3cache.cpp | 27 | ||||
-rw-r--r-- | core/fpdfapi/render/cpdf_type3cache.h | 9 | ||||
-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 |
11 files changed, 39 insertions, 149 deletions
diff --git a/core/fpdfapi/render/cpdf_devicebuffer.cpp b/core/fpdfapi/render/cpdf_devicebuffer.cpp index b96d00208e..7dfa497b5c 100644 --- a/core/fpdfapi/render/cpdf_devicebuffer.cpp +++ b/core/fpdfapi/render/cpdf_devicebuffer.cpp @@ -43,9 +43,6 @@ bool CPDF_DeviceBuffer::Initialize(CPDF_RenderContext* pContext, m_Matrix.Scale(1.0f, (float)(max_dpi) / (float)dpiv); } #endif - CFX_Matrix ctm = m_pDevice->GetCTM(); - m_Matrix.Concat(CFX_Matrix(fabs(ctm.a), 0, 0, fabs(ctm.d), 0, 0)); - FX_RECT bitmap_rect = m_Matrix.TransformRect(CFX_FloatRect(*pRect)).GetOuterRect(); m_pBitmap = pdfium::MakeRetain<CFX_DIBitmap>(); diff --git a/core/fpdfapi/render/cpdf_renderstatus.cpp b/core/fpdfapi/render/cpdf_renderstatus.cpp index 662377b647..2d66f9c48b 100644 --- a/core/fpdfapi/render/cpdf_renderstatus.cpp +++ b/core/fpdfapi/render/cpdf_renderstatus.cpp @@ -1167,17 +1167,7 @@ FX_RECT CPDF_RenderStatus::GetObjectClippedRect( const CPDF_PageObject* pObj, const CFX_Matrix* pObj2Device) const { FX_RECT rect = pObj->GetBBox(pObj2Device); - FX_RECT rtClip = m_pDevice->GetClipBox(); - CFX_Matrix dCTM = m_pDevice->GetCTM(); - float a = fabs(dCTM.a); - float d = fabs(dCTM.d); - if (a != 1.0f || d != 1.0f) { - rect.right = rect.left + (int32_t)ceil((float)rect.Width() * a); - rect.bottom = rect.top + (int32_t)ceil((float)rect.Height() * d); - rtClip.right = rtClip.left + (int32_t)ceil((float)rtClip.Width() * a); - rtClip.bottom = rtClip.top + (int32_t)ceil((float)rtClip.Height() * d); - } - rect.Intersect(rtClip); + rect.Intersect(m_pDevice->GetClipBox()); return rect; } @@ -1213,27 +1203,16 @@ void CPDF_RenderStatus::ProcessObjectNoClip(CPDF_PageObject* pObj, bool CPDF_RenderStatus::DrawObjWithBlend(CPDF_PageObject* pObj, const CFX_Matrix* pObj2Device) { - bool bRet = false; switch (pObj->GetType()) { case CPDF_PageObject::PATH: - bRet = ProcessPath(pObj->AsPath(), pObj2Device); - break; + return ProcessPath(pObj->AsPath(), pObj2Device); case CPDF_PageObject::IMAGE: - bRet = ProcessImage(pObj->AsImage(), pObj2Device); - break; + return ProcessImage(pObj->AsImage(), pObj2Device); case CPDF_PageObject::FORM: - bRet = ProcessForm(pObj->AsForm(), pObj2Device); - break; + return ProcessForm(pObj->AsForm(), pObj2Device); default: - break; + return false; } - return bRet; -} - -void CPDF_RenderStatus::GetScaledMatrix(CFX_Matrix& matrix) const { - CFX_Matrix dCTM = m_pDevice->GetCTM(); - matrix.a *= fabs(dCTM.a); - matrix.d *= fabs(dCTM.d); } void CPDF_RenderStatus::DrawObjWithBackground(CPDF_PageObject* pObj, @@ -1254,7 +1233,6 @@ void CPDF_RenderStatus::DrawObjWithBackground(CPDF_PageObject* pObj, } CFX_Matrix matrix = *pObj2Device; matrix.Concat(*buffer.GetMatrix()); - GetScaledMatrix(matrix); CPDF_Dictionary* pFormResource = nullptr; const CPDF_FormObject* pFormObj = pObj->AsForm(); if (pFormObj) { @@ -1569,11 +1547,8 @@ bool CPDF_RenderStatus::ProcessTransparency(CPDF_PageObject* pPageObj, if (rect.IsEmpty()) return true; - CFX_Matrix deviceCTM = m_pDevice->GetCTM(); - float scaleX = fabs(deviceCTM.a); - float scaleY = fabs(deviceCTM.d); - int width = FXSYS_round((float)rect.Width() * scaleX); - int height = FXSYS_round((float)rect.Height() * scaleY); + int width = rect.Width(); + int height = rect.Height(); CFX_DefaultRenderDevice bitmap_device; RetainPtr<CFX_DIBitmap> oriDevice; if (!isolated && (m_pDevice->GetRenderCaps() & FXRC_GET_BITS)) { @@ -1590,7 +1565,6 @@ bool CPDF_RenderStatus::ProcessTransparency(CPDF_PageObject* pPageObj, CFX_Matrix new_matrix = *pObj2Device; new_matrix.Translate(-rect.left, -rect.top); - new_matrix.Scale(scaleX, scaleY); RetainPtr<CFX_DIBitmap> pTextMask; if (bTextClip) { @@ -1666,11 +1640,8 @@ RetainPtr<CFX_DIBitmap> CPDF_RenderStatus::GetBackdrop( bbox.Intersect(m_pDevice->GetClipBox()); *left = bbox.left; *top = bbox.top; - CFX_Matrix deviceCTM = m_pDevice->GetCTM(); - float scaleX = fabs(deviceCTM.a); - float scaleY = fabs(deviceCTM.d); - int width = FXSYS_round(bbox.Width() * scaleX); - int height = FXSYS_round(bbox.Height() * scaleY); + int width = bbox.Width(); + int height = bbox.Height(); auto pBackdrop = pdfium::MakeRetain<CFX_DIBitmap>(); if (bBackAlphaRequired && !m_bDropObjects) pBackdrop->Create(width, height, FXDIB_Argb); @@ -1692,7 +1663,6 @@ RetainPtr<CFX_DIBitmap> CPDF_RenderStatus::GetBackdrop( } CFX_Matrix FinalMatrix = m_DeviceMatrix; FinalMatrix.Translate(-*left, -*top); - FinalMatrix.Scale(scaleX, scaleY); pBackdrop->Clear(pBackdrop->HasAlpha() ? 0 : 0xffffffff); CFX_DefaultRenderDevice device; @@ -1853,9 +1823,6 @@ bool CPDF_RenderStatus::ProcessType3Text(CPDF_TextObject* textobj, if (pdfium::ContainsValue(m_Type3FontCache, pType3Font)) return true; - CFX_Matrix dCTM = m_pDevice->GetCTM(); - float sa = fabs(dCTM.a); - float sd = fabs(dCTM.d); CFX_Matrix text_matrix = textobj->GetTextMatrix(); CFX_Matrix char_matrix = pType3Font->GetFontMatrix(); float font_size = textobj->m_TextState.GetFontSize(); @@ -1927,8 +1894,7 @@ bool CPDF_RenderStatus::ProcessType3Text(CPDF_TextObject* textobj, matrix.TransformRect(pType3Char->form()->CalcBoundingBox()) .GetOuterRect(); CFX_DefaultRenderDevice bitmap_device; - if (!bitmap_device.Create((int)(rect.Width() * sa), - (int)(rect.Height() * sd), FXDIB_Argb, + if (!bitmap_device.Create(rect.Width(), rect.Height(), FXDIB_Argb, nullptr)) { return true; } @@ -1941,7 +1907,6 @@ bool CPDF_RenderStatus::ProcessType3Text(CPDF_TextObject* textobj, status.m_Type3FontCache = m_Type3FontCache; status.m_Type3FontCache.push_back(pType3Font); matrix.Translate(-rect.left, -rect.top); - matrix.Scale(sa, sd); status.RenderObjectList(pType3Char->form(), &matrix); m_pDevice->SetDIBits(bitmap_device.GetBitmap(), rect.left, rect.top); } @@ -1949,7 +1914,7 @@ bool CPDF_RenderStatus::ProcessType3Text(CPDF_TextObject* textobj, if (device_class == FXDC_DISPLAY) { RetainPtr<CPDF_Type3Cache> pCache = GetCachedType3(pType3Font); refTypeCache.m_dwCount++; - CFX_GlyphBitmap* pBitmap = pCache->LoadGlyph(charcode, &matrix, sa, sd); + CFX_GlyphBitmap* pBitmap = pCache->LoadGlyph(charcode, &matrix); if (!pBitmap) continue; @@ -1978,12 +1943,11 @@ bool CPDF_RenderStatus::ProcessType3Text(CPDF_TextObject* textobj, if (glyphs.empty()) return true; - FX_RECT rect = FXGE_GetGlyphsBBox(glyphs, 0, sa, sd); + FX_RECT rect = FXGE_GetGlyphsBBox(glyphs, 0); auto pBitmap = pdfium::MakeRetain<CFX_DIBitmap>(); - if (!pBitmap->Create(static_cast<int>(rect.Width() * sa), - static_cast<int>(rect.Height() * sd), FXDIB_8bppMask)) { + if (!pBitmap->Create(rect.Width(), rect.Height(), FXDIB_8bppMask)) return true; - } + pBitmap->Clear(0); for (const FXTEXT_GLYPHPOS& glyph : glyphs) { if (!glyph.m_pGlyph) @@ -1992,14 +1956,12 @@ bool CPDF_RenderStatus::ProcessType3Text(CPDF_TextObject* textobj, pdfium::base::CheckedNumeric<int> left = glyph.m_Origin.x; left += glyph.m_pGlyph->m_Left; left -= rect.left; - left *= sa; if (!left.IsValid()) continue; pdfium::base::CheckedNumeric<int> top = glyph.m_Origin.y; top -= glyph.m_pGlyph->m_Top; top -= rect.top; - top *= sd; if (!top.IsValid()) continue; @@ -2187,7 +2149,6 @@ void CPDF_RenderStatus::DrawShadingPattern(CPDF_ShadingPattern* pattern, CFX_Matrix matrix = *pattern->pattern_to_form(); matrix.Concat(*pObj2Device); - GetScaledMatrix(matrix); int alpha = FXSYS_round(255 * (bStroke ? pPageObj->m_GeneralState.GetStrokeAlpha() : pPageObj->m_GeneralState.GetFillAlpha())); @@ -2231,15 +2192,8 @@ void CPDF_RenderStatus::DrawTilingPattern(CPDF_TilingPattern* pPattern, if (clip_box.IsEmpty()) return; - CFX_Matrix dCTM = m_pDevice->GetCTM(); - float sa = fabs(dCTM.a); - float sd = fabs(dCTM.d); - clip_box.right = clip_box.left + (int32_t)ceil(clip_box.Width() * sa); - clip_box.bottom = clip_box.top + (int32_t)ceil(clip_box.Height() * sd); - CFX_Matrix mtPattern2Device = *pPattern->pattern_to_form(); mtPattern2Device.Concat(*pObj2Device); - GetScaledMatrix(mtPattern2Device); bool bAligned = pPattern->bbox().left == 0 && pPattern->bbox().bottom == 0 && diff --git a/core/fpdfapi/render/cpdf_renderstatus.h b/core/fpdfapi/render/cpdf_renderstatus.h index e5bd872b5c..74d356735e 100644 --- a/core/fpdfapi/render/cpdf_renderstatus.h +++ b/core/fpdfapi/render/cpdf_renderstatus.h @@ -155,7 +155,6 @@ class CPDF_RenderStatus { FX_ARGB GetStrokeArgb(CPDF_PageObject* pObj) const; FX_RECT GetObjectClippedRect(const CPDF_PageObject* pObj, const CFX_Matrix* pObj2Device) const; - void GetScaledMatrix(CFX_Matrix& matrix) const; static const int kRenderMaxRecursionDepth = 64; static int s_CurrentRecursionDepth; diff --git a/core/fpdfapi/render/cpdf_type3cache.cpp b/core/fpdfapi/render/cpdf_type3cache.cpp index 33a440f1ca..f85e5bbd9f 100644 --- a/core/fpdfapi/render/cpdf_type3cache.cpp +++ b/core/fpdfapi/render/cpdf_type3cache.cpp @@ -85,9 +85,7 @@ CPDF_Type3Cache::CPDF_Type3Cache(CPDF_Type3Font* pFont) : m_pFont(pFont) {} CPDF_Type3Cache::~CPDF_Type3Cache() {} CFX_GlyphBitmap* CPDF_Type3Cache::LoadGlyph(uint32_t charcode, - const CFX_Matrix* pMatrix, - float retinaScaleX, - float retinaScaleY) { + const CFX_Matrix* pMatrix) { CPDF_UniqueKeyGen keygen; keygen.Generate( 4, FXSYS_round(pMatrix->a * 10000), FXSYS_round(pMatrix->b * 10000), @@ -107,7 +105,7 @@ CFX_GlyphBitmap* CPDF_Type3Cache::LoadGlyph(uint32_t charcode, return it2->second.get(); std::unique_ptr<CFX_GlyphBitmap> pNewBitmap = - RenderGlyph(pSizeCache, charcode, pMatrix, retinaScaleX, retinaScaleY); + RenderGlyph(pSizeCache, charcode, pMatrix); CFX_GlyphBitmap* pGlyphBitmap = pNewBitmap.get(); pSizeCache->m_GlyphMap[charcode] = std::move(pNewBitmap); return pGlyphBitmap; @@ -116,9 +114,7 @@ CFX_GlyphBitmap* CPDF_Type3Cache::LoadGlyph(uint32_t charcode, std::unique_ptr<CFX_GlyphBitmap> CPDF_Type3Cache::RenderGlyph( CPDF_Type3Glyphs* pSize, uint32_t charcode, - const CFX_Matrix* pMatrix, - float retinaScaleX, - float retinaScaleY) { + const CFX_Matrix* pMatrix) { const CPDF_Type3Char* pChar = m_pFont->LoadChar(charcode); if (!pChar || !pChar->GetBitmap()) return nullptr; @@ -146,24 +142,19 @@ std::unique_ptr<CFX_GlyphBitmap> CPDF_Type3Cache::RenderGlyph( } pSize->AdjustBlue(top_y, bottom_y, top_line, bottom_line); pResBitmap = pBitmap->StretchTo( - static_cast<int>(FXSYS_round(image_matrix.a) * retinaScaleX), - static_cast<int>( - (bFlipped ? top_line - bottom_line : bottom_line - top_line) * - retinaScaleY), + static_cast<int>(image_matrix.a), + static_cast<int>(bFlipped ? top_line - bottom_line + : bottom_line - top_line), 0, nullptr); top = top_line; - if (image_matrix.a < 0) { - image_matrix.Scale(retinaScaleX, retinaScaleY); + if (image_matrix.a < 0) left = FXSYS_round(image_matrix.e + image_matrix.a); - } else { + else left = FXSYS_round(image_matrix.e); - } } } - if (!pResBitmap) { - image_matrix.Scale(retinaScaleX, retinaScaleY); + if (!pResBitmap) pResBitmap = pBitmap->TransformTo(&image_matrix, &left, &top); - } if (!pResBitmap) return nullptr; diff --git a/core/fpdfapi/render/cpdf_type3cache.h b/core/fpdfapi/render/cpdf_type3cache.h index 7911785ab1..f0bfbd63b6 100644 --- a/core/fpdfapi/render/cpdf_type3cache.h +++ b/core/fpdfapi/render/cpdf_type3cache.h @@ -23,10 +23,7 @@ class CPDF_Type3Cache : public Retainable { template <typename T, typename... Args> friend RetainPtr<T> pdfium::MakeRetain(Args&&... args); - CFX_GlyphBitmap* LoadGlyph(uint32_t charcode, - const CFX_Matrix* pMatrix, - float retinaScaleX, - float retinaScaleY); + CFX_GlyphBitmap* LoadGlyph(uint32_t charcode, const CFX_Matrix* pMatrix); private: explicit CPDF_Type3Cache(CPDF_Type3Font* pFont); @@ -34,9 +31,7 @@ class CPDF_Type3Cache : public Retainable { std::unique_ptr<CFX_GlyphBitmap> RenderGlyph(CPDF_Type3Glyphs* pSize, uint32_t charcode, - const CFX_Matrix* pMatrix, - float retinaScaleX, - float retinaScaleY); + const CFX_Matrix* pMatrix); UnownedPtr<CPDF_Type3Font> const m_pFont; std::map<ByteString, std::unique_ptr<CPDF_Type3Glyphs>> m_SizeMap; 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(); |