FX_BOOL CPDF_RenderStatus::ProcessPath(CPDF_PathObject* pPathObj, const CFX_AffineMatrix* pObj2Device) { int FillType = pPathObj->m_FillType; FX_BOOL bStroke = pPathObj->m_bStroke; ProcessPathPattern(pPathObj, pObj2Device, FillType, bStroke); if (FillType == 0 && !bStroke) { return TRUE; } FX_DWORD fill_argb = 0; if (FillType) { fill_argb = GetFillArgb(pPathObj); } FX_DWORD stroke_argb = 0; if (bStroke) { stroke_argb = GetStrokeArgb(pPathObj); } CFX_AffineMatrix path_matrix = pPathObj->m_Matrix; path_matrix.Concat(*pObj2Device); if (!IsAvailableMatrix(path_matrix)) { return TRUE; } if (FillType && (m_Options.m_Flags & RENDER_RECT_AA)) { FillType |= FXFILL_RECT_AA; } if (m_Options.m_Flags & RENDER_FILL_FULLCOVER) { FillType |= FXFILL_FULLCOVER; } if (m_Options.m_Flags & RENDER_NOPATHSMOOTH) { FillType |= FXFILL_NOPATHSMOOTH; } if (bStroke) { FillType |= FX_FILL_STROKE; } const CPDF_GeneralStateData* pGeneralData = ((CPDF_PageObject*)pPathObj)->m_GeneralState; if (pGeneralData && pGeneralData->m_StrokeAdjust) { FillType |= FX_STROKE_ADJUST; } if (m_pType3Char) { FillType |= FX_FILL_TEXT_MODE; } CFX_GraphStateData graphState(*pPathObj->m_GraphState); if (m_Options.m_Flags & RENDER_THINLINE) { graphState.m_LineWidth = 0; } return m_pDevice->DrawPath(pPathObj->m_Path, &path_matrix, &graphState, fill_argb, stroke_argb, FillType, 0, NULL, m_curBlend); }
FX_BOOL CPDF_RenderStatus::ProcessPath(CPDF_PathObject* pPathObj, const CFX_Matrix* pObj2Device) { int FillType = pPathObj->m_FillType; FX_BOOL bStroke = pPathObj->m_bStroke; ProcessPathPattern(pPathObj, pObj2Device, FillType, bStroke); if (FillType == 0 && !bStroke) return TRUE; uint32_t fill_argb = FillType ? GetFillArgb(pPathObj) : 0; uint32_t stroke_argb = bStroke ? GetStrokeArgb(pPathObj) : 0; CFX_Matrix path_matrix = pPathObj->m_Matrix; path_matrix.Concat(*pObj2Device); if (!IsAvailableMatrix(path_matrix)) return TRUE; if (FillType && (m_Options.m_Flags & RENDER_RECT_AA)) FillType |= FXFILL_RECT_AA; if (m_Options.m_Flags & RENDER_FILL_FULLCOVER) FillType |= FXFILL_FULLCOVER; if (m_Options.m_Flags & RENDER_NOPATHSMOOTH) FillType |= FXFILL_NOPATHSMOOTH; if (bStroke) FillType |= FX_FILL_STROKE; const CPDF_PageObject* pPageObj = static_cast<const CPDF_PageObject*>(pPathObj); if (pPageObj->m_GeneralState.GetStrokeAdjust()) FillType |= FX_STROKE_ADJUST; if (m_pType3Char) FillType |= FX_FILL_TEXT_MODE; CPDF_GraphState graphState = pPathObj->m_GraphState; if (m_Options.m_Flags & RENDER_THINLINE) graphState.SetLineWidth(0); return m_pDevice->DrawPathWithBlend( pPathObj->m_Path.GetObject(), &path_matrix, graphState.GetObject(), fill_argb, stroke_argb, FillType, m_curBlend); }
FX_BOOL CPDF_RenderStatus::ProcessText(const CPDF_TextObject* textobj, const CFX_AffineMatrix* pObj2Device, CFX_PathData* pClippingPath) { if(textobj->m_nChars == 0) { return TRUE; } int text_render_mode = textobj->m_TextState.GetObject()->m_TextMode; if (text_render_mode == 3) { return TRUE; } CPDF_Font* pFont = textobj->m_TextState.GetFont(); if (pFont->GetFontType() == PDFFONT_TYPE3) { return ProcessType3Text(textobj, pObj2Device); } FX_BOOL bFill = FALSE, bStroke = FALSE, bClip = FALSE; if (pClippingPath) { bClip = TRUE; } else { switch (text_render_mode) { case 0: case 4: bFill = TRUE; break; case 1: case 5: if (pFont->GetFace() == NULL && !(pFont->GetSubstFont()->m_SubstFlags & FXFONT_SUBST_GLYPHPATH)) { bFill = TRUE; } else { bStroke = TRUE; } break; case 2: case 6: if (pFont->GetFace() == NULL && !(pFont->GetSubstFont()->m_SubstFlags & FXFONT_SUBST_GLYPHPATH)) { bFill = TRUE; } else { bFill = bStroke = TRUE; } break; case 3: case 7: return TRUE; default: bFill = TRUE; } } FX_ARGB stroke_argb = 0, fill_argb = 0; FX_BOOL bPattern = FALSE; if (bStroke) { if (textobj->m_ColorState.GetStrokeColor()->IsPattern()) { bPattern = TRUE; } else { stroke_argb = GetStrokeArgb(textobj); } } if (bFill) { if (textobj->m_ColorState.GetFillColor()->IsPattern()) { bPattern = TRUE; } else { fill_argb = GetFillArgb(textobj); } } CFX_AffineMatrix text_matrix; textobj->GetTextMatrix(&text_matrix); if(IsAvailableMatrix(text_matrix) == FALSE) { return TRUE; } FX_FLOAT font_size = textobj->m_TextState.GetFontSize(); if (bPattern) { DrawTextPathWithPattern(textobj, pObj2Device, pFont, font_size, &text_matrix, bFill, bStroke); return TRUE; } #if defined(_FPDFAPI_MINI_) if (bFill) { bStroke = FALSE; } if (bStroke) { if (font_size * text_matrix.GetXUnit() * pObj2Device->GetXUnit() < 6) { bStroke = FALSE; } } #endif if (bClip || bStroke) { const CFX_AffineMatrix* pDeviceMatrix = pObj2Device; CFX_AffineMatrix device_matrix; if (bStroke) { const FX_FLOAT* pCTM = textobj->m_TextState.GetObject()->m_CTM; if (pCTM[0] != 1.0f || pCTM[3] != 1.0f) { CFX_AffineMatrix ctm(pCTM[0], pCTM[1], pCTM[2], pCTM[3], 0, 0); text_matrix.ConcatInverse(ctm); device_matrix.Copy(ctm); device_matrix.Concat(*pObj2Device); pDeviceMatrix = &device_matrix; } } int flag = 0; if (bStroke && bFill) { flag |= FX_FILL_STROKE; flag |= FX_STROKE_TEXT_MODE; } #if !defined(_FPDFAPI_MINI_) || defined(_FXCORE_FEATURE_ALL_) const CPDF_GeneralStateData* pGeneralData = ((CPDF_PageObject*)textobj)->m_GeneralState; if (pGeneralData && pGeneralData->m_StrokeAdjust) { flag |= FX_STROKE_ADJUST; } #endif if (m_Options.m_Flags & RENDER_NOTEXTSMOOTH) { flag |= FXFILL_NOPATHSMOOTH; } return CPDF_TextRenderer::DrawTextPath(m_pDevice, textobj->m_nChars, textobj->m_pCharCodes, textobj->m_pCharPos, pFont, font_size, &text_matrix, pDeviceMatrix, textobj->m_GraphState, fill_argb, stroke_argb, pClippingPath, flag); } text_matrix.Concat(*pObj2Device); return CPDF_TextRenderer::DrawNormalText(m_pDevice, textobj->m_nChars, textobj->m_pCharCodes, textobj->m_pCharPos, pFont, font_size, &text_matrix, fill_argb, &m_Options); }