Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
cpdf_imageloader.cpp
Go to the documentation of this file.
1
// Copyright 2016 The PDFium Authors
2
// Use of this source code is governed by a BSD-style license that can be
3
// found in the LICENSE file.
4
5
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6
7
#
include
"core/fpdfapi/page/cpdf_imageloader.h"
8
9
#
include
<
utility
>
10
11
#
include
"core/fpdfapi/page/cpdf_dib.h"
12
#
include
"core/fpdfapi/page/cpdf_image.h"
13
#
include
"core/fpdfapi/page/cpdf_imageobject.h"
14
#
include
"core/fpdfapi/page/cpdf_pageimagecache.h"
15
#
include
"core/fpdfapi/page/cpdf_transferfunc.h"
16
#
include
"core/fxcrt/check.h"
17
#
include
"core/fxge/dib/cfx_dibitmap.h"
18
19
CPDF_ImageLoader
::
CPDF_ImageLoader
() =
default
;
20
21
CPDF_ImageLoader
::~
CPDF_ImageLoader
() =
default
;
22
23
bool
CPDF_ImageLoader
::
Start
(
const
CPDF_ImageObject* pImage,
24
CPDF_PageImageCache
* pPageImageCache,
25
const
CPDF_Dictionary
* pFormResource,
26
const
CPDF_Dictionary
* pPageResource,
27
bool
bStdCS,
28
CPDF_ColorSpace
::
Family
eFamily,
29
bool
bLoadMask,
30
const
CFX_Size
& max_size_required) {
31
m_pCache = pPageImageCache;
32
m_pImageObject = pImage;
33
bool
should_continue;
34
if
(m_pCache) {
35
should_continue = m_pCache->StartGetCachedBitmap(
36
m_pImageObject->GetImage(), pFormResource, pPageResource, bStdCS,
37
eFamily, bLoadMask, max_size_required);
38
}
else
{
39
should_continue = m_pImageObject->GetImage()->StartLoadDIBBase(
40
pFormResource, pPageResource, bStdCS, eFamily, bLoadMask,
41
max_size_required);
42
}
43
if
(!should_continue) {
44
Finish();
45
}
46
return
should_continue;
47
}
48
49
bool
CPDF_ImageLoader
::
Continue
(
PauseIndicatorIface
* pPause) {
50
bool
should_continue = m_pCache
51
? m_pCache->Continue(pPause)
52
: m_pImageObject->GetImage()->Continue(pPause);
53
if
(!should_continue) {
54
Finish();
55
}
56
return
should_continue;
57
}
58
59
RetainPtr
<
CFX_DIBBase
>
CPDF_ImageLoader
::
TranslateImage
(
60
RetainPtr
<CPDF_TransferFunc> pTransferFunc) {
61
DCHECK
(pTransferFunc);
62
DCHECK
(!pTransferFunc->GetIdentity());
63
m_pBitmap = pTransferFunc->TranslateImage(std::move(m_pBitmap));
64
if
(m_bCached && m_pMask)
65
m_pMask = m_pMask->Realize();
66
m_bCached =
false
;
67
return
m_pBitmap;
68
}
69
70
void
CPDF_ImageLoader
::Finish() {
71
if
(m_pCache) {
72
m_bCached =
true
;
73
m_pBitmap = m_pCache->DetachCurBitmap();
74
m_pMask = m_pCache->DetachCurMask();
75
m_MatteColor = m_pCache->GetCurMatteColor();
76
return
;
77
}
78
RetainPtr
<CPDF_Image> pImage = m_pImageObject->GetImage();
79
m_bCached =
false
;
80
m_pBitmap = pImage->DetachBitmap();
81
m_pMask = pImage->DetachMask();
82
m_MatteColor = pImage->GetMatteColor();
83
}
DCHECK
#define DCHECK
Definition
check.h:33
CFX_DIBBase
Definition
cfx_dibbase.h:35
CPDF_ColorSpace
Definition
cpdf_colorspace.h:53
CPDF_ColorSpace::Family
Family
Definition
cpdf_colorspace.h:55
CPDF_Dictionary::DictMap
std::map< ByteString, RetainPtr< CPDF_Object >, std::less<> > DictMap
Definition
cpdf_dictionary.h:31
CPDF_ImageLoader
Definition
cpdf_imageloader.h:21
CPDF_ImageLoader::TranslateImage
RetainPtr< CFX_DIBBase > TranslateImage(RetainPtr< CPDF_TransferFunc > pTransferFunc)
Definition
cpdf_imageloader.cpp:59
CPDF_ImageLoader::Start
bool Start(const CPDF_ImageObject *pImage, CPDF_PageImageCache *pPageImageCache, const CPDF_Dictionary *pFormResource, const CPDF_Dictionary *pPageResource, bool bStdCS, CPDF_ColorSpace::Family eFamily, bool bLoadMask, const CFX_Size &max_size_required)
Definition
cpdf_imageloader.cpp:23
CPDF_ImageLoader::~CPDF_ImageLoader
~CPDF_ImageLoader()
CPDF_ImageLoader::Continue
bool Continue(PauseIndicatorIface *pPause)
Definition
cpdf_imageloader.cpp:49
CPDF_ImageLoader::CPDF_ImageLoader
CPDF_ImageLoader()
CPDF_PageImageCache
Definition
cpdf_pageimagecache.h:27
PauseIndicatorIface
Definition
pauseindicator_iface.h:10
fxcrt::RetainPtr
Definition
retain_ptr.h:28
CFX_Size
CFX_STemplate< int32_t > CFX_Size
Definition
fx_coordinates.h:114
qtwebengine
src
3rdparty
chromium
third_party
pdfium
core
fpdfapi
page
cpdf_imageloader.cpp
Generated on
for Qt by
1.18.0