コード例 #1
0
ファイル: fpdf_page_doc.cpp プロジェクト: Gottox/pdfium
CPDF_Image* CPDF_DocPageData::GetImage(CPDF_Object* pImageStream)
{
    if (!pImageStream) {
        return NULL;
    }
    FX_DWORD dwImageObjNum = pImageStream->GetObjNum();
    CPDF_CountedObject<CPDF_Image*>* imageData;
    if (m_ImageMap.Lookup(dwImageObjNum, imageData)) {
        imageData->m_nCount ++;
        return imageData->m_Obj;
    }
    imageData = FX_NEW CPDF_CountedObject<CPDF_Image*>;
    if (!imageData) {
        return NULL;
    }
    CPDF_Image* pImage = FX_NEW CPDF_Image(m_pPDFDoc);
    if (!pImage) {
        delete imageData;
        return NULL;
    }
    pImage->LoadImageF((CPDF_Stream*)pImageStream, FALSE);
    imageData->m_nCount = 2;
    imageData->m_Obj = pImage;
    m_ImageMap.SetAt(dwImageObjNum, imageData);
    return pImage;
}
コード例 #2
0
CPDF_Image* CPDF_Image::Clone() {
  if (m_pStream->GetObjNum())
    return m_pDocument->GetPageData()->GetImage(m_pStream);

  CPDF_Image* pImage = new CPDF_Image(m_pDocument);
  pImage->LoadImageF(ToStream(m_pStream->CPDF_Object::Clone()), m_bInline);
  if (m_bInline)
    pImage->SetInlineDict(ToDictionary(m_pInlineDict->Clone(TRUE)));

  return pImage;
}
コード例 #3
0
ファイル: fpdf_page_image.cpp プロジェクト: 151706061/PDFium
CPDF_Image* CPDF_Image::Clone()
{
    if (m_pStream->GetObjNum()) {
        return m_pDocument->GetPageData()->GetImage(m_pStream);
    }
    CPDF_Image* pImage = FX_NEW CPDF_Image(m_pDocument);
    pImage->LoadImageF((CPDF_Stream*)((CPDF_Object*)m_pStream)->Clone(), m_bInline);
    if (m_bInline) {
        CPDF_Dictionary *pInlineDict = (CPDF_Dictionary*)m_pInlineDict->Clone(TRUE);
        pImage->SetInlineDict(pInlineDict);
    }
    return pImage;
}
コード例 #4
0
ファイル: fpdf_page_doc.cpp プロジェクト: JinAirsOs/pdfium
CPDF_Image* CPDF_DocPageData::GetImage(CPDF_Object* pImageStream) {
  if (!pImageStream)
    return nullptr;

  const FX_DWORD dwImageObjNum = pImageStream->GetObjNum();
  auto it = m_ImageMap.find(dwImageObjNum);
  if (it != m_ImageMap.end()) {
    return it->second->AddRef();
  }

  CPDF_Image* pImage = new CPDF_Image(m_pPDFDoc);
  pImage->LoadImageF(pImageStream->AsStream(), FALSE);

  CPDF_CountedImage* imageData = new CPDF_CountedImage(pImage);
  m_ImageMap[dwImageObjNum] = imageData;
  return imageData->AddRef();
}