void CPDF_StreamContentParser::Handle_Rectangle() { if (m_Options.m_bTextOnly) { return; } FX_FLOAT x = GetNumber(3), y = GetNumber(2); FX_FLOAT w = GetNumber(1), h = GetNumber(0); AddPathRect(x, y, w, h); }
void CPDF_StreamContentParser::ParsePathObject() { FX_FLOAT params[6] = {0}; int nParams = 0; int last_pos = m_pSyntax->GetPos(); while (1) { CPDF_StreamParser::SyntaxType type = m_pSyntax->ParseNextElement(); FX_BOOL bProcessed = TRUE; switch (type) { case CPDF_StreamParser::EndOfData: return; case CPDF_StreamParser::Keyword: { int len = m_pSyntax->GetWordSize(); if (len == 1) { switch (m_pSyntax->GetWordBuf()[0]) { case 'm': AddPathPoint(params[0], params[1], FXPT_MOVETO); nParams = 0; break; case 'l': AddPathPoint(params[0], params[1], FXPT_LINETO); nParams = 0; break; case 'c': AddPathPoint(params[0], params[1], FXPT_BEZIERTO); AddPathPoint(params[2], params[3], FXPT_BEZIERTO); AddPathPoint(params[4], params[5], FXPT_BEZIERTO); nParams = 0; break; case 'v': AddPathPoint(m_PathCurrentX, m_PathCurrentY, FXPT_BEZIERTO); AddPathPoint(params[0], params[1], FXPT_BEZIERTO); AddPathPoint(params[2], params[3], FXPT_BEZIERTO); nParams = 0; break; case 'y': AddPathPoint(params[0], params[1], FXPT_BEZIERTO); AddPathPoint(params[2], params[3], FXPT_BEZIERTO); AddPathPoint(params[2], params[3], FXPT_BEZIERTO); nParams = 0; break; case 'h': Handle_ClosePath(); nParams = 0; break; default: bProcessed = FALSE; break; } } else if (len == 2) { if (m_pSyntax->GetWordBuf()[0] == 'r' && m_pSyntax->GetWordBuf()[1] == 'e') { AddPathRect(params[0], params[1], params[2], params[3]); nParams = 0; } else { bProcessed = FALSE; } } else { bProcessed = FALSE; } if (bProcessed) { last_pos = m_pSyntax->GetPos(); } break; } case CPDF_StreamParser::Number: { if (nParams == 6) { break; } FX_BOOL bInteger; int value; FX_atonum(CFX_ByteStringC(m_pSyntax->GetWordBuf(), m_pSyntax->GetWordSize()), bInteger, &value); params[nParams++] = bInteger ? (FX_FLOAT)value : *(FX_FLOAT*)&value; break; } default: bProcessed = FALSE; } if (!bProcessed) { m_pSyntax->SetPos(last_pos); return; } } }