summaryrefslogtreecommitdiff
path: root/core/fxge
diff options
context:
space:
mode:
Diffstat (limited to 'core/fxge')
-rw-r--r--core/fxge/agg/fx_agg_driver.cpp42
-rw-r--r--core/fxge/agg/fx_agg_driver.h2
-rw-r--r--core/fxge/apple/apple_int.h2
-rw-r--r--core/fxge/apple/fx_apple_platform.cpp4
-rw-r--r--core/fxge/apple/fx_quartz_device.cpp2
-rw-r--r--core/fxge/cfx_gemodule.h2
-rw-r--r--core/fxge/cfx_graphstate.h10
-rw-r--r--core/fxge/cfx_graphstatedata.h8
-rw-r--r--core/fxge/cfx_pathdata.h4
-rw-r--r--core/fxge/cfx_renderdevice.h14
-rw-r--r--core/fxge/dib/fx_dib_engine.cpp72
-rw-r--r--core/fxge/dib/fx_dib_transform.cpp6
-rw-r--r--core/fxge/fx_font.h4
-rw-r--r--core/fxge/ge/cfx_facecache.cpp2
-rw-r--r--core/fxge/ge/cfx_font.cpp2
-rw-r--r--core/fxge/ge/cfx_gemodule.cpp4
-rw-r--r--core/fxge/ge/cfx_graphstate.cpp12
-rw-r--r--core/fxge/ge/cfx_graphstatedata.cpp6
-rw-r--r--core/fxge/ge/cfx_pathdata.cpp68
-rw-r--r--core/fxge/ge/cfx_renderdevice.cpp49
-rw-r--r--core/fxge/ge/fx_ge_text.cpp4
-rw-r--r--core/fxge/ifx_renderdevicedriver.cpp10
-rw-r--r--core/fxge/ifx_renderdevicedriver.h10
-rw-r--r--core/fxge/skia/fx_skia_device.cpp74
-rw-r--r--core/fxge/skia/fx_skia_device.h10
-rw-r--r--core/fxge/skia/fx_skia_device_unittest.cpp2
-rw-r--r--core/fxge/win32/cfx_psrenderer.cpp17
-rw-r--r--core/fxge/win32/cfx_psrenderer.h2
-rw-r--r--core/fxge/win32/dwrite_int.h8
-rw-r--r--core/fxge/win32/fx_win32_device.cpp81
-rw-r--r--core/fxge/win32/fx_win32_dwrite.cpp8
-rw-r--r--core/fxge/win32/fx_win32_gdipext.cpp42
-rw-r--r--core/fxge/win32/fx_win32_print.cpp18
-rw-r--r--core/fxge/win32/win32_int.h32
34 files changed, 311 insertions, 322 deletions
diff --git a/core/fxge/agg/fx_agg_driver.cpp b/core/fxge/agg/fx_agg_driver.cpp
index 8c7277752e..a3429a5b64 100644
--- a/core/fxge/agg/fx_agg_driver.cpp
+++ b/core/fxge/agg/fx_agg_driver.cpp
@@ -358,7 +358,7 @@ static void RasterizeStroke(agg::rasterizer_scanline_aa& rasterizer,
agg::path_storage& path_data,
const CFX_Matrix* pObject2Device,
const CFX_GraphStateData* pGraphState,
- FX_FLOAT scale = 1.0f,
+ float scale = 1.0f,
bool bStrokeAdjust = false,
bool bTextMode = false) {
agg::line_cap_e cap;
@@ -385,8 +385,8 @@ static void RasterizeStroke(agg::rasterizer_scanline_aa& rasterizer,
join = agg::miter_join_revert;
break;
}
- FX_FLOAT width = pGraphState->m_LineWidth * scale;
- FX_FLOAT unit = 1.f;
+ float width = pGraphState->m_LineWidth * scale;
+ float unit = 1.f;
if (pObject2Device) {
unit =
1.0f / ((pObject2Device->GetXUnit() + pObject2Device->GetYUnit()) / 2);
@@ -398,13 +398,13 @@ static void RasterizeStroke(agg::rasterizer_scanline_aa& rasterizer,
typedef agg::conv_dash<agg::path_storage> dash_converter;
dash_converter dash(path_data);
for (int i = 0; i < (pGraphState->m_DashCount + 1) / 2; i++) {
- FX_FLOAT on = pGraphState->m_DashArray[i * 2];
+ float on = pGraphState->m_DashArray[i * 2];
if (on <= 0.000001f) {
on = 1.0f / 10;
}
- FX_FLOAT off = i * 2 + 1 == pGraphState->m_DashCount
- ? on
- : pGraphState->m_DashArray[i * 2 + 1];
+ float off = i * 2 + 1 == pGraphState->m_DashCount
+ ? on
+ : pGraphState->m_DashArray[i * 2 + 1];
if (off < 0) {
off = 0;
}
@@ -460,7 +460,7 @@ bool CFX_AggDeviceDriver::DrawDeviceText(int nChars,
const FXTEXT_CHARPOS* pCharPos,
CFX_Font* pFont,
const CFX_Matrix* pObject2Device,
- FX_FLOAT font_size,
+ float font_size,
uint32_t color) {
return false;
}
@@ -556,9 +556,9 @@ bool CFX_AggDeviceDriver::SetClip_PathFill(const CFX_PathData* pPathData,
if (size == 5 || size == 4) {
CFX_FloatRect rectf;
if (pPathData->IsRect(pObject2Device, &rectf)) {
- rectf.Intersect(
- CFX_FloatRect(0, 0, (FX_FLOAT)GetDeviceCaps(FXDC_PIXEL_WIDTH),
- (FX_FLOAT)GetDeviceCaps(FXDC_PIXEL_HEIGHT)));
+ rectf.Intersect(CFX_FloatRect(0, 0,
+ (float)GetDeviceCaps(FXDC_PIXEL_WIDTH),
+ (float)GetDeviceCaps(FXDC_PIXEL_HEIGHT)));
FX_RECT rect = rectf.GetOuterRect();
m_pClipRgn->IntersectRect(rect);
return true;
@@ -568,8 +568,8 @@ bool CFX_AggDeviceDriver::SetClip_PathFill(const CFX_PathData* pPathData,
path_data.BuildPath(pPathData, pObject2Device);
path_data.m_PathData.end_poly();
agg::rasterizer_scanline_aa rasterizer;
- rasterizer.clip_box(0.0f, 0.0f, (FX_FLOAT)(GetDeviceCaps(FXDC_PIXEL_WIDTH)),
- (FX_FLOAT)(GetDeviceCaps(FXDC_PIXEL_HEIGHT)));
+ rasterizer.clip_box(0.0f, 0.0f, (float)(GetDeviceCaps(FXDC_PIXEL_WIDTH)),
+ (float)(GetDeviceCaps(FXDC_PIXEL_HEIGHT)));
rasterizer.add_path(path_data.m_PathData);
rasterizer.filling_rule((fill_mode & 3) == FXFILL_WINDING
? agg::fill_non_zero
@@ -589,8 +589,8 @@ bool CFX_AggDeviceDriver::SetClip_PathStroke(
CAgg_PathData path_data;
path_data.BuildPath(pPathData, nullptr);
agg::rasterizer_scanline_aa rasterizer;
- rasterizer.clip_box(0.0f, 0.0f, (FX_FLOAT)(GetDeviceCaps(FXDC_PIXEL_WIDTH)),
- (FX_FLOAT)(GetDeviceCaps(FXDC_PIXEL_HEIGHT)));
+ rasterizer.clip_box(0.0f, 0.0f, (float)(GetDeviceCaps(FXDC_PIXEL_WIDTH)),
+ (float)(GetDeviceCaps(FXDC_PIXEL_HEIGHT)));
RasterizeStroke(rasterizer, path_data.m_PathData, pObject2Device,
pGraphState);
rasterizer.filling_rule(agg::fill_non_zero);
@@ -1467,8 +1467,8 @@ bool CFX_AggDeviceDriver::DrawPath(const CFX_PathData* pPathData,
CAgg_PathData path_data;
path_data.BuildPath(pPathData, pObject2Device);
agg::rasterizer_scanline_aa rasterizer;
- rasterizer.clip_box(0.0f, 0.0f, (FX_FLOAT)(GetDeviceCaps(FXDC_PIXEL_WIDTH)),
- (FX_FLOAT)(GetDeviceCaps(FXDC_PIXEL_HEIGHT)));
+ rasterizer.clip_box(0.0f, 0.0f, (float)(GetDeviceCaps(FXDC_PIXEL_WIDTH)),
+ (float)(GetDeviceCaps(FXDC_PIXEL_HEIGHT)));
rasterizer.add_path(path_data.m_PathData);
rasterizer.filling_rule((fill_mode & 3) == FXFILL_WINDING
? agg::fill_non_zero
@@ -1487,8 +1487,8 @@ bool CFX_AggDeviceDriver::DrawPath(const CFX_PathData* pPathData,
CAgg_PathData path_data;
path_data.BuildPath(pPathData, pObject2Device);
agg::rasterizer_scanline_aa rasterizer;
- rasterizer.clip_box(0.0f, 0.0f, (FX_FLOAT)(GetDeviceCaps(FXDC_PIXEL_WIDTH)),
- (FX_FLOAT)(GetDeviceCaps(FXDC_PIXEL_HEIGHT)));
+ rasterizer.clip_box(0.0f, 0.0f, (float)(GetDeviceCaps(FXDC_PIXEL_WIDTH)),
+ (float)(GetDeviceCaps(FXDC_PIXEL_HEIGHT)));
RasterizeStroke(rasterizer, path_data.m_PathData, nullptr, pGraphState, 1,
false, !!(fill_mode & FX_STROKE_TEXT_MODE));
return RenderRasterizer(rasterizer, stroke_color,
@@ -1514,8 +1514,8 @@ bool CFX_AggDeviceDriver::DrawPath(const CFX_PathData* pPathData,
CAgg_PathData path_data;
path_data.BuildPath(pPathData, &matrix1);
agg::rasterizer_scanline_aa rasterizer;
- rasterizer.clip_box(0.0f, 0.0f, (FX_FLOAT)(GetDeviceCaps(FXDC_PIXEL_WIDTH)),
- (FX_FLOAT)(GetDeviceCaps(FXDC_PIXEL_HEIGHT)));
+ rasterizer.clip_box(0.0f, 0.0f, (float)(GetDeviceCaps(FXDC_PIXEL_WIDTH)),
+ (float)(GetDeviceCaps(FXDC_PIXEL_HEIGHT)));
RasterizeStroke(rasterizer, path_data.m_PathData, &matrix2, pGraphState,
matrix1.a, false, !!(fill_mode & FX_STROKE_TEXT_MODE));
return RenderRasterizer(rasterizer, stroke_color,
diff --git a/core/fxge/agg/fx_agg_driver.h b/core/fxge/agg/fx_agg_driver.h
index 8da63394a4..7b4c7209e8 100644
--- a/core/fxge/agg/fx_agg_driver.h
+++ b/core/fxge/agg/fx_agg_driver.h
@@ -93,7 +93,7 @@ class CFX_AggDeviceDriver : public IFX_RenderDeviceDriver {
const FXTEXT_CHARPOS* pCharPos,
CFX_Font* pFont,
const CFX_Matrix* pObject2Device,
- FX_FLOAT font_size,
+ float font_size,
uint32_t color) override;
int GetDriverType() const override;
diff --git a/core/fxge/apple/apple_int.h b/core/fxge/apple/apple_int.h
index fed6abcfb0..2a4029bd38 100644
--- a/core/fxge/apple/apple_int.h
+++ b/core/fxge/apple/apple_int.h
@@ -27,7 +27,7 @@ class CQuartz2D {
void setGraphicsTextMatrix(void* graphics, CFX_Matrix* matrix);
bool drawGraphicsString(void* graphics,
void* font,
- FX_FLOAT fontSize,
+ float fontSize,
uint16_t* glyphIndices,
CGPoint* glyphPositions,
int32_t chars,
diff --git a/core/fxge/apple/fx_apple_platform.cpp b/core/fxge/apple/fx_apple_platform.cpp
index f576eb0ba2..20e86ed483 100644
--- a/core/fxge/apple/fx_apple_platform.cpp
+++ b/core/fxge/apple/fx_apple_platform.cpp
@@ -30,7 +30,7 @@ bool CGDrawGlyphRun(CGContextRef pContext,
const FXTEXT_CHARPOS* pCharPos,
CFX_Font* pFont,
const CFX_Matrix* pObject2Device,
- FX_FLOAT font_size,
+ float font_size,
uint32_t argb) {
if (nChars == 0)
return true;
@@ -102,7 +102,7 @@ bool CFX_AggDeviceDriver::DrawDeviceText(int nChars,
const FXTEXT_CHARPOS* pCharPos,
CFX_Font* pFont,
const CFX_Matrix* pObject2Device,
- FX_FLOAT font_size,
+ float font_size,
uint32_t argb) {
if (!pFont)
return false;
diff --git a/core/fxge/apple/fx_quartz_device.cpp b/core/fxge/apple/fx_quartz_device.cpp
index 0cd5b6b93a..dbb121065d 100644
--- a/core/fxge/apple/fx_quartz_device.cpp
+++ b/core/fxge/apple/fx_quartz_device.cpp
@@ -77,7 +77,7 @@ void CQuartz2D::setGraphicsTextMatrix(void* graphics, CFX_Matrix* matrix) {
bool CQuartz2D::drawGraphicsString(void* graphics,
void* font,
- FX_FLOAT fontSize,
+ float fontSize,
uint16_t* glyphIndices,
CGPoint* glyphPositions,
int32_t charsCount,
diff --git a/core/fxge/cfx_gemodule.h b/core/fxge/cfx_gemodule.h
index c5bd841002..587ec89e59 100644
--- a/core/fxge/cfx_gemodule.h
+++ b/core/fxge/cfx_gemodule.h
@@ -24,7 +24,7 @@ class CFX_GEModule {
void Init(const char** pUserFontPaths, CCodec_ModuleMgr* pCodecModule);
CFX_FontCache* GetFontCache();
CFX_FontMgr* GetFontMgr() { return m_pFontMgr.get(); }
- void SetTextGamma(FX_FLOAT gammaValue);
+ void SetTextGamma(float gammaValue);
const uint8_t* GetTextGammaTable() const;
CCodec_ModuleMgr* GetCodecModule() { return m_pCodecModule; }
diff --git a/core/fxge/cfx_graphstate.h b/core/fxge/cfx_graphstate.h
index a838dfc17c..b023ce790d 100644
--- a/core/fxge/cfx_graphstate.h
+++ b/core/fxge/cfx_graphstate.h
@@ -20,10 +20,10 @@ class CFX_GraphState {
void Emplace();
- void SetLineDash(CPDF_Array* pArray, FX_FLOAT phase, FX_FLOAT scale);
+ void SetLineDash(CPDF_Array* pArray, float phase, float scale);
- FX_FLOAT GetLineWidth() const;
- void SetLineWidth(FX_FLOAT width);
+ float GetLineWidth() const;
+ void SetLineWidth(float width);
CFX_GraphStateData::LineCap GetLineCap() const;
void SetLineCap(CFX_GraphStateData::LineCap cap);
@@ -31,8 +31,8 @@ class CFX_GraphState {
CFX_GraphStateData::LineJoin GetLineJoin() const;
void SetLineJoin(CFX_GraphStateData::LineJoin join);
- FX_FLOAT GetMiterLimit() const;
- void SetMiterLimit(FX_FLOAT limit);
+ float GetMiterLimit() const;
+ void SetMiterLimit(float limit);
// FIXME(tsepez): remove when all GraphStateData usage gone.
const CFX_GraphStateData* GetObject() const { return m_Ref.GetObject(); }
diff --git a/core/fxge/cfx_graphstatedata.h b/core/fxge/cfx_graphstatedata.h
index 03e4a8f51a..dc0098be3e 100644
--- a/core/fxge/cfx_graphstatedata.h
+++ b/core/fxge/cfx_graphstatedata.h
@@ -22,8 +22,8 @@ class CFX_GraphStateData {
LineCap m_LineCap;
int m_DashCount;
- FX_FLOAT* m_DashArray;
- FX_FLOAT m_DashPhase;
+ float* m_DashArray;
+ float m_DashPhase;
enum LineJoin {
LineJoinMiter = 0,
@@ -31,8 +31,8 @@ class CFX_GraphStateData {
LineJoinBevel = 2,
};
LineJoin m_LineJoin;
- FX_FLOAT m_MiterLimit;
- FX_FLOAT m_LineWidth;
+ float m_MiterLimit;
+ float m_LineWidth;
};
#endif // CORE_FXGE_CFX_GRAPHSTATEDATA_H_
diff --git a/core/fxge/cfx_pathdata.h b/core/fxge/cfx_pathdata.h
index b0e30e32ad..bcb2b7aadf 100644
--- a/core/fxge/cfx_pathdata.h
+++ b/core/fxge/cfx_pathdata.h
@@ -47,7 +47,7 @@ class CFX_PathData {
std::vector<FX_PATHPOINT>& GetPoints() { return m_Points; }
CFX_FloatRect GetBoundingBox() const;
- CFX_FloatRect GetBoundingBox(FX_FLOAT line_width, FX_FLOAT miter_limit) const;
+ CFX_FloatRect GetBoundingBox(float line_width, float miter_limit) const;
void Transform(const CFX_Matrix* pMatrix);
bool IsRect() const;
@@ -59,7 +59,7 @@ class CFX_PathData {
bool IsRect(const CFX_Matrix* pMatrix, CFX_FloatRect* rect) const;
void Append(const CFX_PathData* pSrc, const CFX_Matrix* pMatrix);
- void AppendRect(FX_FLOAT left, FX_FLOAT bottom, FX_FLOAT right, FX_FLOAT top);
+ void AppendRect(float left, float bottom, float right, float top);
void AppendPoint(const CFX_PointF& pos, FXPT_TYPE type, bool closeFigure);
void ClosePath();
diff --git a/core/fxge/cfx_renderdevice.h b/core/fxge/cfx_renderdevice.h
index 2e9abf9963..41f8e4c690 100644
--- a/core/fxge/cfx_renderdevice.h
+++ b/core/fxge/cfx_renderdevice.h
@@ -68,7 +68,7 @@ class FXTEXT_CHARPOS {
FXTEXT_CHARPOS(const FXTEXT_CHARPOS&);
~FXTEXT_CHARPOS();
- FX_FLOAT m_AdjustMatrix[4];
+ float m_AdjustMatrix[4];
CFX_PointF m_Origin;
uint32_t m_GlyphIndex;
int32_t m_FontCharWidth;
@@ -132,10 +132,10 @@ class CFX_RenderDevice {
return FillRectWithBlend(pRect, color, FXDIB_BLEND_NORMAL);
}
bool FillRectWithBlend(const FX_RECT* pRect, uint32_t color, int blend_type);
- bool DrawCosmeticLine(FX_FLOAT x1,
- FX_FLOAT y1,
- FX_FLOAT x2,
- FX_FLOAT y2,
+ bool DrawCosmeticLine(float x1,
+ float y1,
+ float x2,
+ float y2,
uint32_t color,
int fill_mode,
int blend_type);
@@ -203,14 +203,14 @@ class CFX_RenderDevice {
bool DrawNormalText(int nChars,
const FXTEXT_CHARPOS* pCharPos,
CFX_Font* pFont,
- FX_FLOAT font_size,
+ float font_size,
const CFX_Matrix* pText2Device,
uint32_t fill_color,
uint32_t text_flags);
bool DrawTextPath(int nChars,
const FXTEXT_CHARPOS* pCharPos,
CFX_Font* pFont,
- FX_FLOAT font_size,
+ float font_size,
const CFX_Matrix* pText2User,
const CFX_Matrix* pUser2Device,
const CFX_GraphStateData* pGraphState,
diff --git a/core/fxge/dib/fx_dib_engine.cpp b/core/fxge/dib/fx_dib_engine.cpp
index c004aac538..8d90a72401 100644
--- a/core/fxge/dib/fx_dib_engine.cpp
+++ b/core/fxge/dib/fx_dib_engine.cpp
@@ -56,12 +56,12 @@ bool CWeightTable::Calc(int dest_len,
FX_Free(m_pWeightTables);
m_pWeightTables = nullptr;
m_dwWeightTablesSize = 0;
- const double scale = (FX_FLOAT)src_len / (FX_FLOAT)dest_len;
- const double base = dest_len < 0 ? (FX_FLOAT)(src_len) : 0;
+ const double scale = (float)src_len / (float)dest_len;
+ const double base = dest_len < 0 ? (float)(src_len) : 0;
const int ext_size = flags & FXDIB_BICUBIC_INTERPOL ? 3 : 1;
m_ItemSize =
sizeof(int) * 2 +
- (int)(sizeof(int) * (FXSYS_ceil(FXSYS_fabs((FX_FLOAT)scale)) + ext_size));
+ (int)(sizeof(int) * (FXSYS_ceil(FXSYS_fabs((float)scale)) + ext_size));
m_DestMin = dest_min;
if ((dest_max - dest_min) > (int)((1U << 30) - 4) / m_ItemSize)
return false;
@@ -71,14 +71,13 @@ bool CWeightTable::Calc(int dest_len,
if (!m_pWeightTables)
return false;
- if ((flags & FXDIB_NOSMOOTH) != 0 || FXSYS_fabs((FX_FLOAT)scale) < 1.0f) {
+ if ((flags & FXDIB_NOSMOOTH) != 0 || FXSYS_fabs((float)scale) < 1.0f) {
for (int dest_pixel = dest_min; dest_pixel < dest_max; dest_pixel++) {
PixelWeight& pixel_weights = *GetPixelWeight(dest_pixel);
double src_pos = dest_pixel * scale + scale / 2 + base;
if (flags & FXDIB_INTERPOL) {
- pixel_weights.m_SrcStart =
- (int)FXSYS_floor((FX_FLOAT)src_pos - 1.0f / 2);
- pixel_weights.m_SrcEnd = (int)FXSYS_floor((FX_FLOAT)src_pos + 1.0f / 2);
+ pixel_weights.m_SrcStart = (int)FXSYS_floor((float)src_pos - 1.0f / 2);
+ pixel_weights.m_SrcEnd = (int)FXSYS_floor((float)src_pos + 1.0f / 2);
if (pixel_weights.m_SrcStart < src_min) {
pixel_weights.m_SrcStart = src_min;
}
@@ -89,14 +88,12 @@ bool CWeightTable::Calc(int dest_len,
pixel_weights.m_Weights[0] = 65536;
} else {
pixel_weights.m_Weights[1] = FXSYS_round(
- (FX_FLOAT)(src_pos - pixel_weights.m_SrcStart - 1.0f / 2) *
- 65536);
+ (float)(src_pos - pixel_weights.m_SrcStart - 1.0f / 2) * 65536);
pixel_weights.m_Weights[0] = 65536 - pixel_weights.m_Weights[1];
}
} else if (flags & FXDIB_BICUBIC_INTERPOL) {
- pixel_weights.m_SrcStart =
- (int)FXSYS_floor((FX_FLOAT)src_pos - 1.0f / 2);
- pixel_weights.m_SrcEnd = (int)FXSYS_floor((FX_FLOAT)src_pos + 1.0f / 2);
+ pixel_weights.m_SrcStart = (int)FXSYS_floor((float)src_pos - 1.0f / 2);
+ pixel_weights.m_SrcEnd = (int)FXSYS_floor((float)src_pos + 1.0f / 2);
int start = pixel_weights.m_SrcStart - 1;
int end = pixel_weights.m_SrcEnd + 1;
if (start < src_min) {
@@ -114,7 +111,7 @@ bool CWeightTable::Calc(int dest_len,
}
int weight;
weight = FXSYS_round(
- (FX_FLOAT)(src_pos - pixel_weights.m_SrcStart - 1.0f / 2) * 256);
+ (float)(src_pos - pixel_weights.m_SrcStart - 1.0f / 2) * 256);
if (start == end) {
pixel_weights.m_Weights[0] =
(SDP_Table[256 + weight] + SDP_Table[weight] +
@@ -179,7 +176,7 @@ bool CWeightTable::Calc(int dest_len,
}
} else {
pixel_weights.m_SrcStart = pixel_weights.m_SrcEnd =
- (int)FXSYS_floor((FX_FLOAT)src_pos);
+ (int)FXSYS_floor((float)src_pos);
if (pixel_weights.m_SrcStart < src_min) {
pixel_weights.m_SrcStart = src_min;
}
@@ -198,11 +195,11 @@ bool CWeightTable::Calc(int dest_len,
double src_end = src_start + scale;
int start_i, end_i;
if (src_start < src_end) {
- start_i = (int)FXSYS_floor((FX_FLOAT)src_start);
- end_i = (int)FXSYS_ceil((FX_FLOAT)src_end);
+ start_i = (int)FXSYS_floor((float)src_start);
+ end_i = (int)FXSYS_ceil((float)src_end);
} else {
- start_i = (int)FXSYS_floor((FX_FLOAT)src_end);
- end_i = (int)FXSYS_ceil((FX_FLOAT)src_start);
+ start_i = (int)FXSYS_floor((float)src_end);
+ end_i = (int)FXSYS_ceil((float)src_start);
}
if (start_i < src_min) {
start_i = src_min;
@@ -221,18 +218,17 @@ bool CWeightTable::Calc(int dest_len,
pixel_weights.m_SrcStart = start_i;
pixel_weights.m_SrcEnd = end_i;
for (int j = start_i; j <= end_i; j++) {
- double dest_start = ((FX_FLOAT)j - base) / scale;
- double dest_end = ((FX_FLOAT)(j + 1) - base) / scale;
+ double dest_start = ((float)j - base) / scale;
+ double dest_end = ((float)(j + 1) - base) / scale;
if (dest_start > dest_end) {
double temp = dest_start;
dest_start = dest_end;
dest_end = temp;
}
- double area_start = dest_start > (FX_FLOAT)(dest_pixel)
- ? dest_start
- : (FX_FLOAT)(dest_pixel);
- double area_end = dest_end > (FX_FLOAT)(dest_pixel + 1)
- ? (FX_FLOAT)(dest_pixel + 1)
+ double area_start =
+ dest_start > (float)(dest_pixel) ? dest_start : (float)(dest_pixel);
+ double area_end = dest_end > (float)(dest_pixel + 1)
+ ? (float)(dest_pixel + 1)
: dest_end;
double weight = area_start >= area_end ? 0.0f : area_end - area_start;
if (weight == 0 && j == end_i) {
@@ -242,7 +238,7 @@ bool CWeightTable::Calc(int dest_len,
size_t idx = j - start_i;
if (idx >= GetPixelWeightSize())
return false;
- pixel_weights.m_Weights[idx] = FXSYS_round((FX_FLOAT)(weight * 65536));
+ pixel_weights.m_Weights[idx] = FXSYS_round((float)(weight * 65536));
}
}
return true;
@@ -321,14 +317,14 @@ CStretchEngine::CStretchEngine(IFX_ScanlineComposer* pDestBitmap,
m_Flags |= FXDIB_DOWNSAMPLE;
}
}
- double scale_x = (FX_FLOAT)m_SrcWidth / (FX_FLOAT)m_DestWidth;
- double scale_y = (FX_FLOAT)m_SrcHeight / (FX_FLOAT)m_DestHeight;
- double base_x = m_DestWidth > 0 ? 0.0f : (FX_FLOAT)(m_DestWidth);
- double base_y = m_DestHeight > 0 ? 0.0f : (FX_FLOAT)(m_DestHeight);
- double src_left = scale_x * ((FX_FLOAT)(clip_rect.left) + base_x);
- double src_right = scale_x * ((FX_FLOAT)(clip_rect.right) + base_x);
- double src_top = scale_y * ((FX_FLOAT)(clip_rect.top) + base_y);
- double src_bottom = scale_y * ((FX_FLOAT)(clip_rect.bottom) + base_y);
+ double scale_x = (float)m_SrcWidth / (float)m_DestWidth;
+ double scale_y = (float)m_SrcHeight / (float)m_DestHeight;
+ double base_x = m_DestWidth > 0 ? 0.0f : (float)(m_DestWidth);
+ double base_y = m_DestHeight > 0 ? 0.0f : (float)(m_DestHeight);
+ double src_left = scale_x * ((float)(clip_rect.left) + base_x);
+ double src_right = scale_x * ((float)(clip_rect.right) + base_x);
+ double src_top = scale_y * ((float)(clip_rect.top) + base_y);
+ double src_bottom = scale_y * ((float)(clip_rect.bottom) + base_y);
if (src_left > src_right) {
double temp = src_left;
src_left = src_right;
@@ -339,10 +335,10 @@ CStretchEngine::CStretchEngine(IFX_ScanlineComposer* pDestBitmap,
src_top = src_bottom;
src_bottom = temp;
}
- m_SrcClip.left = (int)FXSYS_floor((FX_FLOAT)src_left);
- m_SrcClip.right = (int)FXSYS_ceil((FX_FLOAT)src_right);
- m_SrcClip.top = (int)FXSYS_floor((FX_FLOAT)src_top);
- m_SrcClip.bottom = (int)FXSYS_ceil((FX_FLOAT)src_bottom);
+ m_SrcClip.left = (int)FXSYS_floor((float)src_left);
+ m_SrcClip.right = (int)FXSYS_ceil((float)src_right);
+ m_SrcClip.top = (int)FXSYS_floor((float)src_top);
+ m_SrcClip.bottom = (int)FXSYS_ceil((float)src_bottom);
FX_RECT src_rect(0, 0, m_SrcWidth, m_SrcHeight);
m_SrcClip.Intersect(src_rect);
if (m_SrcBpp == 1) {
diff --git a/core/fxge/dib/fx_dib_transform.cpp b/core/fxge/dib/fx_dib_transform.cpp
index bd88272941..4a1c3ee050 100644
--- a/core/fxge/dib/fx_dib_transform.cpp
+++ b/core/fxge/dib/fx_dib_transform.cpp
@@ -394,7 +394,7 @@ bool CFX_ImageTransformer::Start() {
int stretch_width = (int)FXSYS_ceil(FXSYS_sqrt2(m_pMatrix->a, m_pMatrix->b));
int stretch_height = (int)FXSYS_ceil(FXSYS_sqrt2(m_pMatrix->c, m_pMatrix->d));
CFX_Matrix stretch2dest(1.0f, 0.0f, 0.0f, -1.0f, 0.0f,
- (FX_FLOAT)(stretch_height));
+ (float)(stretch_height));
stretch2dest.Concat(
CFX_Matrix(m_pMatrix->a / stretch_width, m_pMatrix->b / stretch_width,
m_pMatrix->c / stretch_height, m_pMatrix->d / stretch_height,
@@ -453,8 +453,8 @@ bool CFX_ImageTransformer::Continue(IFX_Pause* pPause) {
if (pTransformed->m_pAlphaMask)
pTransformed->m_pAlphaMask->Clear(0);
- CFX_Matrix result2stretch(1.0f, 0.0f, 0.0f, 1.0f, (FX_FLOAT)(m_result.left),
- (FX_FLOAT)(m_result.top));
+ CFX_Matrix result2stretch(1.0f, 0.0f, 0.0f, 1.0f, (float)(m_result.left),
+ (float)(m_result.top));
result2stretch.Concat(m_dest2stretch);
result2stretch.Translate(-m_StretchClip.left, -m_StretchClip.top);
if (!stretch_buf_mask && pTransformed->m_pAlphaMask) {
diff --git a/core/fxge/fx_font.h b/core/fxge/fx_font.h
index 07392fa07f..79957ef506 100644
--- a/core/fxge/fx_font.h
+++ b/core/fxge/fx_font.h
@@ -240,8 +240,8 @@ class FXTEXT_GLYPHPOS {
FX_RECT FXGE_GetGlyphsBBox(const std::vector<FXTEXT_GLYPHPOS>& glyphs,
int anti_alias,
- FX_FLOAT retinaScaleX = 1.0f,
- FX_FLOAT retinaScaleY = 1.0f);
+ float retinaScaleX = 1.0f,
+ float retinaScaleY = 1.0f);
CFX_ByteString GetNameFromTT(const uint8_t* name_table,
uint32_t name_table_size,
diff --git a/core/fxge/ge/cfx_facecache.cpp b/core/fxge/ge/cfx_facecache.cpp
index 314c95b8b2..3cdff44f8b 100644
--- a/core/fxge/ge/cfx_facecache.cpp
+++ b/core/fxge/ge/cfx_facecache.cpp
@@ -44,7 +44,7 @@ void ContrastAdjust(uint8_t* pDataIn,
int nDstRowBytes) {
int col, row, temp;
int max = 0, min = 255;
- FX_FLOAT rate;
+ float rate;
for (row = 0; row < nHeight; row++) {
uint8_t* pRow = pDataIn + row * nSrcRowBytes;
for (col = 0; col < nWidth; col++) {
diff --git a/core/fxge/ge/cfx_font.cpp b/core/fxge/ge/cfx_font.cpp
index 87157b0101..068f0b032c 100644
--- a/core/fxge/ge/cfx_font.cpp
+++ b/core/fxge/ge/cfx_font.cpp
@@ -31,7 +31,7 @@ typedef struct {
CFX_PathData* m_pPath;
int m_CurX;
int m_CurY;
- FX_FLOAT m_CoordUnit;
+ float m_CoordUnit;
} OUTLINE_PARAMS;
#ifdef PDF_ENABLE_XFA
diff --git a/core/fxge/ge/cfx_gemodule.cpp b/core/fxge/ge/cfx_gemodule.cpp
index ed6d6cb32e..790b670e4f 100644
--- a/core/fxge/ge/cfx_gemodule.cpp
+++ b/core/fxge/ge/cfx_gemodule.cpp
@@ -59,11 +59,11 @@ CFX_FontCache* CFX_GEModule::GetFontCache() {
return m_pFontCache;
}
-void CFX_GEModule::SetTextGamma(FX_FLOAT gammaValue) {
+void CFX_GEModule::SetTextGamma(float gammaValue) {
gammaValue /= 2.2f;
for (int i = 0; i < 256; ++i) {
m_GammaValue[i] = static_cast<uint8_t>(
- FXSYS_pow(static_cast<FX_FLOAT>(i) / 255, gammaValue) * 255.0f + 0.5f);
+ FXSYS_pow(static_cast<float>(i) / 255, gammaValue) * 255.0f + 0.5f);
}
}
diff --git a/core/fxge/ge/cfx_graphstate.cpp b/core/fxge/ge/cfx_graphstate.cpp
index 6357aa51a4..54443b9636 100644
--- a/core/fxge/ge/cfx_graphstate.cpp
+++ b/core/fxge/ge/cfx_graphstate.cpp
@@ -19,9 +19,7 @@ void CFX_GraphState::Emplace() {
m_Ref.Emplace();
}
-void CFX_GraphState::SetLineDash(CPDF_Array* pArray,
- FX_FLOAT phase,
- FX_FLOAT scale) {
+void CFX_GraphState::SetLineDash(CPDF_Array* pArray, float phase, float scale) {
CFX_GraphStateData* pData = m_Ref.GetPrivateCopy();
pData->m_DashPhase = phase * scale;
pData->SetDashCount(static_cast<int>(pArray->GetCount()));
@@ -29,11 +27,11 @@ void CFX_GraphState::SetLineDash(CPDF_Array* pArray,
pData->m_DashArray[i] = pArray->GetNumberAt(i) * scale;
}
-FX_FLOAT CFX_GraphState::GetLineWidth() const {
+float CFX_GraphState::GetLineWidth() const {
return m_Ref.GetObject() ? m_Ref.GetObject()->m_LineWidth : 1.f;
}
-void CFX_GraphState::SetLineWidth(FX_FLOAT width) {
+void CFX_GraphState::SetLineWidth(float width) {
m_Ref.GetPrivateCopy()->m_LineWidth = width;
}
@@ -52,10 +50,10 @@ void CFX_GraphState::SetLineJoin(CFX_GraphStateData::LineJoin join) {
m_Ref.GetPrivateCopy()->m_LineJoin = join;
}
-FX_FLOAT CFX_GraphState::GetMiterLimit() const {
+float CFX_GraphState::GetMiterLimit() const {
return m_Ref.GetObject() ? m_Ref.GetObject()->m_MiterLimit : 10.f;
}
-void CFX_GraphState::SetMiterLimit(FX_FLOAT limit) {
+void CFX_GraphState::SetMiterLimit(float limit) {
m_Ref.GetPrivateCopy()->m_MiterLimit = limit;
}
diff --git a/core/fxge/ge/cfx_graphstatedata.cpp b/core/fxge/ge/cfx_graphstatedata.cpp
index 03798a6320..8c5508f2f2 100644
--- a/core/fxge/ge/cfx_graphstatedata.cpp
+++ b/core/fxge/ge/cfx_graphstatedata.cpp
@@ -33,8 +33,8 @@ void CFX_GraphStateData::Copy(const CFX_GraphStateData& src) {
m_MiterLimit = src.m_MiterLimit;
m_LineWidth = src.m_LineWidth;
if (m_DashCount) {
- m_DashArray = FX_Alloc(FX_FLOAT, m_DashCount);
- FXSYS_memcpy(m_DashArray, src.m_DashArray, m_DashCount * sizeof(FX_FLOAT));
+ m_DashArray = FX_Alloc(float, m_DashCount);
+ FXSYS_memcpy(m_DashArray, src.m_DashArray, m_DashCount * sizeof(float));
}
}
@@ -48,5 +48,5 @@ void CFX_GraphStateData::SetDashCount(int count) {
m_DashCount = count;
if (count == 0)
return;
- m_DashArray = FX_Alloc(FX_FLOAT, count);
+ m_DashArray = FX_Alloc(float, count);
}
diff --git a/core/fxge/ge/cfx_pathdata.cpp b/core/fxge/ge/cfx_pathdata.cpp
index 9fa2cd2aac..d4c657c3a4 100644
--- a/core/fxge/ge/cfx_pathdata.cpp
+++ b/core/fxge/ge/cfx_pathdata.cpp
@@ -14,7 +14,7 @@ namespace {
void UpdateLineEndPoints(CFX_FloatRect* rect,
const CFX_PointF& start_pos,
const CFX_PointF& end_pos,
- FX_FLOAT hw) {
+ float hw) {
if (start_pos.x == end_pos.x) {
if (start_pos.y == end_pos.y) {
rect->UpdateRect(end_pos.x + hw, end_pos.y + hw);
@@ -22,7 +22,7 @@ void UpdateLineEndPoints(CFX_FloatRect* rect,
return;
}
- FX_FLOAT point_y;
+ float point_y;
if (end_pos.y < start_pos.y)
point_y = end_pos.y - hw;
else
@@ -34,7 +34,7 @@ void UpdateLineEndPoints(CFX_FloatRect* rect,
}
if (start_pos.y == end_pos.y) {
- FX_FLOAT point_x;
+ float point_x;
if (end_pos.x < start_pos.x)
point_x = end_pos.x - hw;
else
@@ -46,11 +46,11 @@ void UpdateLineEndPoints(CFX_FloatRect* rect,
}
CFX_PointF diff = end_pos - start_pos;
- FX_FLOAT ll = FXSYS_sqrt2(diff.x, diff.y);
- FX_FLOAT mx = end_pos.x + hw * diff.x / ll;
- FX_FLOAT my = end_pos.y + hw * diff.y / ll;
- FX_FLOAT dx1 = hw * diff.y / ll;
- FX_FLOAT dy1 = hw * diff.x / ll;
+ float ll = FXSYS_sqrt2(diff.x, diff.y);
+ float mx = end_pos.x + hw * diff.x / ll;
+ float my = end_pos.y + hw * diff.y / ll;
+ float dx1 = hw * diff.y / ll;
+ float dy1 = hw * diff.x / ll;
rect->UpdateRect(mx - dx1, my + dy1);
rect->UpdateRect(mx + dx1, my - dy1);
}
@@ -59,23 +59,23 @@ void UpdateLineJoinPoints(CFX_FloatRect* rect,
const CFX_PointF& start_pos,
const CFX_PointF& mid_pos,
const CFX_PointF& end_pos,
- FX_FLOAT half_width,
- FX_FLOAT miter_limit) {
- FX_FLOAT start_k = 0;
- FX_FLOAT start_c = 0;
- FX_FLOAT end_k = 0;
- FX_FLOAT end_c = 0;
- FX_FLOAT start_len = 0;
- FX_FLOAT start_dc = 0;
- FX_FLOAT end_len = 0;
- FX_FLOAT end_dc = 0;
- FX_FLOAT one_twentieth = 1.0f / 20;
+ float half_width,
+ float miter_limit) {
+ float start_k = 0;
+ float start_c = 0;
+ float end_k = 0;
+ float end_c = 0;
+ float start_len = 0;
+ float start_dc = 0;
+ float end_len = 0;
+ float end_dc = 0;
+ float one_twentieth = 1.0f / 20;
bool bStartVert = FXSYS_fabs(start_pos.x - mid_pos.x) < one_twentieth;
bool bEndVert = FXSYS_fabs(mid_pos.x - end_pos.x) < one_twentieth;
if (bStartVert && bEndVert) {
int start_dir = mid_pos.y > start_pos.y ? 1 : -1;
- FX_FLOAT point_y = mid_pos.y + half_width * start_dir;
+ float point_y = mid_pos.y + half_width * start_dir;
rect->UpdateRect(mid_pos.x + half_width, point_y);
rect->UpdateRect(mid_pos.x - half_width, point_y);
return;
@@ -86,8 +86,8 @@ void UpdateLineJoinPoints(CFX_FloatRect* rect,
start_k = (mid_pos.y - start_pos.y) / (mid_pos.x - start_pos.x);
start_c = mid_pos.y - (start_k * mid_pos.x);
start_len = FXSYS_sqrt2(start_to_mid.x, start_to_mid.y);
- start_dc = static_cast<FX_FLOAT>(
- FXSYS_fabs(half_width * start_len / start_to_mid.x));
+ start_dc =
+ static_cast<float>(FXSYS_fabs(half_width * start_len / start_to_mid.x));
}
if (!bEndVert) {
CFX_PointF end_to_mid = end_pos - mid_pos;
@@ -95,7 +95,7 @@ void UpdateLineJoinPoints(CFX_FloatRect* rect,
end_c = mid_pos.y - (end_k * mid_pos.x);
end_len = FXSYS_sqrt2(end_to_mid.x, end_to_mid.y);
end_dc =
- static_cast<FX_FLOAT>(FXSYS_fabs(half_width * end_len / end_to_mid.x));
+ static_cast<float>(FXSYS_fabs(half_width * end_len / end_to_mid.x));
}
if (bStartVert) {
CFX_PointF outside(start_pos.x, 0);
@@ -139,20 +139,20 @@ void UpdateLineJoinPoints(CFX_FloatRect* rect,
return;
}
- FX_FLOAT start_outside_c = start_c;
+ float start_outside_c = start_c;
if (end_pos.y < (start_k * end_pos.x) + start_c)
start_outside_c += start_dc;
else
start_outside_c -= start_dc;
- FX_FLOAT end_outside_c = end_c;
+ float end_outside_c = end_c;
if (start_pos.y < (end_k * start_pos.x) + end_c)
end_outside_c += end_dc;
else
end_outside_c -= end_dc;
- FX_FLOAT join_x = (end_outside_c - start_outside_c) / (start_k - end_k);
- FX_FLOAT join_y = start_k * join_x + start_outside_c;
+ float join_x = (end_outside_c - start_outside_c) / (start_k - end_k);
+ float join_y = start_k * join_x + start_outside_c;
rect->UpdateRect(join_x, join_y);
}
@@ -203,10 +203,10 @@ void CFX_PathData::AppendPoint(const CFX_PointF& point,
m_Points.push_back(FX_PATHPOINT(point, type, closeFigure));
}
-void CFX_PathData::AppendRect(FX_FLOAT left,
- FX_FLOAT bottom,
- FX_FLOAT right,
- FX_FLOAT top) {
+void CFX_PathData::AppendRect(float left,
+ float bottom,
+ float right,
+ float top) {
m_Points.push_back(
FX_PATHPOINT(CFX_PointF(left, bottom), FXPT_TYPE::MoveTo, false));
m_Points.push_back(
@@ -230,11 +230,11 @@ CFX_FloatRect CFX_PathData::GetBoundingBox() const {
return rect;
}
-CFX_FloatRect CFX_PathData::GetBoundingBox(FX_FLOAT line_width,
- FX_FLOAT miter_limit) const {
+CFX_FloatRect CFX_PathData::GetBoundingBox(float line_width,
+ float miter_limit) const {
CFX_FloatRect rect(100000.0f, 100000.0f, -100000.0f, -100000.0f);
size_t iPoint = 0;
- FX_FLOAT half_width = line_width;
+ float half_width = line_width;
int iStartPoint = 0;
int iEndPoint = 0;
int iMiddlePoint = 0;
diff --git a/core/fxge/ge/cfx_renderdevice.cpp b/core/fxge/ge/cfx_renderdevice.cpp
index daa67ccc91..fab318373a 100644
--- a/core/fxge/ge/cfx_renderdevice.cpp
+++ b/core/fxge/ge/cfx_renderdevice.cpp
@@ -34,17 +34,16 @@ void AdjustGlyphSpace(std::vector<FXTEXT_GLYPHPOS>* pGlyphAndPos) {
for (size_t i = glyphs.size() - 1; i > 1; --i) {
FXTEXT_GLYPHPOS& next = glyphs[i];
int next_origin = bVertical ? next.m_Origin.y : next.m_Origin.x;
- FX_FLOAT next_origin_f = bVertical ? next.m_fOrigin.y : next.m_fOrigin.x;
+ float next_origin_f = bVertical ? next.m_fOrigin.y : next.m_fOrigin.x;
FXTEXT_GLYPHPOS& current = glyphs[i - 1];
int& current_origin = bVertical ? current.m_Origin.y : current.m_Origin.x;
- FX_FLOAT current_origin_f =
+ float current_origin_f =
bVertical ? current.m_fOrigin.y : current.m_fOrigin.x;
int space = next_origin - current_origin;
- FX_FLOAT space_f = next_origin_f - current_origin_f;
- FX_FLOAT error =
- FXSYS_fabs(space_f) - FXSYS_fabs(static_cast<FX_FLOAT>(space));
+ float space_f = next_origin_f - current_origin_f;
+ float error = FXSYS_fabs(space_f) - FXSYS_fabs(static_cast<float>(space));
if (error > 0.5f)
current_origin += space > 0 ? -1 : 1;
}
@@ -526,16 +525,16 @@ bool CFX_RenderDevice::DrawPathWithBlend(const CFX_PathData* pPathData,
rect_i.bottom++;
}
if (rect_i.Width() >= width + 1) {
- if (rect_f.left - (FX_FLOAT)(rect_i.left) >
- (FX_FLOAT)(rect_i.right) - rect_f.right) {
+ if (rect_f.left - (float)(rect_i.left) >
+ (float)(rect_i.right) - rect_f.right) {
rect_i.left++;
} else {
rect_i.right--;
}
}
if (rect_i.Height() >= height + 1) {
- if (rect_f.top - (FX_FLOAT)(rect_i.top) >
- (FX_FLOAT)(rect_i.bottom) - rect_f.bottom) {
+ if (rect_f.top - (float)(rect_i.top) >
+ (float)(rect_i.bottom) - rect_f.bottom) {
rect_i.top++;
} else {
rect_i.bottom--;
@@ -608,8 +607,8 @@ bool CFX_RenderDevice::DrawFillStrokePath(const CFX_PathData* pPathData,
pObject2Device->TransformRect(bbox);
CFX_Matrix ctm = GetCTM();
- FX_FLOAT fScaleX = FXSYS_fabs(ctm.a);
- FX_FLOAT fScaleY = FXSYS_fabs(ctm.d);
+ float fScaleX = FXSYS_fabs(ctm.a);
+ float fScaleY = FXSYS_fabs(ctm.d);
FX_RECT rect = bbox.GetOuterRect();
CFX_DIBitmap bitmap, Backdrop;
if (!CreateCompatibleBitmap(&bitmap, FXSYS_round(rect.Width() * fScaleX),
@@ -679,10 +678,10 @@ bool CFX_RenderDevice::FillRectWithBlend(const FX_RECT* pRect,
return true;
}
-bool CFX_RenderDevice::DrawCosmeticLine(FX_FLOAT x1,
- FX_FLOAT y1,
- FX_FLOAT x2,
- FX_FLOAT y2,
+bool CFX_RenderDevice::DrawCosmeticLine(float x1,
+ float y1,
+ float x2,
+ float y2,
uint32_t color,
int fill_mode,
int blend_type) {
@@ -714,8 +713,8 @@ bool CFX_RenderDevice::SetDIBitsWithBlend(const CFX_DIBSource* pBitmap,
int blend_mode) {
ASSERT(!pBitmap->IsAlphaMask());
CFX_Matrix ctm = GetCTM();
- FX_FLOAT fScaleX = FXSYS_fabs(ctm.a);
- FX_FLOAT fScaleY = FXSYS_fabs(ctm.d);
+ float fScaleX = FXSYS_fabs(ctm.a);
+ float fScaleY = FXSYS_fabs(ctm.d);
FX_RECT dest_rect(left, top,
FXSYS_round(left + pBitmap->GetWidth() / fScaleX),
FXSYS_round(top + pBitmap->GetHeight() / fScaleY));
@@ -848,7 +847,7 @@ bool CFX_RenderDevice::SetBitsWithMask(const CFX_DIBSource* pBitmap,
bool CFX_RenderDevice::DrawNormalText(int nChars,
const FXTEXT_CHARPOS* pCharPos,
CFX_Font* pFont,
- FX_FLOAT font_size,
+ float font_size,
const CFX_Matrix* pText2Device,
uint32_t fill_color,
uint32_t text_flags) {
@@ -916,8 +915,8 @@ bool CFX_RenderDevice::DrawNormalText(int nChars,
}
std::vector<FXTEXT_GLYPHPOS> glyphs(nChars);
CFX_Matrix matrixCTM = GetCTM();
- FX_FLOAT scale_x = FXSYS_fabs(matrixCTM.a);
- FX_FLOAT scale_y = FXSYS_fabs(matrixCTM.d);
+ float scale_x = FXSYS_fabs(matrixCTM.a);
+ float scale_y = FXSYS_fabs(matrixCTM.d);
CFX_Matrix deviceCtm = char2device;
CFX_Matrix m(scale_x, 0, 0, scale_y, 0, 0);
deviceCtm.Concat(m);
@@ -958,10 +957,10 @@ bool CFX_RenderDevice::DrawNormalText(int nChars,
bmp_rect1.right++;
bmp_rect1.bottom++;
}
- FX_RECT bmp_rect(FXSYS_round((FX_FLOAT)(bmp_rect1.left) / scale_x),
- FXSYS_round((FX_FLOAT)(bmp_rect1.top) / scale_y),
- FXSYS_round((FX_FLOAT)bmp_rect1.right / scale_x),
- FXSYS_round((FX_FLOAT)bmp_rect1.bottom / scale_y));
+ FX_RECT bmp_rect(FXSYS_round((float)(bmp_rect1.left) / scale_x),
+ FXSYS_round((float)(bmp_rect1.top) / scale_y),
+ FXSYS_round((float)bmp_rect1.right / scale_x),
+ FXSYS_round((float)bmp_rect1.bottom / scale_y));
bmp_rect.Intersect(m_ClipBox);
if (bmp_rect.IsEmpty())
return true;
@@ -1067,7 +1066,7 @@ bool CFX_RenderDevice::DrawNormalText(int nChars,
bool CFX_RenderDevice::DrawTextPath(int nChars,
const FXTEXT_CHARPOS* pCharPos,
CFX_Font* pFont,
- FX_FLOAT font_size,
+ float font_size,
const CFX_Matrix* pText2User,
const CFX_Matrix* pUser2Device,
const CFX_GraphStateData* pGraphState,
diff --git a/core/fxge/ge/fx_ge_text.cpp b/core/fxge/ge/fx_ge_text.cpp
index 669969db0b..f3dea9178d 100644
--- a/core/fxge/ge/fx_ge_text.cpp
+++ b/core/fxge/ge/fx_ge_text.cpp
@@ -45,8 +45,8 @@ ScopedFontTransform::~ScopedFontTransform() {
FX_RECT FXGE_GetGlyphsBBox(const std::vector<FXTEXT_GLYPHPOS>& glyphs,
int anti_alias,
- FX_FLOAT retinaScaleX,
- FX_FLOAT retinaScaleY) {
+ float retinaScaleX,
+ float retinaScaleY) {
FX_RECT rect(0, 0, 0, 0);
bool bStarted = false;
for (const FXTEXT_GLYPHPOS& glyph : glyphs) {
diff --git a/core/fxge/ifx_renderdevicedriver.cpp b/core/fxge/ifx_renderdevicedriver.cpp
index 77af00f430..44ce833d99 100644
--- a/core/fxge/ifx_renderdevicedriver.cpp
+++ b/core/fxge/ifx_renderdevicedriver.cpp
@@ -39,10 +39,10 @@ bool IFX_RenderDeviceDriver::FillRectWithBlend(const FX_RECT* pRect,
return false;
}
-bool IFX_RenderDeviceDriver::DrawCosmeticLine(FX_FLOAT x1,
- FX_FLOAT y1,
- FX_FLOAT x2,
- FX_FLOAT y2,
+bool IFX_RenderDeviceDriver::DrawCosmeticLine(float x1,
+ float y1,
+ float x2,
+ float y2,
uint32_t color,
int blend_type) {
return false;
@@ -68,7 +68,7 @@ bool IFX_RenderDeviceDriver::DrawDeviceText(int nChars,
const FXTEXT_CHARPOS* pCharPos,
CFX_Font* pFont,
const CFX_Matrix* pObject2Device,
- FX_FLOAT font_size,
+ float font_size,
uint32_t color) {
return false;
}
diff --git a/core/fxge/ifx_renderdevicedriver.h b/core/fxge/ifx_renderdevicedriver.h
index fd35149e42..3dd4730f9b 100644
--- a/core/fxge/ifx_renderdevicedriver.h
+++ b/core/fxge/ifx_renderdevicedriver.h
@@ -49,10 +49,10 @@ class IFX_RenderDeviceDriver {
virtual bool FillRectWithBlend(const FX_RECT* pRect,
uint32_t fill_color,
int blend_type);
- virtual bool DrawCosmeticLine(FX_FLOAT x1,
- FX_FLOAT y1,
- FX_FLOAT x2,
- FX_FLOAT y2,
+ virtual bool DrawCosmeticLine(float x1,
+ float y1,
+ float x2,
+ float y2,
uint32_t color,
int blend_type);
@@ -87,7 +87,7 @@ class IFX_RenderDeviceDriver {
const FXTEXT_CHARPOS* pCharPos,
CFX_Font* pFont,
const CFX_Matrix* pObject2Device,
- FX_FLOAT font_size,
+ float font_size,
uint32_t color);
virtual void* GetPlatformSurface() const;
virtual int GetDriverType() const;
diff --git a/core/fxge/skia/fx_skia_device.cpp b/core/fxge/skia/fx_skia_device.cpp
index 7e23f97287..949ffb8031 100644
--- a/core/fxge/skia/fx_skia_device.cpp
+++ b/core/fxge/skia/fx_skia_device.cpp
@@ -368,7 +368,7 @@ bool AddColors(const CPDF_ExpIntFunc* pFunc, SkTDArray<SkColor>* skColors) {
return true;
}
-uint8_t FloatToByte(FX_FLOAT f) {
+uint8_t FloatToByte(float f) {
ASSERT(0 <= f && f <= 1);
return (uint8_t)(f * 255.99f);
}
@@ -395,25 +395,25 @@ bool AddSamples(const CPDF_SampledFunc* pFunc,
if (pFunc->GetSampleStream()->GetSize() < sampleCount * 3 * sampleSize / 8)
return false;
- FX_FLOAT colorsMin[3];
- FX_FLOAT colorsMax[3];
+ float colorsMin[3];
+ float colorsMax[3];
for (int i = 0; i < 3; ++i) {
colorsMin[i] = pFunc->GetRange(i * 2);
colorsMax[i] = pFunc->GetRange(i * 2 + 1);
}
const uint8_t* pSampleData = pFunc->GetSampleStream()->GetData();
for (uint32_t i = 0; i < sampleCount; ++i) {
- FX_FLOAT floatColors[3];
+ float floatColors[3];
for (uint32_t j = 0; j < 3; ++j) {
int sample = GetBits32(pSampleData, (i * 3 + j) * sampleSize, sampleSize);
- FX_FLOAT interp = (FX_FLOAT)sample / (sampleCount - 1);
+ float interp = (float)sample / (sampleCount - 1);
floatColors[j] = colorsMin[j] + (colorsMax[j] - colorsMin[j]) * interp;
}
SkColor color =
SkPackARGB32(0xFF, FloatToByte(floatColors[0]),
FloatToByte(floatColors[1]), FloatToByte(floatColors[2]));
skColors->push(color);
- skPos->push((FX_FLOAT)i / (sampleCount - 1));
+ skPos->push((float)i / (sampleCount - 1));
}
return true;
}
@@ -421,7 +421,7 @@ bool AddSamples(const CPDF_SampledFunc* pFunc,
bool AddStitching(const CPDF_StitchFunc* pFunc,
SkTDArray<SkColor>* skColors,
SkTDArray<SkScalar>* skPos) {
- FX_FLOAT boundsStart = pFunc->GetDomain(0);
+ float boundsStart = pFunc->GetDomain(0);
const auto& subFunctions = pFunc->GetSubFunctions();
int subFunctionCount = subFunctions.size();
@@ -431,7 +431,7 @@ bool AddStitching(const CPDF_StitchFunc* pFunc,
return false;
if (!AddColors(pSubFunc, skColors))
return false;
- FX_FLOAT boundsEnd =
+ float boundsEnd =
i < subFunctionCount - 1 ? pFunc->GetBound(i + 1) : pFunc->GetDomain(1);
skPos->push(boundsStart);
skPos->push(boundsEnd);
@@ -771,7 +771,7 @@ class SkiaState {
const FXTEXT_CHARPOS* pCharPos,
CFX_Font* pFont,
const CFX_Matrix* pMatrix,
- FX_FLOAT font_size,
+ float font_size,
uint32_t color) {
if (m_debugDisable)
return false;
@@ -973,7 +973,7 @@ class SkiaState {
bool FontChanged(CFX_Font* pFont,
const CFX_Matrix* pMatrix,
- FX_FLOAT font_size,
+ float font_size,
uint32_t color) const {
return pFont != m_pFont || MatrixChanged(pMatrix, m_drawMatrix) ||
font_size != m_fontSize || color != m_fillColor;
@@ -1118,7 +1118,7 @@ class SkiaState {
CFX_Matrix m_clipMatrix;
CFX_SkiaDeviceDriver* m_pDriver;
CFX_Font* m_pFont;
- FX_FLOAT m_fontSize;
+ float m_fontSize;
uint32_t m_fillColor;
uint32_t m_strokeColor;
int m_blendType;
@@ -1170,7 +1170,7 @@ void CFX_SkiaDeviceDriver::PaintStroke(SkPaint* spaint,
inverse.set(SkMatrix::kMTransY, 0);
SkVector deviceUnits[2] = {{0, 1}, {1, 0}};
inverse.mapPoints(deviceUnits, SK_ARRAY_COUNT(deviceUnits));
- FX_FLOAT width =
+ float width =
SkTMax(pGraphState->m_LineWidth,
SkTMin(deviceUnits[0].length(), deviceUnits[1].length()));
if (pGraphState->m_DashArray) {
@@ -1178,12 +1178,12 @@ void CFX_SkiaDeviceDriver::PaintStroke(SkPaint* spaint,
SkScalar* intervals = FX_Alloc2D(SkScalar, count, sizeof(SkScalar));
// Set dash pattern
for (int i = 0; i < count; i++) {
- FX_FLOAT on = pGraphState->m_DashArray[i * 2];
+ float on = pGraphState->m_DashArray[i * 2];
if (on <= 0.000001f)
on = 1.f / 10;
- FX_FLOAT off = i * 2 + 1 == pGraphState->m_DashCount
- ? on
- : pGraphState->m_DashArray[i * 2 + 1];
+ float off = i * 2 + 1 == pGraphState->m_DashCount
+ ? on
+ : pGraphState->m_DashArray[i * 2 + 1];
if (off < 0)
off = 0;
intervals[i * 2] = on;
@@ -1261,7 +1261,7 @@ bool CFX_SkiaDeviceDriver::DrawDeviceText(int nChars,
const FXTEXT_CHARPOS* pCharPos,
CFX_Font* pFont,
const CFX_Matrix* pObject2Device,
- FX_FLOAT font_size,
+ float font_size,
uint32_t color) {
if (m_pCache->DrawText(nChars, pCharPos, pFont, pObject2Device, font_size,
color)) {
@@ -1435,9 +1435,9 @@ bool CFX_SkiaDeviceDriver::SetClip_PathFill(
pPathData->GetPoints().size() == 4) {
CFX_FloatRect rectf;
if (pPathData->IsRect(deviceMatrix, &rectf)) {
- rectf.Intersect(
- CFX_FloatRect(0, 0, (FX_FLOAT)GetDeviceCaps(FXDC_PIXEL_WIDTH),
- (FX_FLOAT)GetDeviceCaps(FXDC_PIXEL_HEIGHT)));
+ rectf.Intersect(CFX_FloatRect(0, 0,
+ (float)GetDeviceCaps(FXDC_PIXEL_WIDTH),
+ (float)GetDeviceCaps(FXDC_PIXEL_HEIGHT)));
// note that PDF's y-axis goes up; Skia's y-axis goes down
if (!cached) {
SkRect skClipRect =
@@ -1573,10 +1573,10 @@ bool CFX_SkiaDeviceDriver::DrawPath(
return true;
}
-bool CFX_SkiaDeviceDriver::DrawCosmeticLine(FX_FLOAT x1,
- FX_FLOAT y1,
- FX_FLOAT x2,
- FX_FLOAT y2,
+bool CFX_SkiaDeviceDriver::DrawCosmeticLine(float x1,
+ float y1,
+ float x2,
+ float y2,
uint32_t color,
int blend_type) {
return false;
@@ -1661,10 +1661,10 @@ bool CFX_SkiaDeviceDriver::DrawShading(const CPDF_ShadingPattern* pPattern,
SkPath skClip;
SkPath skPath;
if (kAxialShading == shadingType) {
- FX_FLOAT start_x = pCoords->GetNumberAt(0);
- FX_FLOAT start_y = pCoords->GetNumberAt(1);
- FX_FLOAT end_x = pCoords->GetNumberAt(2);
- FX_FLOAT end_y = pCoords->GetNumberAt(3);
+ float start_x = pCoords->GetNumberAt(0);
+ float start_y = pCoords->GetNumberAt(1);
+ float end_x = pCoords->GetNumberAt(2);
+ float end_y = pCoords->GetNumberAt(3);
SkPoint pts[] = {{start_x, start_y}, {end_x, end_y}};
skMatrix.mapPoints(pts, SK_ARRAY_COUNT(pts));
paint.setShader(SkGradientShader::MakeLinear(
@@ -1701,12 +1701,12 @@ bool CFX_SkiaDeviceDriver::DrawShading(const CPDF_ShadingPattern* pPattern,
skPath.addRect(skRect);
skMatrix.setIdentity();
} else if (kRadialShading == shadingType) {
- FX_FLOAT start_x = pCoords->GetNumberAt(0);
- FX_FLOAT start_y = pCoords->GetNumberAt(1);
- FX_FLOAT start_r = pCoords->GetNumberAt(2);
- FX_FLOAT end_x = pCoords->GetNumberAt(3);
- FX_FLOAT end_y = pCoords->GetNumberAt(4);
- FX_FLOAT end_r = pCoords->GetNumberAt(5);
+ float start_x = pCoords->GetNumberAt(0);
+ float start_y = pCoords->GetNumberAt(1);
+ float start_r = pCoords->GetNumberAt(2);
+ float end_x = pCoords->GetNumberAt(3);
+ float end_y = pCoords->GetNumberAt(4);
+ float end_r = pCoords->GetNumberAt(5);
SkPoint pts[] = {{start_x, start_y}, {end_x, end_y}};
paint.setShader(SkGradientShader::MakeTwoPointConical(
@@ -1761,9 +1761,9 @@ bool CFX_SkiaDeviceDriver::DrawShading(const CPDF_ShadingPattern* pPattern,
cubics[i].fY = point.y;
}
for (int i = iStartColor; i < (int)SK_ARRAY_COUNT(colors); i++) {
- FX_FLOAT r;
- FX_FLOAT g;
- FX_FLOAT b;
+ float r;
+ float g;
+ float b;
std::tie(r, g, b) = stream.ReadColor();
colors[i] = SkColorSetARGBInline(0xFF, (U8CPU)(r * 255),
(U8CPU)(g * 255), (U8CPU)(b * 255));
diff --git a/core/fxge/skia/fx_skia_device.h b/core/fxge/skia/fx_skia_device.h
index ecb1104518..b26ebdd724 100644
--- a/core/fxge/skia/fx_skia_device.h
+++ b/core/fxge/skia/fx_skia_device.h
@@ -69,10 +69,10 @@ class CFX_SkiaDeviceDriver : public IFX_RenderDeviceDriver {
int blend_type) override;
/** Draw a single pixel (device dependant) line */
- bool DrawCosmeticLine(FX_FLOAT x1,
- FX_FLOAT y1,
- FX_FLOAT x2,
- FX_FLOAT y2,
+ bool DrawCosmeticLine(float x1,
+ float y1,
+ float x2,
+ float y2,
uint32_t color,
int blend_type) override;
@@ -134,7 +134,7 @@ class CFX_SkiaDeviceDriver : public IFX_RenderDeviceDriver {
const FXTEXT_CHARPOS* pCharPos,
CFX_Font* pFont,
const CFX_Matrix* pObject2Device,
- FX_FLOAT font_size,
+ float font_size,
uint32_t color) override;
bool DrawShading(const CPDF_ShadingPattern* pPattern,
diff --git a/core/fxge/skia/fx_skia_device_unittest.cpp b/core/fxge/skia/fx_skia_device_unittest.cpp
index afd47780d7..d612840b4c 100644
--- a/core/fxge/skia/fx_skia_device_unittest.cpp
+++ b/core/fxge/skia/fx_skia_device_unittest.cpp
@@ -41,7 +41,7 @@ void CommonTest(CFX_SkiaDeviceDriver* driver, const State& state) {
charPos[0].m_FontCharWidth = 4;
CFX_Font font;
- FX_FLOAT fontSize = 1;
+ float fontSize = 1;
CFX_PathData clipPath, clipPath2;
clipPath.AppendRect(0, 0, 3, 1);
clipPath2.AppendRect(0, 0, 2, 1);
diff --git a/core/fxge/win32/cfx_psrenderer.cpp b/core/fxge/win32/cfx_psrenderer.cpp
index c3d2c66d9d..391af83630 100644
--- a/core/fxge/win32/cfx_psrenderer.cpp
+++ b/core/fxge/win32/cfx_psrenderer.cpp
@@ -22,7 +22,7 @@ struct PSGlyph {
CFX_Font* m_pFont;
uint32_t m_GlyphIndex;
bool m_bGlyphAdjust;
- FX_FLOAT m_AdjustMatrix[4];
+ float m_AdjustMatrix[4];
};
class CPSFont {
@@ -260,7 +260,7 @@ void CFX_PSRenderer::SetGraphState(const CFX_GraphStateData* pGraphState) {
if (!m_bGraphStateSet ||
m_CurGraphState.m_DashCount != pGraphState->m_DashCount ||
FXSYS_memcmp(m_CurGraphState.m_DashArray, pGraphState->m_DashArray,
- sizeof(FX_FLOAT) * m_CurGraphState.m_DashCount)) {
+ sizeof(float) * m_CurGraphState.m_DashCount)) {
buf << "[";
for (int i = 0; i < pGraphState->m_DashCount; ++i) {
buf << pGraphState->m_DashArray[i] << " ";
@@ -343,9 +343,9 @@ bool CFX_PSRenderer::SetDIBits(const CFX_DIBSource* pSource,
int left,
int top) {
StartRendering();
- CFX_Matrix matrix((FX_FLOAT)(pSource->GetWidth()), 0.0f, 0.0f,
- -(FX_FLOAT)(pSource->GetHeight()), (FX_FLOAT)(left),
- (FX_FLOAT)(top + pSource->GetHeight()));
+ CFX_Matrix matrix((float)(pSource->GetWidth()), 0.0f, 0.0f,
+ -(float)(pSource->GetHeight()), (float)(left),
+ (float)(top + pSource->GetHeight()));
return DrawDIBits(pSource, color, &matrix, 0);
}
@@ -357,9 +357,8 @@ bool CFX_PSRenderer::StretchDIBits(const CFX_DIBSource* pSource,
int dest_height,
uint32_t flags) {
StartRendering();
- CFX_Matrix matrix((FX_FLOAT)(dest_width), 0.0f, 0.0f,
- (FX_FLOAT)(-dest_height), (FX_FLOAT)(dest_left),
- (FX_FLOAT)(dest_top + dest_height));
+ CFX_Matrix matrix((float)(dest_width), 0.0f, 0.0f, (float)(-dest_height),
+ (float)(dest_left), (float)(dest_top + dest_height));
return DrawDIBits(pSource, color, &matrix, flags);
}
@@ -632,7 +631,7 @@ bool CFX_PSRenderer::DrawText(int nChars,
const FXTEXT_CHARPOS* pCharPos,
CFX_Font* pFont,
const CFX_Matrix* pObject2Device,
- FX_FLOAT font_size,
+ float font_size,
uint32_t color) {
StartRendering();
int alpha = FXARGB_A(color);
diff --git a/core/fxge/win32/cfx_psrenderer.h b/core/fxge/win32/cfx_psrenderer.h
index 163c6180af..133d7b9d72 100644
--- a/core/fxge/win32/cfx_psrenderer.h
+++ b/core/fxge/win32/cfx_psrenderer.h
@@ -70,7 +70,7 @@ class CFX_PSRenderer {
const FXTEXT_CHARPOS* pCharPos,
CFX_Font* pFont,
const CFX_Matrix* pObject2Device,
- FX_FLOAT font_size,
+ float font_size,
uint32_t color);
private:
diff --git a/core/fxge/win32/dwrite_int.h b/core/fxge/win32/dwrite_int.h
index 86ead89947..105c34998c 100644
--- a/core/fxge/win32/dwrite_int.h
+++ b/core/fxge/win32/dwrite_int.h
@@ -46,14 +46,14 @@ class CDWriteExt {
FX_RECT& stringRect,
CFX_Matrix* pMatrix,
void* font,
- FX_FLOAT font_size,
+ float font_size,
FX_ARGB text_color,
int glyph_count,
unsigned short* glyph_indices,
- FX_FLOAT baselineOriginX,
- FX_FLOAT baselineOriginY,
+ float baselineOriginX,
+ float baselineOriginY,
void* glyph_offsets,
- FX_FLOAT* glyph_advances);
+ float* glyph_advances);
void DwDeleteFont(void* pFont);
protected:
diff --git a/core/fxge/win32/fx_win32_device.cpp b/core/fxge/win32/fx_win32_device.cpp
index d1d81b18e4..b2ee4549ea 100644
--- a/core/fxge/win32/fx_win32_device.cpp
+++ b/core/fxge/win32/fx_win32_device.cpp
@@ -91,8 +91,8 @@ bool IsGDIEnabled() {
HPEN CreatePen(const CFX_GraphStateData* pGraphState,
const CFX_Matrix* pMatrix,
uint32_t argb) {
- FX_FLOAT width;
- FX_FLOAT scale = 1.f;
+ float width;
+ float scale = 1.f;
if (pMatrix)
scale = FXSYS_fabs(pMatrix->a) > FXSYS_fabs(pMatrix->b)
? FXSYS_fabs(pMatrix->a)
@@ -215,26 +215,26 @@ void SetPathToDC(HDC hDC,
// altogether and replace by Skia code.
struct rect_base {
- FX_FLOAT x1;
- FX_FLOAT y1;
- FX_FLOAT x2;
- FX_FLOAT y2;
+ float x1;
+ float y1;
+ float x2;
+ float y2;
};
-unsigned clip_liang_barsky(FX_FLOAT x1,
- FX_FLOAT y1,
- FX_FLOAT x2,
- FX_FLOAT y2,
+unsigned clip_liang_barsky(float x1,
+ float y1,
+ float x2,
+ float y2,
const rect_base& clip_box,
- FX_FLOAT* x,
- FX_FLOAT* y) {
- const FX_FLOAT nearzero = 1e-30f;
- FX_FLOAT deltax = x2 - x1;
- FX_FLOAT deltay = y2 - y1;
+ float* x,
+ float* y) {
+ const float nearzero = 1e-30f;
+ float deltax = x2 - x1;
+ float deltay = y2 - y1;
unsigned np = 0;
if (deltax == 0)
deltax = (x1 > clip_box.x1) ? -nearzero : nearzero;
- FX_FLOAT xin, xout;
+ float xin, xout;
if (deltax > 0) {
xin = clip_box.x1;
xout = clip_box.x2;
@@ -242,10 +242,10 @@ unsigned clip_liang_barsky(FX_FLOAT x1,
xin = clip_box.x2;
xout = clip_box.x1;
}
- FX_FLOAT tinx = (xin - x1) / deltax;
+ float tinx = (xin - x1) / deltax;
if (deltay == 0)
deltay = (y1 > clip_box.y1) ? -nearzero : nearzero;
- FX_FLOAT yin, yout;
+ float yin, yout;
if (deltay > 0) {
yin = clip_box.y1;
yout = clip_box.y2;
@@ -253,8 +253,8 @@ unsigned clip_liang_barsky(FX_FLOAT x1,
yin = clip_box.y2;
yout = clip_box.y1;
}
- FX_FLOAT tiny = (yin - y1) / deltay;
- FX_FLOAT tin1, tin2;
+ float tiny = (yin - y1) / deltay;
+ float tin1, tin2;
if (tinx < tiny) {
tin1 = tinx;
tin2 = tiny;
@@ -269,9 +269,9 @@ unsigned clip_liang_barsky(FX_FLOAT x1,
++np;
}
if (tin2 <= 1.0f) {
- FX_FLOAT toutx = (xout - x1) / deltax;
- FX_FLOAT touty = (yout - y1) / deltay;
- FX_FLOAT tout1 = (toutx < touty) ? toutx : touty;
+ float toutx = (xout - x1) / deltax;
+ float touty = (yout - y1) / deltay;
+ float tout1 = (toutx < touty) ? toutx : touty;
if (tin2 > 0 || tout1 > 0) {
if (tin2 <= tout1) {
if (tin2 > 0) {
@@ -928,10 +928,7 @@ void* CGdiDeviceDriver::GetPlatformSurface() const {
return (void*)m_hDC;
}
-void CGdiDeviceDriver::DrawLine(FX_FLOAT x1,
- FX_FLOAT y1,
- FX_FLOAT x2,
- FX_FLOAT y2) {
+void CGdiDeviceDriver::DrawLine(float x1, float y1, float x2, float y2) {
if (!m_bMetafileDCType) { // EMF drawing is not bound to the DC.
int startOutOfBoundsFlag = (x1 < 0) | ((x1 > m_Width) << 1) |
((y1 < 0) << 2) | ((y1 > m_Height) << 3);
@@ -941,18 +938,18 @@ void CGdiDeviceDriver::DrawLine(FX_FLOAT x1,
return;
if (startOutOfBoundsFlag || endOutOfBoundsFlag) {
- FX_FLOAT x[2];
- FX_FLOAT y[2];
+ float x[2];
+ float y[2];
int np;
#ifdef _SKIA_SUPPORT_
// TODO(caryclark) temporary replacement of antigrain in line function
// to permit removing antigrain altogether
- rect_base rect = {0.0f, 0.0f, (FX_FLOAT)(m_Width), (FX_FLOAT)(m_Height)};
+ rect_base rect = {0.0f, 0.0f, (float)(m_Width), (float)(m_Height)};
np = clip_liang_barsky(x1, y1, x2, y2, rect, x, y);
#else
- agg::rect_base<FX_FLOAT> rect(0.0f, 0.0f, (FX_FLOAT)(m_Width),
- (FX_FLOAT)(m_Height));
- np = agg::clip_liang_barsky<FX_FLOAT>(x1, y1, x2, y2, rect, x, y);
+ agg::rect_base<float> rect(0.0f, 0.0f, (float)(m_Width),
+ (float)(m_Height));
+ np = agg::clip_liang_barsky<float>(x1, y1, x2, y2, rect, x, y);
#endif
if (np == 0)
return;
@@ -994,13 +991,13 @@ bool CGdiDeviceDriver::DrawPath(const CFX_PathData* pPathData,
FX_RECT bbox = bbox_f.GetInnerRect();
if (bbox.Width() <= 0) {
- return DrawCosmeticLine(
- (FX_FLOAT)(bbox.left), (FX_FLOAT)(bbox.top), (FX_FLOAT)(bbox.left),
- (FX_FLOAT)(bbox.bottom + 1), fill_color, FXDIB_BLEND_NORMAL);
+ return DrawCosmeticLine((float)(bbox.left), (float)(bbox.top),
+ (float)(bbox.left), (float)(bbox.bottom + 1),
+ fill_color, FXDIB_BLEND_NORMAL);
}
if (bbox.Height() <= 0) {
- return DrawCosmeticLine((FX_FLOAT)(bbox.left), (FX_FLOAT)(bbox.top),
- (FX_FLOAT)(bbox.right + 1), (FX_FLOAT)(bbox.top),
+ return DrawCosmeticLine((float)(bbox.left), (float)(bbox.top),
+ (float)(bbox.right + 1), (float)(bbox.top),
fill_color, FXDIB_BLEND_NORMAL);
}
}
@@ -1133,10 +1130,10 @@ bool CGdiDeviceDriver::SetClip_PathStroke(
return ret;
}
-bool CGdiDeviceDriver::DrawCosmeticLine(FX_FLOAT x1,
- FX_FLOAT y1,
- FX_FLOAT x2,
- FX_FLOAT y2,
+bool CGdiDeviceDriver::DrawCosmeticLine(float x1,
+ float y1,
+ float x2,
+ float y2,
uint32_t color,
int blend_type) {
if (blend_type != FXDIB_BLEND_NORMAL)
diff --git a/core/fxge/win32/fx_win32_dwrite.cpp b/core/fxge/win32/fx_win32_dwrite.cpp
index dc0f5ed745..e088e832bc 100644
--- a/core/fxge/win32/fx_win32_dwrite.cpp
+++ b/core/fxge/win32/fx_win32_dwrite.cpp
@@ -227,14 +227,14 @@ bool CDWriteExt::DwRendingString(void* renderTarget,
FX_RECT& stringRect,
CFX_Matrix* pMatrix,
void* font,
- FX_FLOAT font_size,
+ float font_size,
FX_ARGB text_color,
int glyph_count,
unsigned short* glyph_indices,
- FX_FLOAT baselineOriginX,
- FX_FLOAT baselineOriginY,
+ float baselineOriginX,
+ float baselineOriginY,
void* glyph_offsets,
- FX_FLOAT* glyph_advances) {
+ float* glyph_advances) {
if (!renderTarget) {
return true;
}
diff --git a/core/fxge/win32/fx_win32_gdipext.cpp b/core/fxge/win32/fx_win32_gdipext.cpp
index 1e51bba2b3..8a7f55e0cb 100644
--- a/core/fxge/win32/fx_win32_gdipext.cpp
+++ b/core/fxge/win32/fx_win32_gdipext.cpp
@@ -779,7 +779,7 @@ bool CGdiplusExt::GdipCreateFontFamilyFromName(const wchar_t* name,
return false;
}
bool CGdiplusExt::GdipCreateFontFromFamily(void* pFamily,
- FX_FLOAT font_size,
+ float font_size,
int fontstyle,
int flag,
void** pFont) {
@@ -793,13 +793,13 @@ bool CGdiplusExt::GdipCreateFontFromFamily(void* pFamily,
}
return false;
}
-void CGdiplusExt::GdipGetFontSize(void* pFont, FX_FLOAT* size) {
+void CGdiplusExt::GdipGetFontSize(void* pFont, float* size) {
REAL get_size;
CGdiplusExt& GdiplusExt =
((CWin32Platform*)CFX_GEModule::Get()->GetPlatformData())->m_GdiplusExt;
GpStatus status = CallFunc(GdipGetFontSize)((GpFont*)pFont, (REAL*)&get_size);
if (status == Ok) {
- *size = (FX_FLOAT)get_size;
+ *size = (float)get_size;
} else {
*size = 0;
}
@@ -845,7 +845,7 @@ void CGdiplusExt::GdipDeleteBrush(void* pBrush) {
CallFunc(GdipDeleteBrush)((GpSolidFill*)pBrush);
}
void* CGdiplusExt::GdipCreateFontFromCollection(void* pFontCollection,
- FX_FLOAT font_size,
+ float font_size,
int fontstyle) {
CGdiplusExt& GdiplusExt =
((CWin32Platform*)CFX_GEModule::Get()->GetPlatformData())->m_GdiplusExt;
@@ -869,12 +869,12 @@ void* CGdiplusExt::GdipCreateFontFromCollection(void* pFontCollection,
}
return pFont;
}
-void CGdiplusExt::GdipCreateMatrix(FX_FLOAT a,
- FX_FLOAT b,
- FX_FLOAT c,
- FX_FLOAT d,
- FX_FLOAT e,
- FX_FLOAT f,
+void CGdiplusExt::GdipCreateMatrix(float a,
+ float b,
+ float c,
+ float d,
+ float e,
+ float f,
void** matrix) {
CGdiplusExt& GdiplusExt =
((CWin32Platform*)CFX_GEModule::Get()->GetPlatformData())->m_GdiplusExt;
@@ -972,11 +972,11 @@ static GpPen* _GdipCreatePen(const CFX_GraphStateData* pGraphState,
bool bTextMode = false) {
CGdiplusExt& GdiplusExt =
((CWin32Platform*)CFX_GEModule::Get()->GetPlatformData())->m_GdiplusExt;
- FX_FLOAT width = pGraphState ? pGraphState->m_LineWidth : 1.0f;
+ float width = pGraphState ? pGraphState->m_LineWidth : 1.0f;
if (!bTextMode) {
- FX_FLOAT unit =
- pMatrix ? 1.0f / ((pMatrix->GetXUnit() + pMatrix->GetYUnit()) / 2)
- : 1.0f;
+ float unit = pMatrix
+ ? 1.0f / ((pMatrix->GetXUnit() + pMatrix->GetYUnit()) / 2)
+ : 1.0f;
if (width < unit) {
width = unit;
}
@@ -1015,13 +1015,13 @@ static GpPen* _GdipCreatePen(const CFX_GraphStateData* pGraphState,
}
CallFunc(GdipSetPenLineJoin)(pPen, lineJoin);
if (pGraphState->m_DashCount) {
- FX_FLOAT* pDashArray = FX_Alloc(
- FX_FLOAT, pGraphState->m_DashCount + pGraphState->m_DashCount % 2);
+ float* pDashArray = FX_Alloc(
+ float, pGraphState->m_DashCount + pGraphState->m_DashCount % 2);
int nCount = 0;
- FX_FLOAT on_leftover = 0, off_leftover = 0;
+ float on_leftover = 0, off_leftover = 0;
for (int i = 0; i < pGraphState->m_DashCount; i += 2) {
- FX_FLOAT on_phase = pGraphState->m_DashArray[i];
- FX_FLOAT off_phase;
+ float on_phase = pGraphState->m_DashArray[i];
+ float off_phase;
if (i == pGraphState->m_DashCount - 1) {
off_phase = on_phase;
} else {
@@ -1057,7 +1057,7 @@ static GpPen* _GdipCreatePen(const CFX_GraphStateData* pGraphState,
}
}
CallFunc(GdipSetPenDashArray)(pPen, pDashArray, nCount);
- FX_FLOAT phase = pGraphState->m_DashPhase;
+ float phase = pGraphState->m_DashPhase;
if (bDashExtend) {
if (phase < 0.5f) {
phase = 0;
@@ -1089,7 +1089,7 @@ static bool IsSmallTriangle(PointF* points,
}
CFX_PointF diff = p1 - p2;
- FX_FLOAT distance_square = (diff.x * diff.x) + (diff.y * diff.y);
+ float distance_square = (diff.x * diff.x) + (diff.y * diff.y);
if (distance_square < (1.0f * 2 + 1.0f / 4)) {
v1 = i;
v2 = pair1;
diff --git a/core/fxge/win32/fx_win32_print.cpp b/core/fxge/win32/fx_win32_print.cpp
index cda83ebc95..061896f09b 100644
--- a/core/fxge/win32/fx_win32_print.cpp
+++ b/core/fxge/win32/fx_win32_print.cpp
@@ -199,7 +199,7 @@ bool CGdiPrinterDriver::DrawDeviceText(int nChars,
const FXTEXT_CHARPOS* pCharPos,
CFX_Font* pFont,
const CFX_Matrix* pObject2Device,
- FX_FLOAT font_size,
+ float font_size,
uint32_t color) {
#if defined(PDFIUM_PRINT_TEXT_WITH_GDI)
if (!g_pdfium_print_text_with_gdi)
@@ -287,7 +287,7 @@ bool CGdiPrinterDriver::DrawDeviceText(int nChars,
// Text
CFX_WideString wsText;
std::vector<INT> spacing(nChars);
- FX_FLOAT fPreviousOriginX = 0;
+ float fPreviousOriginX = 0;
for (int i = 0; i < nChars; ++i) {
// Only works with PDFs from Skia's PDF generator. Cannot handle arbitrary
// values from PDFs.
@@ -300,8 +300,8 @@ bool CGdiPrinterDriver::DrawDeviceText(int nChars,
// Round the spacing to the nearest integer, but keep track of the rounding
// error for calculating the next spacing value.
- FX_FLOAT fOriginX = charpos.m_Origin.x * kScaleFactor;
- FX_FLOAT fPixelSpacing = fOriginX - fPreviousOriginX;
+ float fOriginX = charpos.m_Origin.x * kScaleFactor;
+ float fPixelSpacing = fOriginX - fPreviousOriginX;
spacing[i] = FXSYS_round(fPixelSpacing);
fPreviousOriginX = fOriginX - (fPixelSpacing - spacing[i]);
@@ -349,10 +349,10 @@ CPSPrinterDriver::CPSPrinterDriver(HDC hDC, int pslevel, bool bCmykOutput)
for (uint32_t i = 0; i < pData->rdh.nCount; i++) {
RECT* pRect =
reinterpret_cast<RECT*>(pData->Buffer + pData->rdh.nRgnSize * i);
- path.AppendRect(static_cast<FX_FLOAT>(pRect->left),
- static_cast<FX_FLOAT>(pRect->bottom),
- static_cast<FX_FLOAT>(pRect->right),
- static_cast<FX_FLOAT>(pRect->top));
+ path.AppendRect(static_cast<float>(pRect->left),
+ static_cast<float>(pRect->bottom),
+ static_cast<float>(pRect->right),
+ static_cast<float>(pRect->top));
}
m_PSRenderer.SetClip_PathFill(&path, nullptr, FXFILL_WINDING);
}
@@ -483,7 +483,7 @@ bool CPSPrinterDriver::DrawDeviceText(int nChars,
const FXTEXT_CHARPOS* pCharPos,
CFX_Font* pFont,
const CFX_Matrix* pObject2Device,
- FX_FLOAT font_size,
+ float font_size,
uint32_t color) {
return m_PSRenderer.DrawText(nChars, pCharPos, pFont, pObject2Device,
font_size, color);
diff --git a/core/fxge/win32/win32_int.h b/core/fxge/win32/win32_int.h
index 08a8224db6..54ea3716e1 100644
--- a/core/fxge/win32/win32_int.h
+++ b/core/fxge/win32/win32_int.h
@@ -75,12 +75,12 @@ class CGdiplusExt {
const void* matrix);
void GdipCreateBrush(uint32_t fill_argb, void** pBrush);
void GdipDeleteBrush(void* pBrush);
- void GdipCreateMatrix(FX_FLOAT a,
- FX_FLOAT b,
- FX_FLOAT c,
- FX_FLOAT d,
- FX_FLOAT e,
- FX_FLOAT f,
+ void GdipCreateMatrix(float a,
+ float b,
+ float c,
+ float d,
+ float e,
+ float f,
void** matrix);
void GdipDeleteMatrix(void* matrix);
bool GdipCreateFontFamilyFromName(const wchar_t* name,
@@ -88,17 +88,17 @@ class CGdiplusExt {
void** pFamily);
void GdipDeleteFontFamily(void* pFamily);
bool GdipCreateFontFromFamily(void* pFamily,
- FX_FLOAT font_size,
+ float font_size,
int fontstyle,
int flag,
void** pFont);
void* GdipCreateFontFromCollection(void* pFontCollection,
- FX_FLOAT font_size,
+ float font_size,
int fontstyle);
void GdipDeleteFont(void* pFont);
bool GdipCreateBitmap(CFX_DIBitmap* pBitmap, void** bitmap);
void GdipDisposeImage(void* bitmap);
- void GdipGetFontSize(void* pFont, FX_FLOAT* size);
+ void GdipGetFontSize(void* pFont, float* size);
void* GdiAddFontMemResourceEx(void* pFontdata,
uint32_t size,
void* pdv,
@@ -147,16 +147,16 @@ class CGdiDeviceDriver : public IFX_RenderDeviceDriver {
bool FillRectWithBlend(const FX_RECT* pRect,
uint32_t fill_color,
int blend_type) override;
- bool DrawCosmeticLine(FX_FLOAT x1,
- FX_FLOAT y1,
- FX_FLOAT x2,
- FX_FLOAT y2,
+ bool DrawCosmeticLine(float x1,
+ float y1,
+ float x2,
+ float y2,
uint32_t color,
int blend_type) override;
bool GetClipBox(FX_RECT* pRect) override;
void* GetPlatformSurface() const override;
- void DrawLine(FX_FLOAT x1, FX_FLOAT y1, FX_FLOAT x2, FX_FLOAT y2);
+ void DrawLine(float x1, float y1, float x2, float y2);
bool GDI_SetDIBits(CFX_DIBitmap* pBitmap,
const FX_RECT* pSrcRect,
@@ -257,7 +257,7 @@ class CGdiPrinterDriver : public CGdiDeviceDriver {
const FXTEXT_CHARPOS* pCharPos,
CFX_Font* pFont,
const CFX_Matrix* pObject2Device,
- FX_FLOAT font_size,
+ float font_size,
uint32_t color) override;
const int m_HorzSize;
@@ -316,7 +316,7 @@ class CPSPrinterDriver : public IFX_RenderDeviceDriver {
const FXTEXT_CHARPOS* pCharPos,
CFX_Font* pFont,
const CFX_Matrix* pObject2Device,
- FX_FLOAT font_size,
+ float font_size,
uint32_t color) override;
void* GetPlatformSurface() const override;