diff options
author | dsinclair <dsinclair@chromium.org> | 2017-03-28 15:47:47 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-03-28 15:48:01 +0000 |
commit | 31b08d4cdaa17d7a03f35e087096a77036af98ec (patch) | |
tree | 40234b81f2972c857a33a86cb4b59868e56bb86b /core/fxge/ge | |
parent | a3e9bf66c3483db926602aa62b0bd1ff8d1357a1 (diff) | |
download | pdfium-31b08d4cdaa17d7a03f35e087096a77036af98ec.tar.xz |
Revert "Refcount all CFX_DIBSources (and subclasses) all the time."
This reverts commit 0004f29bf6ee3c6060a272c79f14993e92e053c7.
Reason for revert: Breaks build with skia_paths enabled (which will break the chrome roll).
../../third_party/pdfium/core/fxge/skia/fx_skia_device.cpp:1858:38: error: no member named 'get' in 'CFX_RetainPtr<CFX_DIBitmap>'
../../third_party/pdfium/core/fxge/skia/fx_skia_device.cpp:1861:42: error: no member named 'get' in 'CFX_RetainPtr<CFX_DIBitmap>'
../../third_party/pdfium/core/fxge/skia/fx_skia_device.cpp:2987:15: error: no viable overloaded '='
../../third_party/pdfium/core/fxge/skia/fx_skia_device.cpp:2991:18: error: no viable overloaded '='
../../third_party/pdfium/core/fxge/skia/fx_skia_device.cpp:2999:17: error: no viable overloaded '='
../../third_party/pdfium/core/fxge/skia/fx_skia_device.cpp:3001:43: error: no member named 'GetObject' in 'CFX_RetainPtr<CFX_DIBitmap>'
Original change's description:
> Refcount all CFX_DIBSources (and subclasses) all the time.
>
> There are currently several ownership models for these objects,
> including ad-hoc logic for sharing and deletion, and the
> now-redundant CFX_DIBitmapRef externally-counted handle to the DIBs.
>
> Replace them all with the internal refcount scheme.
>
> Change-Id: I2db399dfc19219eda384f94cc989353b78ce2872
> Reviewed-on: https://pdfium-review.googlesource.com/3166
> Reviewed-by: dsinclair <dsinclair@chromium.org>
> Commit-Queue: dsinclair <dsinclair@chromium.org>
>
TBR=thestig@chromium.org,tsepez@chromium.org,dsinclair@chromium.org,pdfium-reviews@googlegroups.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
Change-Id: I678b1fbc5e666cf7a19372ebaff3270fb115ba5e
Reviewed-on: https://pdfium-review.googlesource.com/3243
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'core/fxge/ge')
-rw-r--r-- | core/fxge/ge/cfx_cliprgn.cpp | 43 | ||||
-rw-r--r-- | core/fxge/ge/cfx_cliprgn.h | 12 | ||||
-rw-r--r-- | core/fxge/ge/cfx_facecache.cpp | 6 | ||||
-rw-r--r-- | core/fxge/ge/cfx_renderdevice.cpp | 183 | ||||
-rw-r--r-- | core/fxge/ge/fx_ge_text.cpp | 4 |
5 files changed, 116 insertions, 132 deletions
diff --git a/core/fxge/ge/cfx_cliprgn.cpp b/core/fxge/ge/cfx_cliprgn.cpp index 5193ce2944..ea3eb51f18 100644 --- a/core/fxge/ge/cfx_cliprgn.cpp +++ b/core/fxge/ge/cfx_cliprgn.cpp @@ -6,8 +6,6 @@ #include "core/fxge/ge/cfx_cliprgn.h" -#include <utility> - CFX_ClipRgn::CFX_ClipRgn(int width, int height) : m_Type(RectI), m_Box(0, 0, width, height) {} @@ -22,7 +20,7 @@ CFX_ClipRgn::~CFX_ClipRgn() {} void CFX_ClipRgn::Reset(const FX_RECT& rect) { m_Type = RectI; m_Box = rect; - m_Mask = nullptr; + m_Mask.SetNull(); } void CFX_ClipRgn::IntersectRect(const FX_RECT& rect) { @@ -38,7 +36,8 @@ void CFX_ClipRgn::IntersectRect(const FX_RECT& rect) { void CFX_ClipRgn::IntersectMaskRect(FX_RECT rect, FX_RECT mask_rect, - const CFX_RetainPtr<CFX_DIBitmap>& pMask) { + CFX_DIBitmapRef Mask) { + const CFX_DIBitmap* mask_dib = Mask.GetObject(); m_Type = MaskF; m_Box = rect; m_Box.Intersect(mask_rect); @@ -47,29 +46,28 @@ void CFX_ClipRgn::IntersectMaskRect(FX_RECT rect, return; } if (m_Box == mask_rect) { - m_Mask = pMask; + m_Mask = Mask; return; } - m_Mask = pdfium::MakeRetain<CFX_DIBitmap>(); - m_Mask->Create(m_Box.Width(), m_Box.Height(), FXDIB_8bppMask); + CFX_DIBitmap* new_dib = m_Mask.Emplace(); + new_dib->Create(m_Box.Width(), m_Box.Height(), FXDIB_8bppMask); for (int row = m_Box.top; row < m_Box.bottom; row++) { uint8_t* dest_scan = - m_Mask->GetBuffer() + m_Mask->GetPitch() * (row - m_Box.top); + new_dib->GetBuffer() + new_dib->GetPitch() * (row - m_Box.top); uint8_t* src_scan = - pMask->GetBuffer() + pMask->GetPitch() * (row - mask_rect.top); + mask_dib->GetBuffer() + mask_dib->GetPitch() * (row - mask_rect.top); for (int col = m_Box.left; col < m_Box.right; col++) dest_scan[col - m_Box.left] = src_scan[col - mask_rect.left]; } } -void CFX_ClipRgn::IntersectMaskF(int left, - int top, - const CFX_RetainPtr<CFX_DIBitmap>& pMask) { - ASSERT(pMask->GetFormat() == FXDIB_8bppMask); - FX_RECT mask_box(left, top, left + pMask->GetWidth(), - top + pMask->GetHeight()); +void CFX_ClipRgn::IntersectMaskF(int left, int top, CFX_DIBitmapRef Mask) { + const CFX_DIBitmap* mask_dib = Mask.GetObject(); + ASSERT(mask_dib->GetFormat() == FXDIB_8bppMask); + FX_RECT mask_box(left, top, left + mask_dib->GetWidth(), + top + mask_dib->GetHeight()); if (m_Type == RectI) { - IntersectMaskRect(m_Box, mask_box, pMask); + IntersectMaskRect(m_Box, mask_box, Mask); return; } if (m_Type == MaskF) { @@ -77,16 +75,19 @@ void CFX_ClipRgn::IntersectMaskF(int left, new_box.Intersect(mask_box); if (new_box.IsEmpty()) { m_Type = RectI; - m_Mask = nullptr; + m_Mask.SetNull(); m_Box = new_box; return; } - auto new_dib = pdfium::MakeRetain<CFX_DIBitmap>(); + CFX_DIBitmapRef new_mask; + CFX_DIBitmap* new_dib = new_mask.Emplace(); new_dib->Create(new_box.Width(), new_box.Height(), FXDIB_8bppMask); + const CFX_DIBitmap* old_dib = m_Mask.GetObject(); for (int row = new_box.top; row < new_box.bottom; row++) { uint8_t* old_scan = - m_Mask->GetBuffer() + (row - m_Box.top) * m_Mask->GetPitch(); - uint8_t* mask_scan = pMask->GetBuffer() + (row - top) * pMask->GetPitch(); + old_dib->GetBuffer() + (row - m_Box.top) * old_dib->GetPitch(); + uint8_t* mask_scan = + mask_dib->GetBuffer() + (row - top) * mask_dib->GetPitch(); uint8_t* new_scan = new_dib->GetBuffer() + (row - new_box.top) * new_dib->GetPitch(); for (int col = new_box.left; col < new_box.right; col++) { @@ -95,7 +96,7 @@ void CFX_ClipRgn::IntersectMaskF(int left, } } m_Box = new_box; - m_Mask = std::move(new_dib); + m_Mask = new_mask; return; } ASSERT(false); diff --git a/core/fxge/ge/cfx_cliprgn.h b/core/fxge/ge/cfx_cliprgn.h index ae12347288..f3fd5856b6 100644 --- a/core/fxge/ge/cfx_cliprgn.h +++ b/core/fxge/ge/cfx_cliprgn.h @@ -19,22 +19,18 @@ class CFX_ClipRgn { ClipType GetType() const { return m_Type; } const FX_RECT& GetBox() const { return m_Box; } - CFX_RetainPtr<CFX_DIBitmap> GetMask() const { return m_Mask; } + CFX_DIBitmapRef GetMask() const { return m_Mask; } void Reset(const FX_RECT& rect); void IntersectRect(const FX_RECT& rect); - void IntersectMaskF(int left, - int top, - const CFX_RetainPtr<CFX_DIBitmap>& Mask); + void IntersectMaskF(int left, int top, CFX_DIBitmapRef Mask); private: - void IntersectMaskRect(FX_RECT rect, - FX_RECT mask_box, - const CFX_RetainPtr<CFX_DIBitmap>& Mask); + void IntersectMaskRect(FX_RECT rect, FX_RECT mask_box, CFX_DIBitmapRef Mask); ClipType m_Type; FX_RECT m_Box; - CFX_RetainPtr<CFX_DIBitmap> m_Mask; + CFX_DIBitmapRef m_Mask; }; #endif // CORE_FXGE_GE_CFX_CLIPRGN_H_ diff --git a/core/fxge/ge/cfx_facecache.cpp b/core/fxge/ge/cfx_facecache.cpp index 4c44660426..3cdff44f8b 100644 --- a/core/fxge/ge/cfx_facecache.cpp +++ b/core/fxge/ge/cfx_facecache.cpp @@ -182,14 +182,14 @@ CFX_GlyphBitmap* CFX_FaceCache::RenderGlyph(const CFX_Font* pFont, return nullptr; int dib_width = bmwidth; CFX_GlyphBitmap* pGlyphBitmap = new CFX_GlyphBitmap; - pGlyphBitmap->m_pBitmap->Create( + pGlyphBitmap->m_Bitmap.Create( dib_width, bmheight, anti_alias == FXFT_RENDER_MODE_MONO ? FXDIB_1bppMask : FXDIB_8bppMask); pGlyphBitmap->m_Left = FXFT_Get_Glyph_BitmapLeft(m_Face); pGlyphBitmap->m_Top = FXFT_Get_Glyph_BitmapTop(m_Face); - int dest_pitch = pGlyphBitmap->m_pBitmap->GetPitch(); + int dest_pitch = pGlyphBitmap->m_Bitmap.GetPitch(); int src_pitch = FXFT_Get_Bitmap_Pitch(FXFT_Get_Glyph_Bitmap(m_Face)); - uint8_t* pDestBuf = pGlyphBitmap->m_pBitmap->GetBuffer(); + uint8_t* pDestBuf = pGlyphBitmap->m_Bitmap.GetBuffer(); uint8_t* pSrcBuf = (uint8_t*)FXFT_Get_Bitmap_Buffer(FXFT_Get_Glyph_Bitmap(m_Face)); if (anti_alias != FXFT_RENDER_MODE_MONO && diff --git a/core/fxge/ge/cfx_renderdevice.cpp b/core/fxge/ge/cfx_renderdevice.cpp index 782dbf3e2f..fab318373a 100644 --- a/core/fxge/ge/cfx_renderdevice.cpp +++ b/core/fxge/ge/cfx_renderdevice.cpp @@ -194,8 +194,8 @@ void SetAlpha(uint8_t* alpha) { void SetAlphaDoNothing(uint8_t* alpha) {} -void DrawNormalTextHelper(const CFX_RetainPtr<CFX_DIBitmap>& bitmap, - const CFX_RetainPtr<CFX_DIBitmap>& pGlyph, +void DrawNormalTextHelper(CFX_DIBitmap* bitmap, + const CFX_DIBitmap* pGlyph, int nrows, int left, int top, @@ -416,10 +416,9 @@ CFX_Matrix CFX_RenderDevice::GetCTM() const { return m_pDeviceDriver->GetCTM(); } -bool CFX_RenderDevice::CreateCompatibleBitmap( - const CFX_RetainPtr<CFX_DIBitmap>& pDIB, - int width, - int height) const { +bool CFX_RenderDevice::CreateCompatibleBitmap(CFX_DIBitmap* pDIB, + int width, + int height) const { if (m_RenderCaps & FXRC_CMYK_OUTPUT) { return pDIB->Create(width, height, m_RenderCaps & FXRC_ALPHA_OUTPUT ? FXDIB_Cmyka @@ -611,23 +610,21 @@ bool CFX_RenderDevice::DrawFillStrokePath(const CFX_PathData* pPathData, float fScaleX = FXSYS_fabs(ctm.a); float fScaleY = FXSYS_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), + CFX_DIBitmap bitmap, Backdrop; + if (!CreateCompatibleBitmap(&bitmap, FXSYS_round(rect.Width() * fScaleX), FXSYS_round(rect.Height() * fScaleY))) { return false; } - if (bitmap->HasAlpha()) { - bitmap->Clear(0); - Backdrop->Copy(bitmap); + if (bitmap.HasAlpha()) { + bitmap.Clear(0); + Backdrop.Copy(&bitmap); } else { - if (!m_pDeviceDriver->GetDIBits(bitmap, rect.left, rect.top)) + if (!m_pDeviceDriver->GetDIBits(&bitmap, rect.left, rect.top)) return false; - Backdrop->Copy(bitmap); + Backdrop.Copy(&bitmap); } CFX_FxgeDevice bitmap_device; - bitmap_device.Attach(bitmap, false, Backdrop, true); - + bitmap_device.Attach(&bitmap, false, &Backdrop, true); CFX_Matrix matrix; if (pObject2Device) matrix = *pObject2Device; @@ -643,7 +640,7 @@ bool CFX_RenderDevice::DrawFillStrokePath(const CFX_PathData* pPathData, #endif FX_RECT src_rect(0, 0, FXSYS_round(rect.Width() * fScaleX), FXSYS_round(rect.Height() * fScaleY)); - return m_pDeviceDriver->SetDIBits(bitmap, 0, &src_rect, rect.left, rect.top, + return m_pDeviceDriver->SetDIBits(&bitmap, 0, &src_rect, rect.left, rect.top, FXDIB_BLEND_NORMAL); } @@ -664,19 +661,19 @@ bool CFX_RenderDevice::FillRectWithBlend(const FX_RECT* pRect, if (!(m_RenderCaps & FXRC_GET_BITS)) return false; - auto bitmap = pdfium::MakeRetain<CFX_DIBitmap>(); - if (!CreateCompatibleBitmap(bitmap, pRect->Width(), pRect->Height())) + CFX_DIBitmap bitmap; + if (!CreateCompatibleBitmap(&bitmap, pRect->Width(), pRect->Height())) return false; - if (!m_pDeviceDriver->GetDIBits(bitmap, pRect->left, pRect->top)) + if (!m_pDeviceDriver->GetDIBits(&bitmap, pRect->left, pRect->top)) return false; - if (!bitmap->CompositeRect(0, 0, pRect->Width(), pRect->Height(), fill_color, - 0, nullptr)) { + if (!bitmap.CompositeRect(0, 0, pRect->Width(), pRect->Height(), fill_color, + 0, nullptr)) { return false; } FX_RECT src_rect(0, 0, pRect->Width(), pRect->Height()); - m_pDeviceDriver->SetDIBits(bitmap, 0, &src_rect, pRect->left, pRect->top, + m_pDeviceDriver->SetDIBits(&bitmap, 0, &src_rect, pRect->left, pRect->top, FXDIB_BLEND_NORMAL); return true; } @@ -700,23 +697,20 @@ bool CFX_RenderDevice::DrawCosmeticLine(float x1, fill_mode, blend_type); } -bool CFX_RenderDevice::GetDIBits(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap, - int left, - int top) { +bool CFX_RenderDevice::GetDIBits(CFX_DIBitmap* pBitmap, int left, int top) { if (!(m_RenderCaps & FXRC_GET_BITS)) return false; return m_pDeviceDriver->GetDIBits(pBitmap, left, top); } -CFX_RetainPtr<CFX_DIBitmap> CFX_RenderDevice::GetBackDrop() { +CFX_DIBitmap* CFX_RenderDevice::GetBackDrop() { return m_pDeviceDriver->GetBackDrop(); } -bool CFX_RenderDevice::SetDIBitsWithBlend( - const CFX_RetainPtr<CFX_DIBSource>& pBitmap, - int left, - int top, - int blend_mode) { +bool CFX_RenderDevice::SetDIBitsWithBlend(const CFX_DIBSource* pBitmap, + int left, + int top, + int blend_mode) { ASSERT(!pBitmap->IsAlphaMask()); CFX_Matrix ctm = GetCTM(); float fScaleX = FXSYS_fabs(ctm.a); @@ -727,7 +721,6 @@ bool CFX_RenderDevice::SetDIBitsWithBlend( dest_rect.Intersect(m_ClipBox); if (dest_rect.IsEmpty()) return true; - 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()); @@ -739,26 +732,25 @@ bool CFX_RenderDevice::SetDIBitsWithBlend( (pBitmap->HasAlpha() && !(m_RenderCaps & FXRC_ALPHA_IMAGE))) { 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); - auto background = pdfium::MakeRetain<CFX_DIBitmap>(); - if (!background->Create( + CFX_DIBitmap background; + if (!background.Create( bg_pixel_width, bg_pixel_height, (m_RenderCaps & FXRC_CMYK_OUTPUT) ? FXDIB_Cmyk : FXDIB_Rgb32)) { return false; } - if (!m_pDeviceDriver->GetDIBits(background, dest_rect.left, + if (!m_pDeviceDriver->GetDIBits(&background, dest_rect.left, dest_rect.top)) { return false; } - if (!background->CompositeBitmap(0, 0, bg_pixel_width, bg_pixel_height, - pBitmap, src_rect.left, src_rect.top, - blend_mode, nullptr, false, nullptr)) { + if (!background.CompositeBitmap(0, 0, bg_pixel_width, bg_pixel_height, + pBitmap, src_rect.left, src_rect.top, + blend_mode, nullptr, false, nullptr)) { return false; } FX_RECT rect(0, 0, bg_pixel_width, bg_pixel_height); - return m_pDeviceDriver->SetDIBits(background, 0, &rect, dest_rect.left, + return m_pDeviceDriver->SetDIBits(&background, 0, &rect, dest_rect.left, dest_rect.top, FXDIB_BLEND_NORMAL); } return m_pDeviceDriver->SetDIBits(pBitmap, 0, &src_rect, dest_rect.left, @@ -766,7 +758,7 @@ bool CFX_RenderDevice::SetDIBitsWithBlend( } bool CFX_RenderDevice::StretchDIBitsWithFlagsAndBlend( - const CFX_RetainPtr<CFX_DIBSource>& pBitmap, + const CFX_DIBSource* pBitmap, int left, int top, int dest_width, @@ -783,7 +775,7 @@ bool CFX_RenderDevice::StretchDIBitsWithFlagsAndBlend( blend_mode); } -bool CFX_RenderDevice::SetBitMask(const CFX_RetainPtr<CFX_DIBSource>& pBitmap, +bool CFX_RenderDevice::SetBitMask(const CFX_DIBSource* pBitmap, int left, int top, uint32_t argb) { @@ -792,25 +784,23 @@ bool CFX_RenderDevice::SetBitMask(const CFX_RetainPtr<CFX_DIBSource>& pBitmap, FXDIB_BLEND_NORMAL); } -bool CFX_RenderDevice::StretchBitMask( - const CFX_RetainPtr<CFX_DIBSource>& pBitmap, - int left, - int top, - int dest_width, - int dest_height, - uint32_t color) { +bool CFX_RenderDevice::StretchBitMask(const CFX_DIBSource* pBitmap, + int left, + int top, + int dest_width, + int dest_height, + uint32_t color) { return StretchBitMaskWithFlags(pBitmap, left, top, dest_width, dest_height, color, 0); } -bool CFX_RenderDevice::StretchBitMaskWithFlags( - const CFX_RetainPtr<CFX_DIBSource>& pBitmap, - int left, - int top, - int dest_width, - int dest_height, - uint32_t argb, - uint32_t flags) { +bool CFX_RenderDevice::StretchBitMaskWithFlags(const CFX_DIBSource* pBitmap, + int left, + int top, + int dest_width, + int dest_height, + uint32_t argb, + uint32_t flags) { FX_RECT dest_rect(left, top, left + dest_width, top + dest_height); FX_RECT clip_box = m_ClipBox; clip_box.Intersect(dest_rect); @@ -819,14 +809,13 @@ bool CFX_RenderDevice::StretchBitMaskWithFlags( FXDIB_BLEND_NORMAL); } -bool CFX_RenderDevice::StartDIBitsWithBlend( - const CFX_RetainPtr<CFX_DIBSource>& pBitmap, - int bitmap_alpha, - uint32_t argb, - const CFX_Matrix* pMatrix, - uint32_t flags, - void*& handle, - int blend_mode) { +bool CFX_RenderDevice::StartDIBitsWithBlend(const CFX_DIBSource* pBitmap, + int bitmap_alpha, + uint32_t argb, + const CFX_Matrix* pMatrix, + uint32_t flags, + void*& handle, + int blend_mode) { return m_pDeviceDriver->StartDIBits(pBitmap, bitmap_alpha, argb, pMatrix, flags, handle, blend_mode); } @@ -844,13 +833,12 @@ void CFX_RenderDevice::DebugVerifyBitmapIsPreMultiplied() const { SkASSERT(0); } -bool CFX_RenderDevice::SetBitsWithMask( - const CFX_RetainPtr<CFX_DIBSource>& pBitmap, - const CFX_RetainPtr<CFX_DIBSource>& pMask, - int left, - int top, - int bitmap_alpha, - int blend_type) { +bool CFX_RenderDevice::SetBitsWithMask(const CFX_DIBSource* pBitmap, + const CFX_DIBSource* pMask, + int left, + int top, + int bitmap_alpha, + int blend_type) { return m_pDeviceDriver->SetBitsWithMask(pBitmap, pMask, left, top, bitmap_alpha, blend_type); } @@ -976,43 +964,42 @@ bool CFX_RenderDevice::DrawNormalText(int nChars, 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); if (anti_alias == FXFT_RENDER_MODE_MONO) { - auto bitmap = pdfium::MakeRetain<CFX_DIBitmap>(); - if (!bitmap->Create(pixel_width, pixel_height, FXDIB_1bppMask)) + CFX_DIBitmap bitmap; + if (!bitmap.Create(pixel_width, pixel_height, FXDIB_1bppMask)) return false; - bitmap->Clear(0); + bitmap.Clear(0); for (const FXTEXT_GLYPHPOS& glyph : glyphs) { if (!glyph.m_pGlyph) continue; - CFX_RetainPtr<CFX_DIBitmap> pGlyph = glyph.m_pGlyph->m_pBitmap; - bitmap->TransferBitmap( + const CFX_DIBitmap* pGlyph = &glyph.m_pGlyph->m_Bitmap; + bitmap.TransferBitmap( glyph.m_Origin.x + glyph.m_pGlyph->m_Left - pixel_left, glyph.m_Origin.y - glyph.m_pGlyph->m_Top - pixel_top, pGlyph->GetWidth(), pGlyph->GetHeight(), pGlyph, 0, 0); } - return SetBitMask(bitmap, bmp_rect.left, bmp_rect.top, fill_color); + return SetBitMask(&bitmap, bmp_rect.left, bmp_rect.top, fill_color); } - auto bitmap = pdfium::MakeRetain<CFX_DIBitmap>(); + CFX_DIBitmap bitmap; if (m_bpp == 8) { - if (!bitmap->Create(pixel_width, pixel_height, FXDIB_8bppMask)) + if (!bitmap.Create(pixel_width, pixel_height, FXDIB_8bppMask)) return false; } else { - if (!CreateCompatibleBitmap(bitmap, pixel_width, pixel_height)) + if (!CreateCompatibleBitmap(&bitmap, pixel_width, pixel_height)) return false; } - if (!bitmap->HasAlpha() && !bitmap->IsAlphaMask()) { - bitmap->Clear(0xFFFFFFFF); - if (!GetDIBits(bitmap, bmp_rect.left, bmp_rect.top)) + if (!bitmap.HasAlpha() && !bitmap.IsAlphaMask()) { + bitmap.Clear(0xFFFFFFFF); + if (!GetDIBits(&bitmap, bmp_rect.left, bmp_rect.top)) return false; } else { - bitmap->Clear(0); - if (bitmap->m_pAlphaMask) - bitmap->m_pAlphaMask->Clear(0); + bitmap.Clear(0); + if (bitmap.m_pAlphaMask) + bitmap.m_pAlphaMask->Clear(0); } int dest_width = pixel_width; int a = 0; @@ -1038,14 +1025,14 @@ bool CFX_RenderDevice::DrawNormalText(int nChars, if (!top.IsValid()) return false; - CFX_RetainPtr<CFX_DIBitmap> pGlyph = glyph.m_pGlyph->m_pBitmap; + const CFX_DIBitmap* pGlyph = &glyph.m_pGlyph->m_Bitmap; int ncols = pGlyph->GetWidth(); int nrows = pGlyph->GetHeight(); if (anti_alias == FXFT_RENDER_MODE_NORMAL) { - if (!bitmap->CompositeMask(left.ValueOrDie(), top.ValueOrDie(), ncols, - nrows, pGlyph, fill_color, 0, 0, - FXDIB_BLEND_NORMAL, nullptr, false, 0, - nullptr)) { + if (!bitmap.CompositeMask(left.ValueOrDie(), top.ValueOrDie(), ncols, + nrows, pGlyph, fill_color, 0, 0, + FXDIB_BLEND_NORMAL, nullptr, false, 0, + nullptr)) { return false; } continue; @@ -1065,14 +1052,14 @@ bool CFX_RenderDevice::DrawNormalText(int nChars, if (start_col >= end_col) continue; - DrawNormalTextHelper(bitmap, pGlyph, nrows, left.ValueOrDie(), + DrawNormalTextHelper(&bitmap, pGlyph, nrows, left.ValueOrDie(), top.ValueOrDie(), start_col, end_col, bNormal, bBGRStripe, x_subpixel, a, r, g, b); } - if (bitmap->IsAlphaMask()) - SetBitMask(bitmap, bmp_rect.left, bmp_rect.top, fill_color); + if (bitmap.IsAlphaMask()) + SetBitMask(&bitmap, bmp_rect.left, bmp_rect.top, fill_color); else - SetDIBits(bitmap, bmp_rect.left, bmp_rect.top); + SetDIBits(&bitmap, bmp_rect.left, bmp_rect.top); return true; } diff --git a/core/fxge/ge/fx_ge_text.cpp b/core/fxge/ge/fx_ge_text.cpp index b451b543fc..f3dea9178d 100644 --- a/core/fxge/ge/fx_ge_text.cpp +++ b/core/fxge/ge/fx_ge_text.cpp @@ -59,7 +59,7 @@ FX_RECT FXGE_GetGlyphsBBox(const std::vector<FXTEXT_GLYPHPOS>& glyphs, if (!char_left.IsValid()) continue; - FX_SAFE_INT32 char_width = pGlyph->m_pBitmap->GetWidth(); + FX_SAFE_INT32 char_width = pGlyph->m_Bitmap.GetWidth(); char_width /= retinaScaleX; if (anti_alias == FXFT_RENDER_MODE_LCD) char_width /= 3; @@ -75,7 +75,7 @@ FX_RECT FXGE_GetGlyphsBBox(const std::vector<FXTEXT_GLYPHPOS>& glyphs, if (!char_top.IsValid()) continue; - FX_SAFE_INT32 char_height = pGlyph->m_pBitmap->GetHeight(); + FX_SAFE_INT32 char_height = pGlyph->m_Bitmap.GetHeight(); char_height /= retinaScaleY; if (!char_height.IsValid()) continue; |