summaryrefslogtreecommitdiff
path: root/core/fpdfapi/page
diff options
context:
space:
mode:
Diffstat (limited to 'core/fpdfapi/page')
-rw-r--r--core/fpdfapi/page/cpdf_colorstate.cpp43
-rw-r--r--core/fpdfapi/page/cpdf_colorstate.h16
2 files changed, 31 insertions, 28 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);