summaryrefslogtreecommitdiff
path: root/core/fxge/ge
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2017-03-28 09:31:32 -0700
committerChromium commit bot <commit-bot@chromium.org>2017-03-28 16:42:55 +0000
commitf0799fe84df4d86f25d342b03525f3016d674f86 (patch)
treed6839802a68b7b6ad6fb166179ede779c3560c75 /core/fxge/ge
parent31b08d4cdaa17d7a03f35e087096a77036af98ec (diff)
downloadpdfium-f0799fe84df4d86f25d342b03525f3016d674f86.tar.xz
Revert "Revert "Refcount all CFX_DIBSources (and subclasses) all the time.""
This reverts commit 31b08d4cdaa17d7a03f35e087096a77036af98ec. Re-landing the patch after fixing skia build issue. Change-Id: Ie7039890088b803a6ec5ce365d70f57277459b48 Reviewed-on: https://pdfium-review.googlesource.com/3245 Commit-Queue: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'core/fxge/ge')
-rw-r--r--core/fxge/ge/cfx_cliprgn.cpp43
-rw-r--r--core/fxge/ge/cfx_cliprgn.h12
-rw-r--r--core/fxge/ge/cfx_facecache.cpp6
-rw-r--r--core/fxge/ge/cfx_renderdevice.cpp183
-rw-r--r--core/fxge/ge/fx_ge_text.cpp4
5 files changed, 132 insertions, 116 deletions
diff --git a/core/fxge/ge/cfx_cliprgn.cpp b/core/fxge/ge/cfx_cliprgn.cpp
index ea3eb51f18..5193ce2944 100644
--- a/core/fxge/ge/cfx_cliprgn.cpp
+++ b/core/fxge/ge/cfx_cliprgn.cpp
@@ -6,6 +6,8 @@
#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) {}
@@ -20,7 +22,7 @@ CFX_ClipRgn::~CFX_ClipRgn() {}
void CFX_ClipRgn::Reset(const FX_RECT& rect) {
m_Type = RectI;
m_Box = rect;
- m_Mask.SetNull();
+ m_Mask = nullptr;
}
void CFX_ClipRgn::IntersectRect(const FX_RECT& rect) {
@@ -36,8 +38,7 @@ void CFX_ClipRgn::IntersectRect(const FX_RECT& rect) {
void CFX_ClipRgn::IntersectMaskRect(FX_RECT rect,
FX_RECT mask_rect,
- CFX_DIBitmapRef Mask) {
- const CFX_DIBitmap* mask_dib = Mask.GetObject();
+ const CFX_RetainPtr<CFX_DIBitmap>& pMask) {
m_Type = MaskF;
m_Box = rect;
m_Box.Intersect(mask_rect);
@@ -46,28 +47,29 @@ void CFX_ClipRgn::IntersectMaskRect(FX_RECT rect,
return;
}
if (m_Box == mask_rect) {
- m_Mask = Mask;
+ m_Mask = pMask;
return;
}
- CFX_DIBitmap* new_dib = m_Mask.Emplace();
- new_dib->Create(m_Box.Width(), m_Box.Height(), FXDIB_8bppMask);
+ m_Mask = pdfium::MakeRetain<CFX_DIBitmap>();
+ m_Mask->Create(m_Box.Width(), m_Box.Height(), FXDIB_8bppMask);
for (int row = m_Box.top; row < m_Box.bottom; row++) {
uint8_t* dest_scan =
- new_dib->GetBuffer() + new_dib->GetPitch() * (row - m_Box.top);
+ m_Mask->GetBuffer() + m_Mask->GetPitch() * (row - m_Box.top);
uint8_t* src_scan =
- mask_dib->GetBuffer() + mask_dib->GetPitch() * (row - mask_rect.top);
+ pMask->GetBuffer() + pMask->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, 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());
+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());
if (m_Type == RectI) {
- IntersectMaskRect(m_Box, mask_box, Mask);
+ IntersectMaskRect(m_Box, mask_box, pMask);
return;
}
if (m_Type == MaskF) {
@@ -75,19 +77,16 @@ void CFX_ClipRgn::IntersectMaskF(int left, int top, CFX_DIBitmapRef Mask) {
new_box.Intersect(mask_box);
if (new_box.IsEmpty()) {
m_Type = RectI;
- m_Mask.SetNull();
+ m_Mask = nullptr;
m_Box = new_box;
return;
}
- CFX_DIBitmapRef new_mask;
- CFX_DIBitmap* new_dib = new_mask.Emplace();
+ auto new_dib = pdfium::MakeRetain<CFX_DIBitmap>();
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 =
- old_dib->GetBuffer() + (row - m_Box.top) * old_dib->GetPitch();
- uint8_t* mask_scan =
- mask_dib->GetBuffer() + (row - top) * mask_dib->GetPitch();
+ m_Mask->GetBuffer() + (row - m_Box.top) * m_Mask->GetPitch();
+ uint8_t* mask_scan = pMask->GetBuffer() + (row - top) * pMask->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++) {
@@ -96,7 +95,7 @@ void CFX_ClipRgn::IntersectMaskF(int left, int top, CFX_DIBitmapRef Mask) {
}
}
m_Box = new_box;
- m_Mask = new_mask;
+ m_Mask = std::move(new_dib);
return;
}
ASSERT(false);
diff --git a/core/fxge/ge/cfx_cliprgn.h b/core/fxge/ge/cfx_cliprgn.h
index f3fd5856b6..ae12347288 100644
--- a/core/fxge/ge/cfx_cliprgn.h
+++ b/core/fxge/ge/cfx_cliprgn.h
@@ -19,18 +19,22 @@ class CFX_ClipRgn {
ClipType GetType() const { return m_Type; }
const FX_RECT& GetBox() const { return m_Box; }
- CFX_DIBitmapRef GetMask() const { return m_Mask; }
+ CFX_RetainPtr<CFX_DIBitmap> GetMask() const { return m_Mask; }
void Reset(const FX_RECT& rect);
void IntersectRect(const FX_RECT& rect);
- void IntersectMaskF(int left, int top, CFX_DIBitmapRef Mask);
+ void IntersectMaskF(int left,
+ int top,
+ const CFX_RetainPtr<CFX_DIBitmap>& Mask);
private:
- void IntersectMaskRect(FX_RECT rect, FX_RECT mask_box, CFX_DIBitmapRef Mask);
+ void IntersectMaskRect(FX_RECT rect,
+ FX_RECT mask_box,
+ const CFX_RetainPtr<CFX_DIBitmap>& Mask);
ClipType m_Type;
FX_RECT m_Box;
- CFX_DIBitmapRef m_Mask;
+ CFX_RetainPtr<CFX_DIBitmap> 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 3cdff44f8b..4c44660426 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_Bitmap.Create(
+ pGlyphBitmap->m_pBitmap->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_Bitmap.GetPitch();
+ int dest_pitch = pGlyphBitmap->m_pBitmap->GetPitch();
int src_pitch = FXFT_Get_Bitmap_Pitch(FXFT_Get_Glyph_Bitmap(m_Face));
- uint8_t* pDestBuf = pGlyphBitmap->m_Bitmap.GetBuffer();
+ uint8_t* pDestBuf = pGlyphBitmap->m_pBitmap->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 fab318373a..782dbf3e2f 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(CFX_DIBitmap* bitmap,
- const CFX_DIBitmap* pGlyph,
+void DrawNormalTextHelper(const CFX_RetainPtr<CFX_DIBitmap>& bitmap,
+ const CFX_RetainPtr<CFX_DIBitmap>& pGlyph,
int nrows,
int left,
int top,
@@ -416,9 +416,10 @@ CFX_Matrix CFX_RenderDevice::GetCTM() const {
return m_pDeviceDriver->GetCTM();
}
-bool CFX_RenderDevice::CreateCompatibleBitmap(CFX_DIBitmap* pDIB,
- int width,
- int height) const {
+bool CFX_RenderDevice::CreateCompatibleBitmap(
+ const CFX_RetainPtr<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
@@ -610,21 +611,23 @@ 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();
- CFX_DIBitmap bitmap, Backdrop;
- if (!CreateCompatibleBitmap(&bitmap, FXSYS_round(rect.Width() * fScaleX),
+ 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))) {
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;
@@ -640,7 +643,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);
}
@@ -661,19 +664,19 @@ bool CFX_RenderDevice::FillRectWithBlend(const FX_RECT* pRect,
if (!(m_RenderCaps & FXRC_GET_BITS))
return false;
- CFX_DIBitmap bitmap;
- if (!CreateCompatibleBitmap(&bitmap, pRect->Width(), pRect->Height()))
+ auto bitmap = pdfium::MakeRetain<CFX_DIBitmap>();
+ 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;
}
@@ -697,20 +700,23 @@ bool CFX_RenderDevice::DrawCosmeticLine(float x1,
fill_mode, blend_type);
}
-bool CFX_RenderDevice::GetDIBits(CFX_DIBitmap* pBitmap, int left, int top) {
+bool CFX_RenderDevice::GetDIBits(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap,
+ int left,
+ int top) {
if (!(m_RenderCaps & FXRC_GET_BITS))
return false;
return m_pDeviceDriver->GetDIBits(pBitmap, left, top);
}
-CFX_DIBitmap* CFX_RenderDevice::GetBackDrop() {
+CFX_RetainPtr<CFX_DIBitmap> CFX_RenderDevice::GetBackDrop() {
return m_pDeviceDriver->GetBackDrop();
}
-bool CFX_RenderDevice::SetDIBitsWithBlend(const CFX_DIBSource* pBitmap,
- int left,
- int top,
- int blend_mode) {
+bool CFX_RenderDevice::SetDIBitsWithBlend(
+ const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
+ int left,
+ int top,
+ int blend_mode) {
ASSERT(!pBitmap->IsAlphaMask());
CFX_Matrix ctm = GetCTM();
float fScaleX = FXSYS_fabs(ctm.a);
@@ -721,6 +727,7 @@ bool CFX_RenderDevice::SetDIBitsWithBlend(const CFX_DIBSource* pBitmap,
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());
@@ -732,25 +739,26 @@ bool CFX_RenderDevice::SetDIBitsWithBlend(const CFX_DIBSource* pBitmap,
(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);
- CFX_DIBitmap background;
- if (!background.Create(
+ auto background = pdfium::MakeRetain<CFX_DIBitmap>();
+ 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,
@@ -758,7 +766,7 @@ bool CFX_RenderDevice::SetDIBitsWithBlend(const CFX_DIBSource* pBitmap,
}
bool CFX_RenderDevice::StretchDIBitsWithFlagsAndBlend(
- const CFX_DIBSource* pBitmap,
+ const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
int left,
int top,
int dest_width,
@@ -775,7 +783,7 @@ bool CFX_RenderDevice::StretchDIBitsWithFlagsAndBlend(
blend_mode);
}
-bool CFX_RenderDevice::SetBitMask(const CFX_DIBSource* pBitmap,
+bool CFX_RenderDevice::SetBitMask(const CFX_RetainPtr<CFX_DIBSource>& pBitmap,
int left,
int top,
uint32_t argb) {
@@ -784,23 +792,25 @@ bool CFX_RenderDevice::SetBitMask(const CFX_DIBSource* pBitmap,
FXDIB_BLEND_NORMAL);
}
-bool CFX_RenderDevice::StretchBitMask(const CFX_DIBSource* pBitmap,
- int left,
- int top,
- int dest_width,
- int dest_height,
- uint32_t color) {
+bool CFX_RenderDevice::StretchBitMask(
+ const CFX_RetainPtr<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_DIBSource* pBitmap,
- int left,
- int top,
- int dest_width,
- int dest_height,
- uint32_t argb,
- uint32_t flags) {
+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) {
FX_RECT dest_rect(left, top, left + dest_width, top + dest_height);
FX_RECT clip_box = m_ClipBox;
clip_box.Intersect(dest_rect);
@@ -809,13 +819,14 @@ bool CFX_RenderDevice::StretchBitMaskWithFlags(const CFX_DIBSource* pBitmap,
FXDIB_BLEND_NORMAL);
}
-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) {
+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) {
return m_pDeviceDriver->StartDIBits(pBitmap, bitmap_alpha, argb, pMatrix,
flags, handle, blend_mode);
}
@@ -833,12 +844,13 @@ void CFX_RenderDevice::DebugVerifyBitmapIsPreMultiplied() const {
SkASSERT(0);
}
-bool CFX_RenderDevice::SetBitsWithMask(const CFX_DIBSource* pBitmap,
- const CFX_DIBSource* pMask,
- int left,
- int top,
- int bitmap_alpha,
- int blend_type) {
+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) {
return m_pDeviceDriver->SetBitsWithMask(pBitmap, pMask, left, top,
bitmap_alpha, blend_type);
}
@@ -964,42 +976,43 @@ 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) {
- CFX_DIBitmap bitmap;
- if (!bitmap.Create(pixel_width, pixel_height, FXDIB_1bppMask))
+ auto bitmap = pdfium::MakeRetain<CFX_DIBitmap>();
+ 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;
- const CFX_DIBitmap* pGlyph = &glyph.m_pGlyph->m_Bitmap;
- bitmap.TransferBitmap(
+ CFX_RetainPtr<CFX_DIBitmap> pGlyph = glyph.m_pGlyph->m_pBitmap;
+ 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);
}
- CFX_DIBitmap bitmap;
+ auto bitmap = pdfium::MakeRetain<CFX_DIBitmap>();
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;
@@ -1025,14 +1038,14 @@ bool CFX_RenderDevice::DrawNormalText(int nChars,
if (!top.IsValid())
return false;
- const CFX_DIBitmap* pGlyph = &glyph.m_pGlyph->m_Bitmap;
+ CFX_RetainPtr<CFX_DIBitmap> pGlyph = glyph.m_pGlyph->m_pBitmap;
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;
@@ -1052,14 +1065,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 f3dea9178d..b451b543fc 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_Bitmap.GetWidth();
+ FX_SAFE_INT32 char_width = pGlyph->m_pBitmap->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_Bitmap.GetHeight();
+ FX_SAFE_INT32 char_height = pGlyph->m_pBitmap->GetHeight();
char_height /= retinaScaleY;
if (!char_height.IsValid())
continue;