| Index: core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp
|
| diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp
|
| index 1452b9d9f966f376710898295e855dbc1fcb1963..ffe559ad543be34670668871f6c567d412cd745d 100644
|
| --- a/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp
|
| +++ b/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp
|
| @@ -17,53 +17,8 @@ FX_BOOL CPDF_RenderStatus::ProcessImage(CPDF_ImageObject* pImageObj, const CFX_A
|
| if (render.Start(this, pImageObj, pObj2Device, m_bStdCS, m_curBlend)) {
|
| render.Continue(NULL);
|
| }
|
| -#ifdef _FPDFAPI_MINI_
|
| - if (m_DitherBits) {
|
| - DitherObjectArea(pImageObj, pObj2Device);
|
| - }
|
| -#endif
|
| return render.m_Result;
|
| }
|
| -#if defined(_FPDFAPI_MINI_)
|
| -FX_BOOL CPDF_RenderStatus::ProcessInlines(CPDF_InlineImages* pInlines, const CFX_AffineMatrix* pObj2Device)
|
| -{
|
| - int bitmap_alpha = 255;
|
| - if (!pInlines->m_GeneralState.IsNull()) {
|
| - bitmap_alpha = FXSYS_round(pInlines->m_GeneralState.GetObject()->m_FillAlpha * 255);
|
| - }
|
| - if (pInlines->m_pStream) {
|
| - CPDF_DIBSource dibsrc;
|
| - if (!dibsrc.Load(m_pContext->m_pDocument, pInlines->m_pStream, NULL, NULL, NULL, NULL)) {
|
| - return TRUE;
|
| - }
|
| - pInlines->m_pBitmap = dibsrc.Clone();
|
| - pInlines->m_pStream->Release();
|
| - pInlines->m_pStream = NULL;
|
| - }
|
| - if (pInlines->m_pBitmap == NULL) {
|
| - return TRUE;
|
| - }
|
| - FX_ARGB fill_argb = 0;
|
| - if (pInlines->m_pBitmap->IsAlphaMask()) {
|
| - fill_argb = GetFillArgb(pInlines);
|
| - }
|
| - int flags = 0;
|
| - if (m_Options.m_Flags & RENDER_FORCE_DOWNSAMPLE) {
|
| - flags |= RENDER_FORCE_DOWNSAMPLE;
|
| - } else if (m_Options.m_Flags & RENDER_FORCE_HALFTONE) {
|
| - flags = 0;
|
| - }
|
| - for (int i = 0; i < pInlines->m_Matrices.GetSize(); i ++) {
|
| - CFX_AffineMatrix image_matrix = pInlines->m_Matrices.GetAt(i);
|
| - image_matrix.Concat(*pObj2Device);
|
| - CPDF_ImageRenderer renderer;
|
| - if (renderer.Start(this, pInlines->m_pBitmap, fill_argb, bitmap_alpha, &image_matrix, flags, FALSE, m_curBlend)) {
|
| - renderer.Continue(NULL);
|
| - }
|
| - }
|
| - return TRUE;
|
| -}
|
| -#endif
|
| void CPDF_RenderStatus::CompositeDIBitmap(CFX_DIBitmap* pDIBitmap, int left, int top, FX_ARGB mask_argb,
|
| int bitmap_alpha, int blend_mode, int Transparency)
|
| {
|
| @@ -392,7 +347,6 @@ FX_BOOL CPDF_ImageRenderer::StartRenderDIBSource()
|
| if (m_pRenderStatus->m_Options.m_ColorMode == RENDER_COLOR_ALPHA && m_Loader.m_pMask == NULL) {
|
| return StartBitmapAlpha();
|
| }
|
| -#ifndef _FPDFAPI_MINI_
|
| if (pGeneralState && pGeneralState->m_pTR) {
|
| if (!pGeneralState->m_pTransferFunc) {
|
| ((CPDF_GeneralStateData*)pGeneralState)->m_pTransferFunc = m_pRenderStatus->GetTransferFunc(pGeneralState->m_pTR);
|
| @@ -405,7 +359,6 @@ FX_BOOL CPDF_ImageRenderer::StartRenderDIBSource()
|
| m_Loader.m_bCached = FALSE;
|
| }
|
| }
|
| -#endif
|
| m_FillArgb = 0;
|
| m_bPatternColor = FALSE;
|
| m_pPattern = NULL;
|
| @@ -424,32 +377,11 @@ FX_BOOL CPDF_ImageRenderer::StartRenderDIBSource()
|
| m_pDIBSource = m_pClone;
|
| }
|
| m_Flags = 0;
|
| -#if !defined(_FPDFAPI_MINI_)
|
| if (m_pRenderStatus->m_Options.m_Flags & RENDER_FORCE_DOWNSAMPLE) {
|
| m_Flags |= RENDER_FORCE_DOWNSAMPLE;
|
| } else if (m_pRenderStatus->m_Options.m_Flags & RENDER_FORCE_HALFTONE) {
|
| m_Flags |= RENDER_FORCE_HALFTONE;
|
| }
|
| -#else
|
| - if (!(m_pRenderStatus->m_Options.m_Flags & RENDER_FORCE_HALFTONE)) {
|
| - if (m_pRenderStatus->m_HalftoneLimit) {
|
| - CFX_FloatRect image_rect_f = m_ImageMatrix.GetUnitRect();
|
| - FX_RECT image_rect = image_rect_f.GetOutterRect();
|
| - FX_RECT image_clip = image_rect;
|
| - image_rect.Intersect(m_pRenderStatus->m_pDevice->GetClipBox());
|
| - if (image_rect.Width() && image_rect.Height()) {
|
| - if ((image_clip.Width() * m_pDIBSource->GetWidth() / image_rect.Width()) *
|
| - (image_clip.Height() * m_pDIBSource->GetHeight() / image_rect.Height()) >
|
| - m_pRenderStatus->m_HalftoneLimit) {
|
| - m_Flags |= RENDER_FORCE_DOWNSAMPLE;
|
| - }
|
| - }
|
| - } else {
|
| - m_Flags |= RENDER_FORCE_DOWNSAMPLE;
|
| - }
|
| - }
|
| -#endif
|
| -#ifndef _FPDFAPI_MINI_
|
| if (m_pRenderStatus->m_pDevice->GetDeviceClass() != FXDC_DISPLAY) {
|
| CPDF_Object* pFilters = m_pImageObject->m_pImage->GetStream()->GetDict()->GetElementValue(FX_BSTRC("Filter"));
|
| if (pFilters) {
|
| @@ -475,14 +407,12 @@ FX_BOOL CPDF_ImageRenderer::StartRenderDIBSource()
|
| } else if (m_pImageObject->m_pImage->IsInterpol()) {
|
| m_Flags |= FXDIB_INTERPOL;
|
| }
|
| -#endif
|
| if (m_Loader.m_pMask) {
|
| return DrawMaskedImage();
|
| }
|
| if (m_bPatternColor) {
|
| return DrawPatternImage(m_pObj2Device);
|
| }
|
| -#if !defined(_FPDFAPI_MINI_) || defined(_FXCORE_FEATURE_ALL_)
|
| if (m_BitmapAlpha == 255 && pGeneralState && pGeneralState->m_FillOP &&
|
| pGeneralState->m_OPMode == 0 && pGeneralState->m_BlendType == FXDIB_BLEND_NORMAL && pGeneralState->m_StrokeAlpha == 1 && pGeneralState->m_FillAlpha == 1) {
|
| CPDF_Document* pDocument = NULL;
|
| @@ -504,7 +434,6 @@ FX_BOOL CPDF_ImageRenderer::StartRenderDIBSource()
|
| pDocument->GetPageData()->ReleaseColorSpace(pCSObj);
|
| }
|
| }
|
| -#endif
|
| return StartDIBSource();
|
| }
|
| FX_BOOL CPDF_ImageRenderer::Start(CPDF_RenderStatus* pStatus, const CPDF_PageObject* pObj, const CFX_AffineMatrix* pObj2Device, FX_BOOL bStdCS, int blendType)
|
| @@ -514,12 +443,10 @@ FX_BOOL CPDF_ImageRenderer::Start(CPDF_RenderStatus* pStatus, const CPDF_PageObj
|
| m_pImageObject = (CPDF_ImageObject*)pObj;
|
| m_BlendType = blendType;
|
| m_pObj2Device = pObj2Device;
|
| -#ifndef _FPDFAPI_MINI_
|
| CPDF_Dictionary* pOC = m_pImageObject->m_pImage->GetOC();
|
| if (pOC && m_pRenderStatus->m_Options.m_pOCContext && !m_pRenderStatus->m_Options.m_pOCContext->CheckOCGVisible(pOC)) {
|
| return FALSE;
|
| }
|
| -#endif
|
| m_ImageMatrix = m_pImageObject->m_Matrix;
|
| m_ImageMatrix.Concat(*pObj2Device);
|
| if (StartLoadDIBSource()) {
|
| @@ -721,14 +648,12 @@ FX_BOOL CPDF_ImageRenderer::DrawMaskedImage()
|
| }
|
| FX_BOOL CPDF_ImageRenderer::StartDIBSource()
|
| {
|
| -#if !defined(_FPDFAPI_MINI_)
|
| if (!(m_Flags & RENDER_FORCE_DOWNSAMPLE) && m_pDIBSource->GetBPP() > 1) {
|
| int image_size = m_pDIBSource->GetBPP() / 8 * m_pDIBSource->GetWidth() * m_pDIBSource->GetHeight();
|
| if (image_size > FPDF_HUGE_IMAGE_SIZE && !(m_Flags & RENDER_FORCE_HALFTONE)) {
|
| m_Flags |= RENDER_FORCE_DOWNSAMPLE;
|
| }
|
| }
|
| -#endif
|
| if (m_pRenderStatus->m_pDevice->StartDIBits(m_pDIBSource, m_BitmapAlpha, m_FillArgb,
|
| &m_ImageMatrix, m_Flags, m_DeviceHandle, 0, NULL, m_BlendType)) {
|
| if (m_DeviceHandle != NULL) {
|
| @@ -737,7 +662,6 @@ FX_BOOL CPDF_ImageRenderer::StartDIBSource()
|
| }
|
| return FALSE;
|
| }
|
| -#if !defined(_FPDFAPI_MINI_) || defined(_FXCORE_FEATURE_ALL_)
|
| CFX_FloatRect image_rect_f = m_ImageMatrix.GetUnitRect();
|
| FX_RECT image_rect = image_rect_f.GetOutterRect();
|
| int dest_width = image_rect.Width();
|
| @@ -794,12 +718,10 @@ FX_BOOL CPDF_ImageRenderer::StartDIBSource()
|
| delete pStretched;
|
| pStretched = NULL;
|
| }
|
| -#endif
|
| return FALSE;
|
| }
|
| FX_BOOL CPDF_ImageRenderer::StartBitmapAlpha()
|
| {
|
| -#ifndef _FPDFAPI_MINI_
|
| if (m_pDIBSource->IsOpaqueImage()) {
|
| CFX_PathData path;
|
| path.AppendRect(0, 0, 1, 1);
|
| @@ -830,13 +752,11 @@ FX_BOOL CPDF_ImageRenderer::StartBitmapAlpha()
|
| delete pAlphaMask;
|
| }
|
| }
|
| -#endif
|
| return FALSE;
|
| }
|
| FX_BOOL CPDF_ImageRenderer::Continue(IFX_Pause* pPause)
|
| {
|
| if (m_Status == 1) {
|
| -#ifndef _FPDFAPI_MINI_
|
| if (m_pQuickStretcher->Continue(pPause)) {
|
| return TRUE;
|
| }
|
| @@ -847,9 +767,7 @@ FX_BOOL CPDF_ImageRenderer::Continue(IFX_Pause* pPause)
|
| m_pRenderStatus->m_pDevice->SetDIBits(m_pQuickStretcher->m_pBitmap, m_pQuickStretcher->m_ResultLeft,
|
| m_pQuickStretcher->m_ResultTop, m_BlendType);
|
| return FALSE;
|
| -#endif
|
| } else if (m_Status == 2) {
|
| -#if !defined(_FPDFAPI_MINI_) || defined(_FXCORE_FEATURE_ALL_)
|
| if (m_pTransformer->Continue(pPause)) {
|
| return TRUE;
|
| }
|
| @@ -872,7 +790,6 @@ FX_BOOL CPDF_ImageRenderer::Continue(IFX_Pause* pPause)
|
| }
|
| delete pBitmap;
|
| return FALSE;
|
| -#endif
|
| } else if (m_Status == 3) {
|
| return m_pRenderStatus->m_pDevice->ContinueDIBits(m_DeviceHandle, pPause);
|
| } else if (m_Status == 4) {
|
|
|