summaryrefslogtreecommitdiff
path: root/core/fxge/skia
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-03-14 14:43:42 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-03-14 19:05:58 +0000
commit05df075154a832fcb476e1dfcfb865722d0ea898 (patch)
treeb8b771b62adae74d5d5ee561db75d10de3a848bf /core/fxge/skia
parent6b94f01d1c8ad386d497428c7397b1a99614aeba (diff)
downloadpdfium-05df075154a832fcb476e1dfcfb865722d0ea898.tar.xz
Replace FX_FLOAT with underlying float type.
Change-Id: I158b7d80b0ec28b742a9f2d5a96f3dde7fb3ab56 Reviewed-on: https://pdfium-review.googlesource.com/3031 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
Diffstat (limited to 'core/fxge/skia')
-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
3 files changed, 43 insertions, 43 deletions
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);