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
fx_dib.cpp
Go to the documentation of this file.
1
// Copyright 2014 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/fxge/dib/fx_dib.h"
8
9
#
include
<
tuple
>
10
#
include
<
type_traits
>
11
#
include
<
utility
>
12
13
#
include
"build/build_config.h"
14
15
#
if
BUILDFLAG
(
IS_WIN
)
16
#
include
<
windows
.
h
>
17
#
endif
18
19
#
if
BUILDFLAG
(
IS_WIN
)
20
static_assert
(
sizeof
(FX_COLORREF) ==
sizeof
(COLORREF),
21
"FX_COLORREF vs. COLORREF mismatch"
);
22
#
endif
23
24
// Assert that FX_*_STRUCTS are packed.
25
static_assert
(
sizeof
(FX_RGB_STRUCT<uint8_t>) == 3u);
26
static_assert
(
sizeof
(FX_BGR_STRUCT<uint8_t>) == 3u);
27
static_assert
(
sizeof
(FX_ARGB_STRUCT<uint8_t>) == 4u);
28
static_assert
(
sizeof
(FX_ABGR_STRUCT<uint8_t>) == 4u);
29
static_assert
(
sizeof
(FX_RGBA_STRUCT<uint8_t>) == 4u);
30
static_assert
(
sizeof
(FX_BGRA_STRUCT<uint8_t>) == 4u);
31
static_assert
(
sizeof
(FX_CMYK_STRUCT<uint8_t>) == 4u);
32
33
// Assert that FX_*_STRUCTS remain aggregates.
34
static_assert
(std::is_aggregate_v<FX_RGB_STRUCT<
float
>>);
35
static_assert
(std::is_aggregate_v<FX_BGR_STRUCT<
float
>>);
36
static_assert
(std::is_aggregate_v<FX_ARGB_STRUCT<
float
>>);
37
static_assert
(std::is_aggregate_v<FX_ABGR_STRUCT<
float
>>);
38
static_assert
(std::is_aggregate_v<FX_RGBA_STRUCT<
float
>>);
39
static_assert
(std::is_aggregate_v<FX_BGRA_STRUCT<
float
>>);
40
static_assert
(std::is_aggregate_v<FX_CMYK_STRUCT<
float
>>);
41
42
FXDIB_ResampleOptions
::
FXDIB_ResampleOptions
() =
default
;
43
44
bool
FXDIB_ResampleOptions
::
HasAnyOptions
()
const
{
45
return
bInterpolateBilinear
||
bHalftone
||
bNoSmoothing
||
bLossy
;
46
}
47
48
FX_BGRA_STRUCT
<uint8_t>
ArgbToBGRAStruct
(
FX_ARGB
argb) {
49
return
{
FXARGB_B
(argb),
FXARGB_G
(argb),
FXARGB_R
(argb),
FXARGB_A
(argb)};
50
}
51
52
FX_BGR_STRUCT
<uint8_t>
ArgbToBGRStruct
(
FX_ARGB
argb) {
53
return
{
FXARGB_B
(argb),
FXARGB_G
(argb),
FXARGB_R
(argb)};
54
}
55
56
std
::pair<uint8_t,
FX_COLORREF
>
ArgbToAlphaAndColorRef
(
FX_ARGB
argb) {
57
return
{
FXARGB_A
(argb),
ArgbToColorRef
(
argb
)
};
58
}
59
60
FX_COLORREF
ArgbToColorRef
(
FX_ARGB
argb) {
61
return
FXSYS_BGR
(
FXARGB_B
(argb
)
,
FXARGB_G
(argb
)
,
FXARGB_R
(argb
)
)
;
62
}
63
64
FX_ARGB
AlphaAndColorRefToArgb
(
int
a,
FX_COLORREF
colorref) {
65
return
ArgbEncode
(
a
,
FXSYS_GetRValue
(
colorref
)
,
FXSYS_GetGValue
(
colorref
)
,
66
FXSYS_GetBValue
(
colorref
)
)
;
67
}
FX_ARGB
uint32_t FX_ARGB
Definition
fx_dib.h:36
ArgbToBGRAStruct
FX_BGRA_STRUCT< uint8_t > ArgbToBGRAStruct(FX_ARGB argb)
Definition
fx_dib.cpp:48
FXARGB_B
#define FXARGB_B(argb)
Definition
fx_dib.h:199
FXARGB_G
#define FXARGB_G(argb)
Definition
fx_dib.h:198
FXSYS_BGR
constexpr uint32_t FXSYS_BGR(uint8_t b, uint8_t g, uint8_t r)
Definition
fx_dib.h:139
ArgbToAlphaAndColorRef
std::pair< uint8_t, FX_COLORREF > ArgbToAlphaAndColorRef(FX_ARGB argb)
Definition
fx_dib.cpp:56
ArgbToBGRStruct
FX_BGR_STRUCT< uint8_t > ArgbToBGRStruct(FX_ARGB argb)
Definition
fx_dib.cpp:52
FXARGB_A
#define FXARGB_A(argb)
Definition
fx_dib.h:196
AlphaAndColorRefToArgb
FX_ARGB AlphaAndColorRefToArgb(int a, FX_COLORREF colorref)
Definition
fx_dib.cpp:64
FX_COLORREF
uint32_t FX_COLORREF
Definition
fx_dib.h:42
ArgbEncode
constexpr FX_ARGB ArgbEncode(uint32_t a, uint32_t r, uint32_t g, uint32_t b)
Definition
fx_dib.h:188
FXARGB_R
#define FXARGB_R(argb)
Definition
fx_dib.h:197
FXSYS_GetRValue
constexpr uint8_t FXSYS_GetRValue(uint32_t bgr)
Definition
fx_dib.h:143
ArgbToColorRef
FX_COLORREF ArgbToColorRef(FX_ARGB argb)
Definition
fx_dib.cpp:60
FXSYS_GetGValue
constexpr uint8_t FXSYS_GetGValue(uint32_t bgr)
Definition
fx_dib.h:147
FXSYS_GetBValue
constexpr uint8_t FXSYS_GetBValue(uint32_t bgr)
Definition
fx_dib.h:151
std
[33]
Definition
src_corelib_tools_qhash.cpp:421
FXDIB_ResampleOptions
Definition
fx_dib.h:106
FXDIB_ResampleOptions::HasAnyOptions
bool HasAnyOptions() const
Definition
fx_dib.cpp:44
FXDIB_ResampleOptions::bNoSmoothing
bool bNoSmoothing
Definition
fx_dib.h:113
FXDIB_ResampleOptions::bInterpolateBilinear
bool bInterpolateBilinear
Definition
fx_dib.h:111
FXDIB_ResampleOptions::FXDIB_ResampleOptions
FXDIB_ResampleOptions()
FXDIB_ResampleOptions::bLossy
bool bLossy
Definition
fx_dib.h:114
FXDIB_ResampleOptions::bHalftone
bool bHalftone
Definition
fx_dib.h:112
FX_BGRA_STRUCT
Definition
fx_dib.h:84
FX_BGR_STRUCT
Definition
fx_dib.h:53
qtwebengine
src
3rdparty
chromium
third_party
pdfium
core
fxge
dib
fx_dib.cpp
Generated on
for Qt by
1.18.0