summaryrefslogtreecommitdiff
path: root/xfa/fxbarcode/oned/BC_OnedEAN8Writer.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2017-03-27 13:51:46 -0700
committerChromium commit bot <commit-bot@chromium.org>2017-03-28 14:14:50 +0000
commit0004f29bf6ee3c6060a272c79f14993e92e053c7 (patch)
treeb82385e4853a157e10148af8d95ebb6bae4fb4c7 /xfa/fxbarcode/oned/BC_OnedEAN8Writer.cpp
parent369fe1f7f9f3a424ee3cf8f992c3128db27fa479 (diff)
downloadpdfium-0004f29bf6ee3c6060a272c79f14993e92e053c7.tar.xz
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>
Diffstat (limited to 'xfa/fxbarcode/oned/BC_OnedEAN8Writer.cpp')
-rw-r--r--xfa/fxbarcode/oned/BC_OnedEAN8Writer.cpp17
1 files changed, 8 insertions, 9 deletions
diff --git a/xfa/fxbarcode/oned/BC_OnedEAN8Writer.cpp b/xfa/fxbarcode/oned/BC_OnedEAN8Writer.cpp
index 5f571c2a30..a7fa30c811 100644
--- a/xfa/fxbarcode/oned/BC_OnedEAN8Writer.cpp
+++ b/xfa/fxbarcode/oned/BC_OnedEAN8Writer.cpp
@@ -165,13 +165,14 @@ uint8_t* CBC_OnedEAN8Writer::Encode(const CFX_ByteString& contents,
return result;
}
-void CBC_OnedEAN8Writer::ShowChars(const CFX_WideStringC& contents,
- CFX_DIBitmap* pOutBitmap,
- CFX_RenderDevice* device,
- const CFX_Matrix* matrix,
- int32_t barWidth,
- int32_t multiple,
- int32_t& e) {
+void CBC_OnedEAN8Writer::ShowChars(
+ const CFX_WideStringC& contents,
+ const CFX_RetainPtr<CFX_DIBitmap>& pOutBitmap,
+ CFX_RenderDevice* device,
+ const CFX_Matrix* matrix,
+ int32_t barWidth,
+ int32_t multiple,
+ int32_t& e) {
if (!device && !pOutBitmap) {
e = BCExceptionIllegalArgument;
return;
@@ -217,7 +218,6 @@ void CBC_OnedEAN8Writer::ShowChars(const CFX_WideStringC& contents,
CFX_Matrix affine_matrix(1.0, 0.0, 0.0, -1.0, 0.0, (float)iFontSize);
CFX_FxgeDevice ge;
if (pOutBitmap) {
- delete ge.GetBitmap();
ge.Create(strWidth, iTextHeight, FXDIB_Argb, nullptr);
ge.GetBitmap()->Clear(m_backgroundColor);
ge.DrawNormalText(iLen, pCharPos, m_pFont, static_cast<float>(iFontSize),
@@ -237,7 +237,6 @@ void CBC_OnedEAN8Writer::ShowChars(const CFX_WideStringC& contents,
CalcTextInfo(tempStr, pCharPos + 4, m_pFont, (float)strWidth, iFontSize,
blank);
if (pOutBitmap) {
- delete ge.GetBitmap();
ge.Create(strWidth, iTextHeight, FXDIB_Argb, nullptr);
ge.GetBitmap()->Clear(m_backgroundColor);
ge.DrawNormalText(iLen, pCharPos + 4, m_pFont,