summaryrefslogtreecommitdiff
path: root/core/fpdfapi
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-03-20 21:06:35 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-03-20 21:06:35 +0000
commit40d37b1a8077031a078b374eaf6644d89e506d23 (patch)
tree72928249b6b2c0c230917518a5a616cf757c0da8 /core/fpdfapi
parentaff457782dcb9c2f7fa82e3c9c469182c5b8ad15 (diff)
downloadpdfium-40d37b1a8077031a078b374eaf6644d89e506d23.tar.xz
Rename "RGB" methods/variables to "ColorRef" in CPDF_ColorState.
Change-Id: I196e3148d680c9efeaf9609dd3ddbfe3f6635fa6 Reviewed-on: https://pdfium-review.googlesource.com/28576 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'core/fpdfapi')
-rw-r--r--core/fpdfapi/page/cpdf_colorstate.cpp43
-rw-r--r--core/fpdfapi/page/cpdf_colorstate.h16
-rw-r--r--core/fpdfapi/render/cpdf_renderstatus.cpp41
3 files changed, 54 insertions, 46 deletions
diff --git a/core/fpdfapi/page/cpdf_colorstate.cpp b/core/fpdfapi/page/cpdf_colorstate.cpp
index 693fcf1a93..2361552556 100644
--- a/core/fpdfapi/page/cpdf_colorstate.cpp
+++ b/core/fpdfapi/page/cpdf_colorstate.cpp
@@ -25,20 +25,20 @@ void CPDF_ColorState::SetDefault() {
m_Ref.GetPrivateCopy()->SetDefault();
}
-uint32_t CPDF_ColorState::GetFillRGB() const {
- return m_Ref.GetObject()->m_FillRGB;
+FX_COLORREF CPDF_ColorState::GetFillColorRef() const {
+ return m_Ref.GetObject()->m_FillColorRef;
}
-void CPDF_ColorState::SetFillRGB(uint32_t rgb) {
- m_Ref.GetPrivateCopy()->m_FillRGB = rgb;
+void CPDF_ColorState::SetFillColorRef(FX_COLORREF colorref) {
+ m_Ref.GetPrivateCopy()->m_FillColorRef = colorref;
}
-uint32_t CPDF_ColorState::GetStrokeRGB() const {
- return m_Ref.GetObject()->m_StrokeRGB;
+FX_COLORREF CPDF_ColorState::GetStrokeColorRef() const {
+ return m_Ref.GetObject()->m_StrokeColorRef;
}
-void CPDF_ColorState::SetStrokeRGB(uint32_t rgb) {
- m_Ref.GetPrivateCopy()->m_StrokeRGB = rgb;
+void CPDF_ColorState::SetStrokeColorRef(FX_COLORREF colorref) {
+ m_Ref.GetPrivateCopy()->m_StrokeColorRef = colorref;
}
const CPDF_Color* CPDF_ColorState::GetFillColor() const {
@@ -73,14 +73,15 @@ void CPDF_ColorState::SetFillColor(CPDF_ColorSpace* pCS,
float* pValue,
uint32_t nValues) {
ColorData* pData = m_Ref.GetPrivateCopy();
- SetColor(pData->m_FillColor, pData->m_FillRGB, pCS, pValue, nValues);
+ SetColor(pData->m_FillColor, &pData->m_FillColorRef, pCS, pValue, nValues);
}
void CPDF_ColorState::SetStrokeColor(CPDF_ColorSpace* pCS,
float* pValue,
uint32_t nValues) {
ColorData* pData = m_Ref.GetPrivateCopy();
- SetColor(pData->m_StrokeColor, pData->m_StrokeRGB, pCS, pValue, nValues);
+ SetColor(pData->m_StrokeColor, &pData->m_StrokeColorRef, pCS, pValue,
+ nValues);
}
void CPDF_ColorState::SetFillPattern(CPDF_Pattern* pPattern,
@@ -94,11 +95,11 @@ void CPDF_ColorState::SetFillPattern(CPDF_Pattern* pPattern,
bool ret = pData->m_FillColor.GetRGB(&R, &G, &B);
if (CPDF_TilingPattern* pTilingPattern = pPattern->AsTilingPattern()) {
if (!ret && pTilingPattern->colored()) {
- pData->m_FillRGB = 0x00BFBFBF;
+ pData->m_FillColorRef = 0x00BFBFBF;
return;
}
}
- pData->m_FillRGB = ret ? FXSYS_RGB(R, G, B) : 0xFFFFFFFF;
+ pData->m_FillColorRef = ret ? FXSYS_RGB(R, G, B) : 0xFFFFFFFF;
}
void CPDF_ColorState::SetStrokePattern(CPDF_Pattern* pPattern,
@@ -112,16 +113,16 @@ void CPDF_ColorState::SetStrokePattern(CPDF_Pattern* pPattern,
bool ret = pData->m_StrokeColor.GetRGB(&R, &G, &B);
if (CPDF_TilingPattern* pTilingPattern = pPattern->AsTilingPattern()) {
if (!ret && pTilingPattern->colored()) {
- pData->m_StrokeRGB = 0x00BFBFBF;
+ pData->m_StrokeColorRef = 0x00BFBFBF;
return;
}
}
- pData->m_StrokeRGB =
+ pData->m_StrokeColorRef =
pData->m_StrokeColor.GetRGB(&R, &G, &B) ? FXSYS_RGB(R, G, B) : 0xFFFFFFFF;
}
void CPDF_ColorState::SetColor(CPDF_Color& color,
- uint32_t& rgb,
+ FX_COLORREF* colorref,
CPDF_ColorSpace* pCS,
float* pValue,
uint32_t nValues) {
@@ -137,13 +138,15 @@ void CPDF_ColorState::SetColor(CPDF_Color& color,
int R;
int G;
int B;
- rgb = color.GetRGB(&R, &G, &B) ? FXSYS_RGB(R, G, B) : 0xFFFFFFFF;
+ *colorref = color.GetRGB(&R, &G, &B) ? FXSYS_RGB(R, G, B) : 0xFFFFFFFF;
}
-CPDF_ColorState::ColorData::ColorData() : m_FillRGB(0), m_StrokeRGB(0) {}
+CPDF_ColorState::ColorData::ColorData()
+ : m_FillColorRef(0), m_StrokeColorRef(0) {}
CPDF_ColorState::ColorData::ColorData(const ColorData& src)
- : m_FillRGB(src.m_FillRGB), m_StrokeRGB(src.m_StrokeRGB) {
+ : m_FillColorRef(src.m_FillColorRef),
+ m_StrokeColorRef(src.m_StrokeColorRef) {
m_FillColor.Copy(&src.m_FillColor);
m_StrokeColor.Copy(&src.m_StrokeColor);
}
@@ -151,8 +154,8 @@ CPDF_ColorState::ColorData::ColorData(const ColorData& src)
CPDF_ColorState::ColorData::~ColorData() {}
void CPDF_ColorState::ColorData::SetDefault() {
- m_FillRGB = 0;
- m_StrokeRGB = 0;
+ m_FillColorRef = 0;
+ m_StrokeColorRef = 0;
m_FillColor.SetColorSpace(CPDF_ColorSpace::GetStockCS(PDFCS_DEVICEGRAY));
m_StrokeColor.SetColorSpace(CPDF_ColorSpace::GetStockCS(PDFCS_DEVICEGRAY));
}
diff --git a/core/fpdfapi/page/cpdf_colorstate.h b/core/fpdfapi/page/cpdf_colorstate.h
index cae79b28e2..591610a753 100644
--- a/core/fpdfapi/page/cpdf_colorstate.h
+++ b/core/fpdfapi/page/cpdf_colorstate.h
@@ -10,6 +10,7 @@
#include "core/fpdfapi/page/cpdf_color.h"
#include "core/fxcrt/fx_system.h"
#include "core/fxcrt/shared_copy_on_write.h"
+#include "core/fxge/fx_dib.h"
class CPDF_Color;
class CPDF_ColorSpace;
@@ -24,11 +25,11 @@ class CPDF_ColorState {
void Emplace();
void SetDefault();
- uint32_t GetFillRGB() const;
- void SetFillRGB(uint32_t rgb);
+ FX_COLORREF GetFillColorRef() const;
+ void SetFillColorRef(FX_COLORREF colorref);
- uint32_t GetStrokeRGB() const;
- void SetStrokeRGB(uint32_t rgb);
+ FX_COLORREF GetStrokeColorRef() const;
+ void SetStrokeColorRef(FX_COLORREF colorref);
const CPDF_Color* GetFillColor() const;
CPDF_Color* GetMutableFillColor();
@@ -54,15 +55,14 @@ class CPDF_ColorState {
void SetDefault();
- // TODO(thestig): Rename these to BGR.
- uint32_t m_FillRGB;
- uint32_t m_StrokeRGB;
+ FX_COLORREF m_FillColorRef;
+ FX_COLORREF m_StrokeColorRef;
CPDF_Color m_FillColor;
CPDF_Color m_StrokeColor;
};
void SetColor(CPDF_Color& color,
- uint32_t& rgb,
+ FX_COLORREF* colorref,
CPDF_ColorSpace* pCS,
float* pValue,
uint32_t nValues);
diff --git a/core/fpdfapi/render/cpdf_renderstatus.cpp b/core/fpdfapi/render/cpdf_renderstatus.cpp
index 1ded1ca496..a0b6713274 100644
--- a/core/fpdfapi/render/cpdf_renderstatus.cpp
+++ b/core/fpdfapi/render/cpdf_renderstatus.cpp
@@ -1046,14 +1046,14 @@ bool CPDF_RenderStatus::Initialize(CPDF_RenderContext* pContext,
m_InitialStates.CopyStates(*pInitialStates);
if (pParentState) {
if (!m_InitialStates.m_ColorState.HasFillColor()) {
- m_InitialStates.m_ColorState.SetFillRGB(
- pParentState->m_InitialStates.m_ColorState.GetFillRGB());
+ m_InitialStates.m_ColorState.SetFillColorRef(
+ pParentState->m_InitialStates.m_ColorState.GetFillColorRef());
m_InitialStates.m_ColorState.GetMutableFillColor()->Copy(
pParentState->m_InitialStates.m_ColorState.GetFillColor());
}
if (!m_InitialStates.m_ColorState.HasStrokeColor()) {
- m_InitialStates.m_ColorState.SetStrokeRGB(
- pParentState->m_InitialStates.m_ColorState.GetFillRGB());
+ m_InitialStates.m_ColorState.SetStrokeColorRef(
+ pParentState->m_InitialStates.m_ColorState.GetFillColorRef());
m_InitialStates.m_ColorState.GetMutableStrokeColor()->Copy(
pParentState->m_InitialStates.m_ColorState.GetStrokeColor());
}
@@ -1357,8 +1357,8 @@ FX_ARGB CPDF_RenderStatus::GetFillArgb(CPDF_PageObject* pObj,
if (MissingFillColor(pColorState))
pColorState = &m_InitialStates.m_ColorState;
- FX_COLORREF bgr = pColorState->GetFillRGB();
- if (bgr == 0xFFFFFFFF)
+ FX_COLORREF colorref = pColorState->GetFillColorRef();
+ if (colorref == 0xFFFFFFFF)
return 0;
int32_t alpha =
@@ -1368,10 +1368,12 @@ FX_ARGB CPDF_RenderStatus::GetFillArgb(CPDF_PageObject* pObj,
pObj->m_GeneralState.SetTransferFunc(
GetTransferFunc(pObj->m_GeneralState.GetTR()));
}
- if (pObj->m_GeneralState.GetTransferFunc())
- bgr = pObj->m_GeneralState.GetTransferFunc()->TranslateColor(bgr);
+ if (pObj->m_GeneralState.GetTransferFunc()) {
+ colorref =
+ pObj->m_GeneralState.GetTransferFunc()->TranslateColor(colorref);
+ }
}
- return m_Options.TranslateColor(ArgbEncode(alpha, bgr));
+ return m_Options.TranslateColor(ArgbEncode(alpha, colorref));
}
FX_ARGB CPDF_RenderStatus::GetStrokeArgb(CPDF_PageObject* pObj) const {
@@ -1382,8 +1384,8 @@ FX_ARGB CPDF_RenderStatus::GetStrokeArgb(CPDF_PageObject* pObj) const {
if (MissingStrokeColor(pColorState))
pColorState = &m_InitialStates.m_ColorState;
- FX_COLORREF bgr = pColorState->GetStrokeRGB();
- if (bgr == 0xFFFFFFFF)
+ FX_COLORREF colorref = pColorState->GetStrokeColorRef();
+ if (colorref == 0xFFFFFFFF)
return 0;
int32_t alpha = static_cast<int32_t>(pObj->m_GeneralState.GetStrokeAlpha() *
@@ -1393,10 +1395,12 @@ FX_ARGB CPDF_RenderStatus::GetStrokeArgb(CPDF_PageObject* pObj) const {
pObj->m_GeneralState.SetTransferFunc(
GetTransferFunc(pObj->m_GeneralState.GetTR()));
}
- if (pObj->m_GeneralState.GetTransferFunc())
- bgr = pObj->m_GeneralState.GetTransferFunc()->TranslateColor(bgr);
+ if (pObj->m_GeneralState.GetTransferFunc()) {
+ colorref =
+ pObj->m_GeneralState.GetTransferFunc()->TranslateColor(colorref);
+ }
}
- return m_Options.TranslateColor(ArgbEncode(alpha, bgr));
+ return m_Options.TranslateColor(ArgbEncode(alpha, colorref));
}
void CPDF_RenderStatus::ProcessClipPath(const CPDF_ClipPath& ClipPath,
@@ -1710,10 +1714,11 @@ std::unique_ptr<CPDF_GraphicStates> CPDF_RenderStatus::CloneObjStates(
? pSrcStates->m_ColorState.GetStrokeColor()
: pSrcStates->m_ColorState.GetFillColor();
if (!pObjColor->IsNull()) {
- pStates->m_ColorState.SetFillRGB(
- bStroke ? pSrcStates->m_ColorState.GetStrokeRGB()
- : pSrcStates->m_ColorState.GetFillRGB());
- pStates->m_ColorState.SetStrokeRGB(pStates->m_ColorState.GetFillRGB());
+ pStates->m_ColorState.SetFillColorRef(
+ bStroke ? pSrcStates->m_ColorState.GetStrokeColorRef()
+ : pSrcStates->m_ColorState.GetFillColorRef());
+ pStates->m_ColorState.SetStrokeColorRef(
+ pStates->m_ColorState.GetFillColorRef());
}
return pStates;
}