summaryrefslogtreecommitdiff
path: root/xfa/fxgraphics
diff options
context:
space:
mode:
Diffstat (limited to 'xfa/fxgraphics')
-rw-r--r--xfa/fxgraphics/cfx_graphics.cpp40
-rw-r--r--xfa/fxgraphics/cfx_graphics.h19
-rw-r--r--xfa/fxgraphics/cfx_path.cpp8
-rw-r--r--xfa/fxgraphics/cfx_path.h2
-rw-r--r--xfa/fxgraphics/cfx_path_generator.cpp6
-rw-r--r--xfa/fxgraphics/cfx_shading.cpp8
-rw-r--r--xfa/fxgraphics/cfx_shading.h12
7 files changed, 47 insertions, 48 deletions
diff --git a/xfa/fxgraphics/cfx_graphics.cpp b/xfa/fxgraphics/cfx_graphics.cpp
index bc8b18ba36..824e7c68da 100644
--- a/xfa/fxgraphics/cfx_graphics.cpp
+++ b/xfa/fxgraphics/cfx_graphics.cpp
@@ -573,7 +573,7 @@ CFX_Graphics::CFX_Graphics()
: m_type(FX_CONTEXT_None), m_renderDevice(nullptr) {}
FWL_Error CFX_Graphics::Create(CFX_RenderDevice* renderDevice,
- FX_BOOL isAntialiasing) {
+ bool isAntialiasing) {
if (!renderDevice)
return FWL_Error::ParameterInvalid;
if (m_type != FX_CONTEXT_None)
@@ -590,8 +590,8 @@ FWL_Error CFX_Graphics::Create(CFX_RenderDevice* renderDevice,
FWL_Error CFX_Graphics::Create(int32_t width,
int32_t height,
FXDIB_Format format,
- FX_BOOL isNative,
- FX_BOOL isAntialiasing) {
+ bool isNative,
+ bool isAntialiasing) {
if (m_type != FX_CONTEXT_None)
return FWL_Error::PropertyInvalid;
@@ -612,7 +612,7 @@ FWL_Error CFX_Graphics::GetDeviceCap(const int32_t capID,
return FWL_Error::PropertyInvalid;
}
-FWL_Error CFX_Graphics::IsPrinterDevice(FX_BOOL& isPrinter) {
+FWL_Error CFX_Graphics::IsPrinterDevice(bool& isPrinter) {
if (m_type == FX_CONTEXT_Device && m_renderDevice) {
isPrinter = m_renderDevice->GetDeviceClass() == FXDC_PRINTER;
return FWL_Error::Succeeded;
@@ -620,7 +620,7 @@ FWL_Error CFX_Graphics::IsPrinterDevice(FX_BOOL& isPrinter) {
return FWL_Error::PropertyInvalid;
}
-FWL_Error CFX_Graphics::EnableAntialiasing(FX_BOOL isAntialiasing) {
+FWL_Error CFX_Graphics::EnableAntialiasing(bool isAntialiasing) {
if (m_type == FX_CONTEXT_Device && m_renderDevice) {
m_info.isAntialiasing = isAntialiasing;
return FWL_Error::Succeeded;
@@ -761,7 +761,7 @@ FWL_Error CFX_Graphics::GetLineWidth(FX_FLOAT& lineWidth) const {
return FWL_Error::PropertyInvalid;
}
-FWL_Error CFX_Graphics::SetLineWidth(FX_FLOAT lineWidth, FX_BOOL isActOnDash) {
+FWL_Error CFX_Graphics::SetLineWidth(FX_FLOAT lineWidth, bool isActOnDash) {
if (m_type == FX_CONTEXT_Device && m_renderDevice) {
m_info.graphState.m_LineWidth = lineWidth;
m_info.isActOnDash = isActOnDash;
@@ -831,7 +831,7 @@ FWL_Error CFX_Graphics::ClipPath(CFX_Path* path,
if (!path)
return FWL_Error::ParameterInvalid;
if (m_type == FX_CONTEXT_Device && m_renderDevice) {
- FX_BOOL result =
+ bool result =
m_renderDevice->SetClip_PathFill(path->GetPathData(), matrix, fillMode);
if (!result)
return FWL_Error::Indefinite;
@@ -956,7 +956,7 @@ FWL_Error CFX_Graphics::ShowText(const CFX_PointF& point,
void CFX_Graphics::CalcTextRect(CFX_RectF& rect,
const CFX_WideString& text,
- FX_BOOL isMultiline,
+ bool isMultiline,
CFX_Matrix* matrix) {
if (m_type != FX_CONTEXT_Device || !m_renderDevice)
return;
@@ -981,7 +981,7 @@ FWL_Error CFX_Graphics::Transfer(CFX_Graphics* graphics,
}
if (m_type == FX_CONTEXT_Device && m_renderDevice) {
CFX_DIBitmap* bitmap = graphics->m_renderDevice->GetBitmap();
- FX_BOOL result = m_renderDevice->SetDIBits(bitmap, 0, 0);
+ bool result = m_renderDevice->SetDIBits(bitmap, 0, 0);
if (!result)
return FWL_Error::MethodNotSupported;
return FWL_Error::Succeeded;
@@ -1004,7 +1004,7 @@ FWL_Error CFX_Graphics::Transfer(CFX_Graphics* graphics,
}
if (m_type == FX_CONTEXT_Device && m_renderDevice) {
CFX_DIBitmap bmp;
- FX_BOOL result =
+ bool result =
bmp.Create((int32_t)dstRect.width, (int32_t)dstRect.height,
graphics->m_renderDevice->GetBitmap()->GetFormat());
if (!result)
@@ -1170,7 +1170,7 @@ FWL_Error CFX_Graphics::RenderDeviceStrokePath(CFX_Path* path,
}
switch (m_info.strokeColor->m_type) {
case FX_COLOR_Solid: {
- FX_BOOL result =
+ bool result =
m_renderDevice->DrawPath(path->GetPathData(), &m, &m_info.graphState,
0x0, m_info.strokeColor->m_info.argb, 0);
if (!result)
@@ -1199,7 +1199,7 @@ FWL_Error CFX_Graphics::RenderDeviceFillPath(CFX_Path* path,
}
switch (m_info.fillColor->m_type) {
case FX_COLOR_Solid: {
- FX_BOOL result = m_renderDevice->DrawPath(
+ bool result = m_renderDevice->DrawPath(
path->GetPathData(), &m, &m_info.graphState,
m_info.fillColor->m_info.argb, 0x0, fillMode);
if (!result)
@@ -1229,7 +1229,7 @@ FWL_Error CFX_Graphics::RenderDeviceDrawImage(CFX_DIBSource* source,
point.x, point.y);
m2.Concat(m1);
int32_t left, top;
- std::unique_ptr<CFX_DIBitmap> bmp1(source->FlipImage(FALSE, TRUE));
+ std::unique_ptr<CFX_DIBitmap> bmp1(source->FlipImage(false, true));
std::unique_ptr<CFX_DIBitmap> bmp2(bmp1->TransformTo(&m2, left, top));
CFX_RectF r;
GetClipRect(r);
@@ -1262,7 +1262,7 @@ FWL_Error CFX_Graphics::RenderDeviceStretchImage(CFX_DIBSource* source,
m2.Set(rect.Width(), 0.0, 0.0, rect.Height(), rect.left, rect.top);
m2.Concat(m1);
int32_t left, top;
- std::unique_ptr<CFX_DIBitmap> bmp2(bmp1->FlipImage(FALSE, TRUE));
+ std::unique_ptr<CFX_DIBitmap> bmp2(bmp1->FlipImage(false, true));
std::unique_ptr<CFX_DIBitmap> bmp3(bmp2->TransformTo(&m2, left, top));
CFX_RectF r;
GetClipRect(r);
@@ -1292,7 +1292,7 @@ FWL_Error CFX_Graphics::RenderDeviceShowText(const CFX_PointF& point,
if (matrix) {
m.Concat(*matrix);
}
- FX_BOOL result = m_renderDevice->DrawNormalText(
+ bool result = m_renderDevice->DrawNormalText(
length, charPos, m_info.font, -m_info.fontSize * m_info.fontHScale, &m,
m_info.fillColor->m_info.argb, FXTEXT_CLEARTYPE);
if (!result)
@@ -1486,7 +1486,7 @@ FWL_Error CFX_Graphics::SetDIBitsWithMatrix(CFX_DIBSource* source,
0);
m.Concat(*matrix);
int32_t left, top;
- std::unique_ptr<CFX_DIBitmap> bmp1(source->FlipImage(FALSE, TRUE));
+ std::unique_ptr<CFX_DIBitmap> bmp1(source->FlipImage(false, true));
std::unique_ptr<CFX_DIBitmap> bmp2(bmp1->TransformTo(&m, left, top));
m_renderDevice->SetDIBits(bmp2.get(), left, top);
}
@@ -1510,7 +1510,7 @@ FWL_Error CFX_Graphics::CalcTextInfo(const CFX_WideString& text,
charPos[0].m_GlyphIndex = encoding->GlyphFromCharCode(charCodes[0]);
charPos[0].m_FontCharWidth = FXSYS_round(
m_info.font->GetGlyphWidth(charPos[0].m_GlyphIndex) * m_info.fontHScale);
- charPos[0].m_bGlyphAdjust = TRUE;
+ charPos[0].m_bGlyphAdjust = true;
charPos[0].m_AdjustMatrix[0] = -1;
charPos[0].m_AdjustMatrix[1] = 0;
charPos[0].m_AdjustMatrix[2] = 0;
@@ -1525,7 +1525,7 @@ FWL_Error CFX_Graphics::CalcTextInfo(const CFX_WideString& text,
charPos[i].m_FontCharWidth =
FXSYS_round(m_info.font->GetGlyphWidth(charPos[i].m_GlyphIndex) *
m_info.fontHScale);
- charPos[i].m_bGlyphAdjust = TRUE;
+ charPos[i].m_bGlyphAdjust = true;
charPos[i].m_AdjustMatrix[0] = -1;
charPos[i].m_AdjustMatrix[1] = 0;
charPos[i].m_AdjustMatrix[2] = 0;
@@ -1539,9 +1539,9 @@ FWL_Error CFX_Graphics::CalcTextInfo(const CFX_WideString& text,
}
CFX_Graphics::TInfo::TInfo()
- : isAntialiasing(TRUE),
+ : isAntialiasing(true),
strokeAlignment(FX_STROKEALIGNMENT_Center),
- isActOnDash(FALSE),
+ isActOnDash(false),
strokeColor(nullptr),
fillColor(nullptr),
font(nullptr),
diff --git a/xfa/fxgraphics/cfx_graphics.h b/xfa/fxgraphics/cfx_graphics.h
index e79219d877..7d9fff3138 100644
--- a/xfa/fxgraphics/cfx_graphics.h
+++ b/xfa/fxgraphics/cfx_graphics.h
@@ -103,17 +103,16 @@ class CFX_Graphics {
CFX_Graphics();
virtual ~CFX_Graphics();
- FWL_Error Create(CFX_RenderDevice* renderDevice,
- FX_BOOL isAntialiasing = TRUE);
+ FWL_Error Create(CFX_RenderDevice* renderDevice, bool isAntialiasing = true);
FWL_Error Create(int32_t width,
int32_t height,
FXDIB_Format format,
- FX_BOOL isNative = TRUE,
- FX_BOOL isAntialiasing = TRUE);
+ bool isNative = true,
+ bool isAntialiasing = true);
FWL_Error GetDeviceCap(const int32_t capID, FX_DeviceCap& capVal);
- FWL_Error IsPrinterDevice(FX_BOOL& isPrinter);
- FWL_Error EnableAntialiasing(FX_BOOL isAntialiasing);
+ FWL_Error IsPrinterDevice(bool& isPrinter);
+ FWL_Error EnableAntialiasing(bool isAntialiasing);
FWL_Error SaveGraphState();
FWL_Error RestoreGraphState();
@@ -136,7 +135,7 @@ class CFX_Graphics {
FWL_Error SetLineDash(FX_DashStyle dashStyle);
FWL_Error SetLineJoin(CFX_GraphStateData::LineJoin lineJoin);
FWL_Error SetMiterLimit(FX_FLOAT miterLimit);
- FWL_Error SetLineWidth(FX_FLOAT lineWidth, FX_BOOL isActOnDash = FALSE);
+ FWL_Error SetLineWidth(FX_FLOAT lineWidth, bool isActOnDash = false);
FWL_Error SetStrokeAlignment(FX_StrokeAlignment strokeAlignment);
FWL_Error SetStrokeColor(CFX_Color* color);
FWL_Error SetFillColor(CFX_Color* color);
@@ -167,7 +166,7 @@ class CFX_Graphics {
CFX_Matrix* matrix = nullptr);
void CalcTextRect(CFX_RectF& rect,
const CFX_WideString& text,
- FX_BOOL isMultiline = FALSE,
+ bool isMultiline = false,
CFX_Matrix* matrix = nullptr);
FWL_Error Transfer(CFX_Graphics* graphics, const CFX_Matrix* matrix);
FWL_Error Transfer(CFX_Graphics* graphics,
@@ -190,10 +189,10 @@ class CFX_Graphics {
TInfo& operator=(const TInfo& other);
CFX_GraphStateData graphState;
- FX_BOOL isAntialiasing;
+ bool isAntialiasing;
FX_StrokeAlignment strokeAlignment;
CFX_Matrix CTM;
- FX_BOOL isActOnDash;
+ bool isActOnDash;
CFX_Color* strokeColor;
CFX_Color* fillColor;
CFX_Font* font;
diff --git a/xfa/fxgraphics/cfx_path.cpp b/xfa/fxgraphics/cfx_path.cpp
index e4fb727092..d02b7a8e48 100644
--- a/xfa/fxgraphics/cfx_path.cpp
+++ b/xfa/fxgraphics/cfx_path.cpp
@@ -162,12 +162,12 @@ FWL_Error CFX_Path::Clear() {
return FWL_Error::Succeeded;
}
-FX_BOOL CFX_Path::IsEmpty() const {
+bool CFX_Path::IsEmpty() const {
if (!m_generator)
- return FALSE;
+ return false;
if (m_generator->GetPathData()->GetPointCount() == 0)
- return TRUE;
- return FALSE;
+ return true;
+ return false;
}
CFX_PathData* CFX_Path::GetPathData() const {
diff --git a/xfa/fxgraphics/cfx_path.h b/xfa/fxgraphics/cfx_path.h
index 8a19d6481f..9171a91a00 100644
--- a/xfa/fxgraphics/cfx_path.h
+++ b/xfa/fxgraphics/cfx_path.h
@@ -70,7 +70,7 @@ class CFX_Path final {
FWL_Error AddSubpath(CFX_Path* path);
FWL_Error Clear();
- FX_BOOL IsEmpty() const;
+ bool IsEmpty() const;
CFX_PathData* GetPathData() const;
private:
diff --git a/xfa/fxgraphics/cfx_path_generator.cpp b/xfa/fxgraphics/cfx_path_generator.cpp
index b5843ed998..0122b1ce4d 100644
--- a/xfa/fxgraphics/cfx_path_generator.cpp
+++ b/xfa/fxgraphics/cfx_path_generator.cpp
@@ -161,7 +161,7 @@ void CFX_PathGenerator::AddArc(FX_FLOAT x,
x + (width * FXSYS_cos(start_angle)),
y + (height * FXSYS_sin(start_angle)), FXPT_MOVETO);
FX_FLOAT total_sweep = 0, local_sweep = 0, prev_sweep = 0;
- FX_BOOL done = FALSE;
+ bool done = false;
do {
if (sweep_angle < 0) {
prev_sweep = total_sweep;
@@ -169,7 +169,7 @@ void CFX_PathGenerator::AddArc(FX_FLOAT x,
total_sweep -= FX_PI / 2;
if (total_sweep <= sweep_angle + bezier_arc_angle_epsilon) {
local_sweep = sweep_angle - prev_sweep;
- done = TRUE;
+ done = true;
}
} else {
prev_sweep = total_sweep;
@@ -177,7 +177,7 @@ void CFX_PathGenerator::AddArc(FX_FLOAT x,
total_sweep += FX_PI / 2;
if (total_sweep >= sweep_angle - bezier_arc_angle_epsilon) {
local_sweep = sweep_angle - prev_sweep;
- done = TRUE;
+ done = true;
}
}
ArcTo(x, y, width, height, start_angle, local_sweep);
diff --git a/xfa/fxgraphics/cfx_shading.cpp b/xfa/fxgraphics/cfx_shading.cpp
index 8be8b03e26..07936302c9 100644
--- a/xfa/fxgraphics/cfx_shading.cpp
+++ b/xfa/fxgraphics/cfx_shading.cpp
@@ -8,8 +8,8 @@
CFX_Shading::CFX_Shading(const CFX_PointF& beginPoint,
const CFX_PointF& endPoint,
- FX_BOOL isExtendedBegin,
- FX_BOOL isExtendedEnd,
+ bool isExtendedBegin,
+ bool isExtendedEnd,
const FX_ARGB beginArgb,
const FX_ARGB endArgb)
: m_type(FX_SHADING_Axial),
@@ -28,8 +28,8 @@ CFX_Shading::CFX_Shading(const CFX_PointF& beginPoint,
const CFX_PointF& endPoint,
const FX_FLOAT beginRadius,
const FX_FLOAT endRadius,
- FX_BOOL isExtendedBegin,
- FX_BOOL isExtendedEnd,
+ bool isExtendedBegin,
+ bool isExtendedEnd,
const FX_ARGB beginArgb,
const FX_ARGB endArgb)
: m_type(FX_SHADING_Radial),
diff --git a/xfa/fxgraphics/cfx_shading.h b/xfa/fxgraphics/cfx_shading.h
index 2cc37cf0f6..4189581895 100644
--- a/xfa/fxgraphics/cfx_shading.h
+++ b/xfa/fxgraphics/cfx_shading.h
@@ -20,8 +20,8 @@ class CFX_Shading {
// Axial shading.
CFX_Shading(const CFX_PointF& beginPoint,
const CFX_PointF& endPoint,
- FX_BOOL isExtendedBegin,
- FX_BOOL isExtendedEnd,
+ bool isExtendedBegin,
+ bool isExtendedEnd,
const FX_ARGB beginArgb,
const FX_ARGB endArgb);
@@ -30,8 +30,8 @@ class CFX_Shading {
const CFX_PointF& endPoint,
const FX_FLOAT beginRadius,
const FX_FLOAT endRadius,
- FX_BOOL isExtendedBegin,
- FX_BOOL isExtendedEnd,
+ bool isExtendedBegin,
+ bool isExtendedEnd,
const FX_ARGB beginArgb,
const FX_ARGB endArgb);
virtual ~CFX_Shading();
@@ -46,8 +46,8 @@ class CFX_Shading {
const CFX_PointF m_endPoint;
const FX_FLOAT m_beginRadius;
const FX_FLOAT m_endRadius;
- const FX_BOOL m_isExtendedBegin;
- const FX_BOOL m_isExtendedEnd;
+ const bool m_isExtendedBegin;
+ const bool m_isExtendedEnd;
const FX_ARGB m_beginArgb;
const FX_ARGB m_endArgb;
FX_ARGB m_argbArray[FX_SHADING_Steps];