summaryrefslogtreecommitdiff
path: root/core/fpdfapi/fpdf_render
diff options
context:
space:
mode:
authorthestig <thestig@chromium.org>2016-05-26 20:15:19 -0700
committerCommit bot <commit-bot@chromium.org>2016-05-26 20:15:19 -0700
commitbefa4506dc9d2a679c526aff96c09bcb0e9daecb (patch)
tree3c1d3e11d9802b2db95e35f4ab81ff449492ee10 /core/fpdfapi/fpdf_render
parent7aed76f53137a71491040c776ab2f8931e91061b (diff)
downloadpdfium-befa4506dc9d2a679c526aff96c09bcb0e9daecb.tar.xz
Remove default arguments from CFX_FxgeDevice.
Remove unused dithering code. Review-Url: https://codereview.chromium.org/2010813003
Diffstat (limited to 'core/fpdfapi/fpdf_render')
-rw-r--r--core/fpdfapi/fpdf_render/fpdf_render.cpp34
-rw-r--r--core/fpdfapi/fpdf_render/fpdf_render_image.cpp29
-rw-r--r--core/fpdfapi/fpdf_render/fpdf_render_pattern.cpp4
-rw-r--r--core/fpdfapi/fpdf_render/fpdf_render_text.cpp3
-rw-r--r--core/fpdfapi/fpdf_render/render_int.h11
5 files changed, 28 insertions, 53 deletions
diff --git a/core/fpdfapi/fpdf_render/fpdf_render.cpp b/core/fpdfapi/fpdf_render/fpdf_render.cpp
index b69863b5b0..a3dbbdb3f2 100644
--- a/core/fpdfapi/fpdf_render/fpdf_render.cpp
+++ b/core/fpdfapi/fpdf_render/fpdf_render.cpp
@@ -142,7 +142,6 @@ CPDF_RenderStatus::CPDF_RenderStatus()
m_HalftoneLimit(0),
m_bPrint(FALSE),
m_Transparency(0),
- m_DitherBits(0),
m_bDropObjects(FALSE),
m_bStdCS(FALSE),
m_GroupFamily(0),
@@ -170,7 +169,6 @@ FX_BOOL CPDF_RenderStatus::Initialize(CPDF_RenderContext* pContext,
FX_BOOL bLoadMask) {
m_pContext = pContext;
m_pDevice = pDevice;
- m_DitherBits = pDevice->GetDeviceCaps(FXDC_DITHER_BITS);
m_bPrint = m_pDevice->GetDeviceClass() != FXDC_DISPLAY;
if (pDeviceMatrix) {
m_DeviceMatrix = *pDeviceMatrix;
@@ -320,28 +318,6 @@ FX_BOOL CPDF_RenderStatus::GetObjectClippedRect(const CPDF_PageObject* pObj,
rect.Intersect(rtClip);
return rect.IsEmpty();
}
-void CPDF_RenderStatus::DitherObjectArea(const CPDF_PageObject* pObj,
- const CFX_Matrix* pObj2Device) {
- CFX_DIBitmap* pBitmap = m_pDevice->GetBitmap();
- if (!pBitmap) {
- return;
- }
- FX_RECT rect;
- if (GetObjectClippedRect(pObj, pObj2Device, FALSE, rect)) {
- return;
- }
- if (m_DitherBits == 2) {
- static FX_ARGB pal[4] = {0, 85, 170, 255};
- pBitmap->DitherFS(pal, 4, &rect);
- } else if (m_DitherBits == 3) {
- static FX_ARGB pal[8] = {0, 36, 73, 109, 146, 182, 219, 255};
- pBitmap->DitherFS(pal, 8, &rect);
- } else if (m_DitherBits == 4) {
- static FX_ARGB pal[16] = {0, 17, 34, 51, 68, 85, 102, 119,
- 136, 153, 170, 187, 204, 221, 238, 255};
- pBitmap->DitherFS(pal, 16, &rect);
- }
-}
void CPDF_RenderStatus::ProcessObjectNoClip(const CPDF_PageObject* pObj,
const CFX_Matrix* pObj2Device) {
@@ -788,7 +764,7 @@ FX_BOOL CPDF_RenderStatus::ProcessTransparency(const CPDF_PageObject* pPageObj,
m_pDevice->GetDIBits(oriDevice.get(), rect.left, rect.top);
}
- if (!bitmap_device.Create(width, height, FXDIB_Argb, 0, oriDevice.get()))
+ if (!bitmap_device.Create(width, height, FXDIB_Argb, oriDevice.get()))
return TRUE;
CFX_DIBitmap* bitmap = bitmap_device.GetBitmap();
@@ -804,7 +780,7 @@ FX_BOOL CPDF_RenderStatus::ProcessTransparency(const CPDF_PageObject* pPageObj,
pTextMask->Clear(0);
CFX_FxgeDevice text_device;
- text_device.Attach(pTextMask.get());
+ text_device.Attach(pTextMask.get(), false, nullptr, false);
for (uint32_t i = 0; i < pPageObj->m_ClipPath.GetTextCount(); i++) {
CPDF_TextObject* textobj = pPageObj->m_ClipPath.GetText(i);
if (!textobj) {
@@ -890,7 +866,7 @@ CFX_DIBitmap* CPDF_RenderStatus::GetBackdrop(const CPDF_PageObject* pObj,
FinalMatrix.Scale(scaleX, scaleY);
pBackdrop->Clear(pBackdrop->HasAlpha() ? 0 : 0xffffffff);
CFX_FxgeDevice device;
- device.Attach(pBackdrop.get());
+ device.Attach(pBackdrop.get(), false, nullptr, false);
m_pContext->Render(&device, pObj, &m_Options, &FinalMatrix);
return pBackdrop.release();
}
@@ -900,7 +876,7 @@ void CPDF_RenderContext::GetBackground(CFX_DIBitmap* pBuffer,
const CPDF_RenderOptions* pOptions,
CFX_Matrix* pFinalMatrix) {
CFX_FxgeDevice device;
- device.Attach(pBuffer);
+ device.Attach(pBuffer, false, nullptr, false);
FX_RECT rect(0, 0, device.GetWidth(), device.GetHeight());
device.FillRect(&rect, 0xffffffff);
@@ -1282,7 +1258,7 @@ FX_BOOL CPDF_ScaledRenderBuffer::Initialize(CPDF_RenderContext* pContext,
return FALSE;
if (iPitch * iHeight <= _FPDFAPI_IMAGESIZE_LIMIT_ &&
- m_pBitmapDevice->Create(iWidth, iHeight, dibFormat)) {
+ m_pBitmapDevice->Create(iWidth, iHeight, dibFormat, nullptr)) {
break;
}
m_Matrix.Scale(0.5f, 0.5f);
diff --git a/core/fpdfapi/fpdf_render/fpdf_render_image.cpp b/core/fpdfapi/fpdf_render/fpdf_render_image.cpp
index f7e57c0fa6..d3fbb7990c 100644
--- a/core/fpdfapi/fpdf_render/fpdf_render_image.cpp
+++ b/core/fpdfapi/fpdf_render/fpdf_render_image.cpp
@@ -523,9 +523,9 @@ FX_BOOL CPDF_ImageRenderer::DrawPatternImage(const CFX_Matrix* pObj2Device) {
int width = rect.Width();
int height = rect.Height();
CFX_FxgeDevice bitmap_device1;
- if (!bitmap_device1.Create(rect.Width(), rect.Height(), FXDIB_Rgb32)) {
+ if (!bitmap_device1.Create(rect.Width(), rect.Height(), FXDIB_Rgb32, nullptr))
return TRUE;
- }
+
bitmap_device1.GetBitmap()->Clear(0xffffff);
{
CPDF_RenderStatus bitmap_render;
@@ -545,7 +545,8 @@ FX_BOOL CPDF_ImageRenderer::DrawPatternImage(const CFX_Matrix* pObj2Device) {
}
{
CFX_FxgeDevice bitmap_device2;
- if (!bitmap_device2.Create(rect.Width(), rect.Height(), FXDIB_8bppRgb)) {
+ if (!bitmap_device2.Create(rect.Width(), rect.Height(), FXDIB_8bppRgb,
+ nullptr)) {
return TRUE;
}
bitmap_device2.GetBitmap()->Clear(0);
@@ -621,9 +622,9 @@ FX_BOOL CPDF_ImageRenderer::DrawMaskedImage() {
int width = rect.Width();
int height = rect.Height();
CFX_FxgeDevice bitmap_device1;
- if (!bitmap_device1.Create(width, height, FXDIB_Rgb32)) {
+ if (!bitmap_device1.Create(width, height, FXDIB_Rgb32, nullptr))
return TRUE;
- }
+
bitmap_device1.GetBitmap()->Clear(0xffffff);
{
CPDF_RenderStatus bitmap_render;
@@ -638,9 +639,9 @@ FX_BOOL CPDF_ImageRenderer::DrawMaskedImage() {
}
{
CFX_FxgeDevice bitmap_device2;
- if (!bitmap_device2.Create(width, height, FXDIB_8bppRgb)) {
+ if (!bitmap_device2.Create(width, height, FXDIB_8bppRgb, nullptr))
return TRUE;
- }
+
bitmap_device2.GetBitmap()->Clear(0);
CPDF_RenderStatus bitmap_render;
bitmap_render.Initialize(m_pRenderStatus->m_pContext, &bitmap_device2, NULL,
@@ -900,17 +901,15 @@ CFX_DIBitmap* CPDF_RenderStatus::LoadSMask(CPDF_Dictionary* pSMaskDict,
FX_BOOL bLuminosity = pSMaskDict->GetStringBy("S") != "Alpha";
int width = pClipRect->right - pClipRect->left;
int height = pClipRect->bottom - pClipRect->top;
+ FXDIB_Format format;
#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
- if (!bitmap_device.Create(width, height,
- bLuminosity ? FXDIB_Rgb32 : FXDIB_8bppMask)) {
- return NULL;
- }
+ format = bLuminosity ? FXDIB_Rgb32 : FXDIB_8bppMask;
#else
- if (!bitmap_device.Create(width, height,
- bLuminosity ? FXDIB_Rgb : FXDIB_8bppMask)) {
- return NULL;
- }
+ format = bLuminosity ? FXDIB_Rgb : FXDIB_8bppMask;
#endif
+ if (!bitmap_device.Create(width, height, format, nullptr))
+ return nullptr;
+
CFX_DIBitmap& bitmap = *bitmap_device.GetBitmap();
CPDF_Object* pCSObj = NULL;
CPDF_ColorSpace* pCS = NULL;
diff --git a/core/fpdfapi/fpdf_render/fpdf_render_pattern.cpp b/core/fpdfapi/fpdf_render/fpdf_render_pattern.cpp
index 393b993e35..754394da70 100644
--- a/core/fpdfapi/fpdf_render/fpdf_render_pattern.cpp
+++ b/core/fpdfapi/fpdf_render/fpdf_render_pattern.cpp
@@ -752,7 +752,7 @@ void DrawCoonPatchMeshes(
ASSERT(pBitmap->GetFormat() == FXDIB_Argb);
CFX_FxgeDevice device;
- device.Attach(pBitmap);
+ device.Attach(pBitmap, false, nullptr, false);
CPDF_MeshStream stream(funcs, pCS);
if (!stream.Load(pShadingStream))
return;
@@ -830,7 +830,7 @@ std::unique_ptr<CFX_DIBitmap> DrawPatternBitmap(
return std::unique_ptr<CFX_DIBitmap>();
}
CFX_FxgeDevice bitmap_device;
- bitmap_device.Attach(pBitmap.get());
+ bitmap_device.Attach(pBitmap.get(), false, nullptr, false);
pBitmap->Clear(0);
CFX_FloatRect cell_bbox = pPattern->bbox();
pPattern->pattern_to_form()->TransformRect(cell_bbox);
diff --git a/core/fpdfapi/fpdf_render/fpdf_render_text.cpp b/core/fpdfapi/fpdf_render/fpdf_render_text.cpp
index e4ee49afc9..a3df1c2214 100644
--- a/core/fpdfapi/fpdf_render/fpdf_render_text.cpp
+++ b/core/fpdfapi/fpdf_render/fpdf_render_text.cpp
@@ -437,7 +437,8 @@ FX_BOOL CPDF_RenderStatus::ProcessType3Text(const CPDF_TextObject* textobj,
FX_RECT rect = rect_f.GetOutterRect();
CFX_FxgeDevice bitmap_device;
if (!bitmap_device.Create((int)(rect.Width() * sa),
- (int)(rect.Height() * sd), FXDIB_Argb)) {
+ (int)(rect.Height() * sd), FXDIB_Argb,
+ nullptr)) {
return TRUE;
}
bitmap_device.GetBitmap()->Clear(0);
diff --git a/core/fpdfapi/fpdf_render/render_int.h b/core/fpdfapi/fpdf_render/render_int.h
index 46689d3b68..98822797b0 100644
--- a/core/fpdfapi/fpdf_render/render_int.h
+++ b/core/fpdfapi/fpdf_render/render_int.h
@@ -123,6 +123,7 @@ class CPDF_RenderStatus {
public:
CPDF_RenderStatus();
~CPDF_RenderStatus();
+
FX_BOOL Initialize(class CPDF_RenderContext* pContext,
CFX_RenderDevice* pDevice,
const CFX_Matrix* pDeviceMatrix,
@@ -155,6 +156,7 @@ class CPDF_RenderStatus {
protected:
friend class CPDF_ImageRenderer;
friend class CPDF_RenderContext;
+
void ProcessClipPath(CPDF_ClipPath ClipPath, const CFX_Matrix* pObj2Device);
void DrawClipPath(CPDF_ClipPath ClipPath, const CFX_Matrix* pObj2Device);
FX_BOOL ProcessTransparency(const CPDF_PageObject* PageObj,
@@ -242,20 +244,17 @@ class CPDF_RenderStatus {
FX_ARGB GetFillArgb(const CPDF_PageObject* pObj,
FX_BOOL bType3 = FALSE) const;
FX_ARGB GetStrokeArgb(const CPDF_PageObject* pObj) const;
- CPDF_RenderContext* m_pContext;
- FX_BOOL m_bStopped;
- void DitherObjectArea(const CPDF_PageObject* pObj,
- const CFX_Matrix* pObj2Device);
FX_BOOL GetObjectClippedRect(const CPDF_PageObject* pObj,
const CFX_Matrix* pObj2Device,
FX_BOOL bLogical,
FX_RECT& rect) const;
void GetScaledMatrix(CFX_Matrix& matrix) const;
- protected:
static const int kRenderMaxRecursionDepth = 64;
static int s_CurrentRecursionDepth;
+ CPDF_RenderContext* m_pContext;
+ FX_BOOL m_bStopped;
CFX_RenderDevice* m_pDevice;
CFX_Matrix m_DeviceMatrix;
CPDF_ClipPath m_LastClipPath;
@@ -266,7 +265,6 @@ class CPDF_RenderStatus {
std::unique_ptr<CPDF_ImageRenderer> m_pImageRenderer;
FX_BOOL m_bPrint;
int m_Transparency;
- int m_DitherBits;
FX_BOOL m_bDropObjects;
FX_BOOL m_bStdCS;
uint32_t m_GroupFamily;
@@ -275,6 +273,7 @@ class CPDF_RenderStatus {
FX_ARGB m_T3FillColor;
int m_curBlend;
};
+
class CPDF_ImageLoader {
public:
CPDF_ImageLoader()