aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-12-17 19:22:07 +0000
committerGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-12-17 19:22:07 +0000
commite1ca705cac4b946993f6cbf798e2a0ba27e739f3 (patch)
tree9757af858cadeea671264651780935b00d8c0252
parent3fb15f4d21292a319dc6522bfc99c89a7a5eac68 (diff)
deprecate SkScalarRound (and its ilk), use SkScalarRound[ToInt,ToScalar]. #define SK_SUPPORT_DEPRECATED_SCALARROUND for legacy clients
BUG= R=robertphillips@google.com Review URL: https://codereview.chromium.org/111353003 git-svn-id: http://skia.googlecode.com/svn/trunk@12719 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r--bench/BlurBench.cpp2
-rw-r--r--bench/MorphologyBench.cpp2
-rw-r--r--debugger/QT/SkGLWidget.cpp4
-rw-r--r--experimental/SkiaExamples/SkExample.cpp4
-rw-r--r--include/core/SkScalar.h16
-rw-r--r--include/core/SkSize.h6
-rw-r--r--samplecode/SampleAll.cpp2
-rw-r--r--samplecode/SampleApp.cpp12
-rw-r--r--samplecode/SampleCull.cpp6
-rw-r--r--samplecode/SampleDegenerateTwoPtRadials.cpp2
-rw-r--r--samplecode/SampleFilter2.cpp4
-rw-r--r--samplecode/SampleLayerMask.cpp4
-rw-r--r--samplecode/SampleLines.cpp2
-rw-r--r--samplecode/SampleRegion.cpp3
-rw-r--r--samplecode/SampleSkLayer.cpp2
-rw-r--r--samplecode/SampleText.cpp2
-rw-r--r--src/animator/SkAnimateBase.cpp6
-rw-r--r--src/animator/SkDisplayMath.cpp6
-rw-r--r--src/animator/SkDrawColor.cpp6
-rw-r--r--src/animator/SkOperandIterpolator.cpp2
-rw-r--r--src/animator/SkScript.cpp8
-rw-r--r--src/animator/SkScriptRuntime.cpp2
-rw-r--r--src/animator/SkScriptTokenizer.cpp4
-rw-r--r--src/animator/SkSnapshot.cpp2
-rw-r--r--src/core/SkClipStack.cpp8
-rw-r--r--src/core/SkDraw.cpp24
-rw-r--r--src/core/SkRTree.cpp4
-rw-r--r--src/core/SkRegion_path.cpp4
-rw-r--r--src/core/SkScan_Hairline.cpp4
-rw-r--r--src/effects/SkBlurMask.cpp8
-rw-r--r--src/effects/SkDashPathEffect.cpp2
-rw-r--r--src/effects/SkDiscretePathEffect.cpp4
-rw-r--r--src/effects/SkEmbossMaskFilter.cpp2
-rw-r--r--src/gpu/GrPathUtils.cpp4
-rw-r--r--src/pdf/SkPDFShader.cpp4
-rw-r--r--src/pdf/SkPDFTypes.cpp2
-rwxr-xr-xsrc/ports/SkFontHost_win.cpp2
-rw-r--r--src/utils/SkParseColor.cpp4
-rw-r--r--src/views/SkParsePaint.cpp2
-rw-r--r--src/views/SkStackViewLayout.cpp4
-rw-r--r--src/views/SkWindow.cpp8
-rw-r--r--src/views/unix/SkOSWindow_Unix.cpp3
-rw-r--r--src/views/win/SkOSWindow_win.cpp9
-rw-r--r--tests/PathCoverageTest.cpp6
-rw-r--r--tests/PathOpsExtendedTest.cpp4
-rw-r--r--tools/skhello.cpp4
46 files changed, 119 insertions, 106 deletions
diff --git a/bench/BlurBench.cpp b/bench/BlurBench.cpp
index 5f735dd8cf..e7811d643d 100644
--- a/bench/BlurBench.cpp
+++ b/bench/BlurBench.cpp
@@ -43,7 +43,7 @@ public:
if (SkScalarFraction(rad) != 0) {
fName.printf("blur_%.2f_%s_%s", SkScalarToFloat(rad), name, quality);
} else {
- fName.printf("blur_%d_%s_%s", SkScalarRound(rad), name, quality);
+ fName.printf("blur_%d_%s_%s", SkScalarRoundToInt(rad), name, quality);
}
}
diff --git a/bench/MorphologyBench.cpp b/bench/MorphologyBench.cpp
index 97f3b88284..0bf689eff6 100644
--- a/bench/MorphologyBench.cpp
+++ b/bench/MorphologyBench.cpp
@@ -41,7 +41,7 @@ public:
if (SkScalarFraction(rad) != 0) {
fName.printf("morph_%.2f_%s", SkScalarToFloat(rad), name);
} else {
- fName.printf("morph_%d_%s", SkScalarRound(rad), name);
+ fName.printf("morph_%d_%s", SkScalarRoundToInt(rad), name);
}
}
diff --git a/debugger/QT/SkGLWidget.cpp b/debugger/QT/SkGLWidget.cpp
index 53b6fa4f66..9ebb10530f 100644
--- a/debugger/QT/SkGLWidget.cpp
+++ b/debugger/QT/SkGLWidget.cpp
@@ -78,8 +78,8 @@ void SkGLWidget::paintGL() {
GrBackendRenderTargetDesc SkGLWidget::getDesc(int w, int h) {
GrBackendRenderTargetDesc desc;
- desc.fWidth = SkScalarRound(this->width());
- desc.fHeight = SkScalarRound(this->height());
+ desc.fWidth = SkScalarRoundToInt(this->width());
+ desc.fHeight = SkScalarRoundToInt(this->height());
desc.fConfig = kSkia8888_GrPixelConfig;
GR_GL_GetIntegerv(fCurIntf, GR_GL_SAMPLES, &desc.fSampleCnt);
GR_GL_GetIntegerv(fCurIntf, GR_GL_STENCIL_BITS, &desc.fStencilBits);
diff --git a/experimental/SkiaExamples/SkExample.cpp b/experimental/SkiaExamples/SkExample.cpp
index d4adaf4924..15b24d0e5c 100644
--- a/experimental/SkiaExamples/SkExample.cpp
+++ b/experimental/SkiaExamples/SkExample.cpp
@@ -93,8 +93,8 @@ bool SkExampleWindow::setupBackend(DeviceType type) {
void SkExampleWindow::setupRenderTarget() {
GrBackendRenderTargetDesc desc;
- desc.fWidth = SkScalarRound(width());
- desc.fHeight = SkScalarRound(height());
+ desc.fWidth = SkScalarRoundToInt(width());
+ desc.fHeight = SkScalarRoundToInt(height());
desc.fConfig = kSkia8888_GrPixelConfig;
desc.fOrigin = kBottomLeft_GrSurfaceOrigin;
desc.fSampleCnt = fAttachmentInfo.fSampleCount;
diff --git a/include/core/SkScalar.h b/include/core/SkScalar.h
index 23e28cdc14..93677df069 100644
--- a/include/core/SkScalar.h
+++ b/include/core/SkScalar.h
@@ -11,6 +11,8 @@
#include "SkFixed.h"
#include "SkFloatingPoint.h"
+//#define SK_SUPPORT_DEPRECATED_SCALARROUND
+
typedef float SkScalar;
/** SK_Scalar1 is defined to be 1.0 represented as an SkScalar
@@ -108,13 +110,13 @@ inline SkScalar SkScalarSquare(SkScalar x) { return x * x; }
#define SkScalarMulAdd(a, b, c) ((float)(a) * (b) + (c))
/** Returns the product of a SkScalar and an int rounded to the nearest integer value
*/
-#define SkScalarMulRound(a, b) SkScalarRound((float)(a) * (b))
+#define SkScalarMulRound(a, b) SkScalarRoundToInt((float)(a) * (b))
/** Returns the product of a SkScalar and an int promoted to the next larger int
*/
-#define SkScalarMulCeil(a, b) SkScalarCeil((float)(a) * (b))
+#define SkScalarMulCeil(a, b) SkScalarCeilToInt((float)(a) * (b))
/** Returns the product of a SkScalar and an int truncated to the next smaller int
*/
-#define SkScalarMulFloor(a, b) SkScalarFloor((float)(a) * (b))
+#define SkScalarMulFloor(a, b) SkScalarFloorToInt((float)(a) * (b))
/** Returns the quotient of two SkScalars (a/b)
*/
#define SkScalarDiv(a, b) ((float)(a) / (b))
@@ -168,9 +170,11 @@ static inline bool SkScalarIsInt(SkScalar x) {
}
// DEPRECATED : use ToInt or ToScalar variant
-#define SkScalarFloor(x) SkScalarFloorToInt(x)
-#define SkScalarCeil(x) SkScalarCeilToInt(x)
-#define SkScalarRound(x) SkScalarRoundToInt(x)
+#ifdef SK_SUPPORT_DEPRECATED_SCALARROUND
+# define SkScalarFloor(x) SkScalarFloorToInt(x)
+# define SkScalarCeil(x) SkScalarCeilToInt(x)
+# define SkScalarRound(x) SkScalarRoundToInt(x)
+#endif
/**
* Returns -1 || 0 || 1 depending on the sign of value:
diff --git a/include/core/SkSize.h b/include/core/SkSize.h
index 01c6e35083..7bc8c7165d 100644
--- a/include/core/SkSize.h
+++ b/include/core/SkSize.h
@@ -90,19 +90,19 @@ struct SkSize : public SkTSize<SkScalar> {
SkISize toRound() const {
SkISize s;
- s.set(SkScalarRound(fWidth), SkScalarRound(fHeight));
+ s.set(SkScalarRoundToInt(fWidth), SkScalarRoundToInt(fHeight));
return s;
}
SkISize toCeil() const {
SkISize s;
- s.set(SkScalarCeil(fWidth), SkScalarCeil(fHeight));
+ s.set(SkScalarCeilToInt(fWidth), SkScalarCeilToInt(fHeight));
return s;
}
SkISize toFloor() const {
SkISize s;
- s.set(SkScalarFloor(fWidth), SkScalarFloor(fHeight));
+ s.set(SkScalarFloorToInt(fWidth), SkScalarFloorToInt(fHeight));
return s;
}
};
diff --git a/samplecode/SampleAll.cpp b/samplecode/SampleAll.cpp
index 8907a349e8..647a199dda 100644
--- a/samplecode/SampleAll.cpp
+++ b/samplecode/SampleAll.cpp
@@ -451,7 +451,7 @@ protected:
canvas->drawBitmap(fBug, left, top, &paint);
canvas->translate(SkIntToScalar(30), 0);
canvas->drawSprite(fTb,
- SkScalarRound(canvas->getTotalMatrix().getTranslateX()),
+ SkScalarRoundToInt(canvas->getTotalMatrix().getTranslateX()),
spriteOffset + 10, &paint);
canvas->translate(-SkIntToScalar(30), SkIntToScalar(30));
diff --git a/samplecode/SampleApp.cpp b/samplecode/SampleApp.cpp
index 2d96eff8d8..010fc2553c 100644
--- a/samplecode/SampleApp.cpp
+++ b/samplecode/SampleApp.cpp
@@ -306,8 +306,8 @@ public:
win->attach(fBackend, fMSAASampleCount, &attachmentInfo);
GrBackendRenderTargetDesc desc;
- desc.fWidth = SkScalarRound(win->width());
- desc.fHeight = SkScalarRound(win->height());
+ desc.fWidth = SkScalarRoundToInt(win->width());
+ desc.fHeight = SkScalarRoundToInt(win->height());
desc.fConfig = kSkia8888_GrPixelConfig;
desc.fOrigin = kBottomLeft_GrSurfaceOrigin;
desc.fSampleCnt = attachmentInfo.fSampleCount;
@@ -1314,8 +1314,8 @@ void SampleWindow::showZoomer(SkCanvas* canvas) {
int count = canvas->save();
canvas->resetMatrix();
// Ensure the mouse position is on screen.
- int width = SkScalarRound(this->width());
- int height = SkScalarRound(this->height());
+ int width = SkScalarRoundToInt(this->width());
+ int height = SkScalarRoundToInt(this->height());
if (fMouseX >= width) fMouseX = width - 1;
else if (fMouseX < 0) fMouseX = 0;
if (fMouseY >= height) fMouseY = height - 1;
@@ -2039,8 +2039,8 @@ bool SampleWindow::onDispatchClick(int x, int y, Click::State state,
if (Click::kMoved_State == state) {
updatePointer(x, y);
}
- int w = SkScalarRound(this->width());
- int h = SkScalarRound(this->height());
+ int w = SkScalarRoundToInt(this->width());
+ int h = SkScalarRoundToInt(this->height());
// check for the resize-box
if (w - x < 16 && h - y < 16) {
diff --git a/samplecode/SampleCull.cpp b/samplecode/SampleCull.cpp
index 18f2d0cc40..afc41849cb 100644
--- a/samplecode/SampleCull.cpp
+++ b/samplecode/SampleCull.cpp
@@ -79,10 +79,12 @@ FINISHED:
for (;;)
switch (iter.next(pts)) {
case SkPath::kMove_Verb:
- array[n++].set(SkScalarRound(pts[0].fX), SkScalarRound(pts[0].fY));
+ array[n++].set(SkScalarRoundToInt(pts[0].fX),
+ SkScalarRoundToInt(pts[0].fY));
break;
case SkPath::kLine_Verb:
- array[n++].set(SkScalarRound(pts[1].fX), SkScalarRound(pts[1].fY));
+ array[n++].set(SkScalarRoundToInt(pts[1].fX),
+ SkScalarRoundToInt(pts[1].fY));
break;
case SkPath::kDone_Verb:
goto FINISHED2;
diff --git a/samplecode/SampleDegenerateTwoPtRadials.cpp b/samplecode/SampleDegenerateTwoPtRadials.cpp
index 07adae8517..92e49a7a50 100644
--- a/samplecode/SampleDegenerateTwoPtRadials.cpp
+++ b/samplecode/SampleDegenerateTwoPtRadials.cpp
@@ -58,7 +58,7 @@ protected:
virtual void onDrawContent(SkCanvas* canvas) {
fTime += SampleCode::GetAnimSecondsDelta();
SkScalar delta = fTime / 15.f;
- int intPart = SkScalarFloor(delta);
+ int intPart = SkScalarFloorToInt(delta);
delta = delta - SK_Scalar1 * intPart;
if (intPart % 2) {
delta = SK_Scalar1 - delta;
diff --git a/samplecode/SampleFilter2.cpp b/samplecode/SampleFilter2.cpp
index b4314c5a5c..f3ab7f4574 100644
--- a/samplecode/SampleFilter2.cpp
+++ b/samplecode/SampleFilter2.cpp
@@ -82,8 +82,8 @@ protected:
for (int i = 0; i < fBitmapCount; i++) {
SkScalar x = (k * fBitmapCount + j) * W;
SkScalar y = i * H;
- x = SkIntToScalar(SkScalarRound(x));
- y = SkIntToScalar(SkScalarRound(y));
+ x = SkScalarRoundToScalar(x);
+ y = SkScalarRoundToScalar(y);
canvas->drawBitmap(fBitmaps[i], x, y, &paint);
if (i == 0) {
SkPaint p;
diff --git a/samplecode/SampleLayerMask.cpp b/samplecode/SampleLayerMask.cpp
index 2e70833e0b..33c06d1cb2 100644
--- a/samplecode/SampleLayerMask.cpp
+++ b/samplecode/SampleLayerMask.cpp
@@ -34,8 +34,8 @@ protected:
if (true) {
SkBitmap mask;
- int w = SkScalarRound(r.width());
- int h = SkScalarRound(r.height());
+ int w = SkScalarRoundToInt(r.width());
+ int h = SkScalarRoundToInt(r.height());
mask.setConfig(SkBitmap::kARGB_8888_Config, w, h);
mask.allocPixels();
mask.eraseColor(SK_ColorTRANSPARENT);
diff --git a/samplecode/SampleLines.cpp b/samplecode/SampleLines.cpp
index df35e8681f..d8304d17c9 100644
--- a/samplecode/SampleLines.cpp
+++ b/samplecode/SampleLines.cpp
@@ -99,7 +99,7 @@ protected:
}
virtual SkView::Click* onFindClickHandler(SkScalar x, SkScalar y, unsigned) SK_OVERRIDE {
- fAlpha = SkScalarRound(y);
+ fAlpha = SkScalarRoundToInt(y);
this->inval(NULL);
return NULL;
}
diff --git a/samplecode/SampleRegion.cpp b/samplecode/SampleRegion.cpp
index 886eb96c78..7e3e0d260c 100644
--- a/samplecode/SampleRegion.cpp
+++ b/samplecode/SampleRegion.cpp
@@ -396,7 +396,8 @@ protected:
virtual SkView::Click* onFindClickHandler(SkScalar x, SkScalar y,
unsigned modi) SK_OVERRIDE {
- return fRect.contains(SkScalarRound(x), SkScalarRound(y)) ? new Click(this) : NULL;
+ return fRect.contains(SkScalarRoundToInt(x),
+ SkScalarRoundToInt(y)) ? new Click(this) : NULL;
}
virtual bool onClick(Click* click) {
diff --git a/samplecode/SampleSkLayer.cpp b/samplecode/SampleSkLayer.cpp
index 8d30ff6466..c57a281d6c 100644
--- a/samplecode/SampleSkLayer.cpp
+++ b/samplecode/SampleSkLayer.cpp
@@ -140,7 +140,7 @@ protected:
SkPaint paint;
paint.setColor(fColor);
- paint.setAlpha(SkScalarRound(opacity * 255));
+ paint.setAlpha(SkScalarRoundToInt(opacity * 255));
canvas->drawRect(r, paint);
}
diff --git a/samplecode/SampleText.cpp b/samplecode/SampleText.cpp
index aa314dd58b..c88196195f 100644
--- a/samplecode/SampleText.cpp
+++ b/samplecode/SampleText.cpp
@@ -176,7 +176,7 @@ void SkPowerMode::init(SkScalar e) {
// printf(" %d %g", i, x);
x = powf(x, ee);
// printf(" %g", x);
- int xx = SkScalarRound(x * 255);
+ int xx = SkScalarRoundToInt(x * 255);
// printf(" %d\n", xx);
fTable[i] = SkToU8(xx);
}
diff --git a/src/animator/SkAnimateBase.cpp b/src/animator/SkAnimateBase.cpp
index 3d50144abc..8467ce6f35 100644
--- a/src/animator/SkAnimateBase.cpp
+++ b/src/animator/SkAnimateBase.cpp
@@ -163,8 +163,10 @@ void SkAnimateBase::packARGB(SkScalar array[], int count, SkTDOperandArray* conv
{
SkASSERT(count == 4);
converted->setCount(1);
- SkColor color = SkColorSetARGB(SkScalarRound(array[0]), SkScalarRound(array[1]),
- SkScalarRound(array[2]), SkScalarRound(array[3]));
+ SkColor color = SkColorSetARGB(SkScalarRoundToInt(array[0]),
+ SkScalarRoundToInt(array[1]),
+ SkScalarRoundToInt(array[2]),
+ SkScalarRoundToInt(array[3]));
(*converted)[0].fS32 = color;
}
diff --git a/src/animator/SkDisplayMath.cpp b/src/animator/SkDisplayMath.cpp
index ac2ba8bf24..7f406c1f65 100644
--- a/src/animator/SkDisplayMath.cpp
+++ b/src/animator/SkDisplayMath.cpp
@@ -155,7 +155,7 @@ void SkDisplayMath::executeFunction(SkDisplayable* target, int index,
scalarResult = SkScalarATan2(input, parameters[1].fOperand.fScalar);
break;
case SK_FUNCTION(ceil):
- scalarResult = SkIntToScalar(SkScalarCeil(input));
+ scalarResult = SkScalarCeilToScalar(input);
break;
case SK_FUNCTION(cos):
scalarResult = SkScalarCos(input);
@@ -164,7 +164,7 @@ void SkDisplayMath::executeFunction(SkDisplayable* target, int index,
scalarResult = SkScalarExp(input);
break;
case SK_FUNCTION(floor):
- scalarResult = SkIntToScalar(SkScalarFloor(input));
+ scalarResult = SkScalarFloorToScalar(input);
break;
case SK_FUNCTION(log):
scalarResult = SkScalarLog(input);
@@ -193,7 +193,7 @@ void SkDisplayMath::executeFunction(SkDisplayable* target, int index,
scalarResult = fRandom.nextUScalar1();
break;
case SK_FUNCTION(round):
- scalarResult = SkIntToScalar(SkScalarRound(input));
+ scalarResult = SkScalarRoundToScalar(input);
break;
case SK_FUNCTION(sin):
scalarResult = SkScalarSin(input);
diff --git a/src/animator/SkDrawColor.cpp b/src/animator/SkDrawColor.cpp
index 00c429b5a1..eb57d9dad4 100644
--- a/src/animator/SkDrawColor.cpp
+++ b/src/animator/SkDrawColor.cpp
@@ -69,7 +69,7 @@ static SkColor HSV_to_RGB(SkColor color, HSV_Choice choice, SkScalar hsv) {
red = green = blue = value;
else {
//SkScalar fraction = SkScalarMod(hue, 60 * SK_Scalar1);
- int sextant = SkScalarFloor(hue / 60);
+ int sextant = SkScalarFloorToInt(hue / 60);
SkScalar fraction = hue / 60 - SkIntToScalar(sextant);
SkScalar p = SkScalarMul(value , SK_Scalar1 - saturation);
SkScalar q = SkScalarMul(value, SK_Scalar1 - SkScalarMul(saturation, fraction));
@@ -85,8 +85,8 @@ static SkColor HSV_to_RGB(SkColor color, HSV_Choice choice, SkScalar hsv) {
}
}
//used to say SkToU8((U8CPU) red) etc
- return SkColorSetARGB(SkColorGetA(color), SkScalarRound(red),
- SkScalarRound(green), SkScalarRound(blue));
+ return SkColorSetARGB(SkColorGetA(color), SkScalarRoundToInt(red),
+ SkScalarRoundToInt(green), SkScalarRoundToInt(blue));
}
#if defined _WIN32 && _MSC_VER >= 1300
diff --git a/src/animator/SkOperandIterpolator.cpp b/src/animator/SkOperandIterpolator.cpp
index 7822ee286e..84b32823e1 100644
--- a/src/animator/SkOperandIterpolator.cpp
+++ b/src/animator/SkOperandIterpolator.cpp
@@ -81,7 +81,7 @@ SkInterpolatorBase::Result SkOperandInterpolator::timeToValues(SkMSec time, SkOp
for (int i = fElemCount - 1; i >= 0; --i) {
int32_t a = prevSrc[i].fS32;
int32_t b = nextSrc[i].fS32;
- values[i].fS32 = a + SkScalarRound((b - a) * T);
+ values[i].fS32 = a + SkScalarRoundToInt((b - a) * T);
}
} else
memcpy(values, prevSrc, sizeof(SkOperand) * fElemCount);
diff --git a/src/animator/SkScript.cpp b/src/animator/SkScript.cpp
index bf55cb574a..1d04d1b276 100644
--- a/src/animator/SkScript.cpp
+++ b/src/animator/SkScript.cpp
@@ -1157,7 +1157,7 @@ noMatch:
}
SkOperand indexOperand;
fOperandStack.pop(&indexOperand);
- int index = indexType == kScalar ? SkScalarFloor(indexOperand.fScalar) :
+ int index = indexType == kScalar ? SkScalarFloorToInt(indexOperand.fScalar) :
indexOperand.fS32;
SkOpType arrayType;
fTypeStack.pop(&arrayType);
@@ -1324,7 +1324,7 @@ bool SkScriptEngine::processOp() {
type1 = kScalar;
}
if (type1 == kScalar && (attributes->fLeftType == kInt || type2 == kInt)) {
- operand1.fS32 = SkScalarFloor(operand1.fScalar);
+ operand1.fS32 = SkScalarFloorToInt(operand1.fScalar);
type1 = kInt;
}
}
@@ -1339,7 +1339,7 @@ bool SkScriptEngine::processOp() {
type2 = kScalar;
}
if (type2 == kScalar && (attributes->fRightType == kInt || type1 == kInt)) {
- operand2.fS32 = SkScalarFloor(operand2.fScalar);
+ operand2.fS32 = SkScalarFloorToInt(operand2.fScalar);
type2 = kInt;
}
}
@@ -1503,7 +1503,7 @@ bool SkScriptEngine::ConvertTo(SkScriptEngine* engine, SkDisplayTypes toType, Sk
if (type == SkType_Boolean)
break;
if (type == SkType_Float)
- operand.fS32 = SkScalarFloor(operand.fScalar);
+ operand.fS32 = SkScalarFloorToInt(operand.fScalar);
else {
if (type != SkType_String) {
success = false;
diff --git a/src/animator/SkScriptRuntime.cpp b/src/animator/SkScriptRuntime.cpp
index 061847ec12..78d9d5c208 100644
--- a/src/animator/SkScriptRuntime.cpp
+++ b/src/animator/SkScriptRuntime.cpp
@@ -210,7 +210,7 @@ bool SkScriptRuntime::executeTokens(unsigned char* opCode) {
return false;
break;
case SkScriptEngine2::kScalarToInt:
- operand[0].fS32 = SkScalarFloor(operand[0].fScalar);
+ operand[0].fS32 = SkScalarFloorToInt(operand[0].fScalar);
break;
// arithmetic ops
case SkScriptEngine2::kAddInt:
diff --git a/src/animator/SkScriptTokenizer.cpp b/src/animator/SkScriptTokenizer.cpp
index 24084453f6..8fc5d802cb 100644
--- a/src/animator/SkScriptTokenizer.cpp
+++ b/src/animator/SkScriptTokenizer.cpp
@@ -984,7 +984,7 @@ void SkScriptEngine2::processLogicalOp(Op op) {
SkScriptValue2 value;
fValueStack.pop(&value);
SkASSERT(value.fType == SkOperand2::kS32 || value.fType == SkOperand2::kScalar); // !!! add error handling (although, could permit strings eventually)
- int index = value.fType == SkOperand2::kScalar ? SkScalarFloor(value.fOperand.fScalar) :
+ int index = value.fType == SkOperand2::kScalar ? SkScalarFloorToInt(value.fOperand.fScalar) :
value.fOperand.fS32;
SkScriptValue2 arrayValue;
fValueStack.pop(&arrayValue);
@@ -1200,7 +1200,7 @@ bool SkScriptEngine2::ConvertTo(SkScriptEngine2* engine, SkOperand2::OpType toTy
switch (toType) {
case SkOperand2::kS32:
if (type == SkOperand2::kScalar)
- operand.fS32 = SkScalarFloor(operand.fScalar);
+ operand.fS32 = SkScalarFloorToInt(operand.fScalar);
else {
SkASSERT(type == SkOperand2::kString);
success = SkParse::FindS32(operand.fString->c_str(), &operand.fS32) != NULL;
diff --git a/src/animator/SkSnapshot.cpp b/src/animator/SkSnapshot.cpp
index 493ce2b3e6..6f818a627d 100644
--- a/src/animator/SkSnapshot.cpp
+++ b/src/animator/SkSnapshot.cpp
@@ -62,6 +62,6 @@ bool SkSnapshot::draw(SkAnimateMaker& maker) {
name.append(".png");
encoder->encodeFile(name.c_str(),
maker.fCanvas->getDevice()->accessBitmap(false),
- SkScalarFloor(quality));
+ SkScalarFloorToInt(quality));
return false;
}
diff --git a/src/core/SkClipStack.cpp b/src/core/SkClipStack.cpp
index 9e3f7c6b30..53a8888135 100644
--- a/src/core/SkClipStack.cpp
+++ b/src/core/SkClipStack.cpp
@@ -288,10 +288,10 @@ void SkClipStack::Element::updateBoundAndGenID(const Element* prior) {
// Note: the left edge is handled slightly differently below. We
// are a bit more generous in the rounding since we don't want to
// risk missing the left pixels when fLeft is very close to .5
- fFiniteBound.set(SkIntToScalar(SkScalarFloorToInt(fFiniteBound.fLeft+0.45f)),
- SkIntToScalar(SkScalarRound(fFiniteBound.fTop)),
- SkIntToScalar(SkScalarRound(fFiniteBound.fRight)),
- SkIntToScalar(SkScalarRound(fFiniteBound.fBottom)));
+ fFiniteBound.set(SkScalarFloorToScalar(fFiniteBound.fLeft+0.45f),
+ SkScalarRoundToScalar(fFiniteBound.fTop),
+ SkScalarRoundToScalar(fFiniteBound.fRight),
+ SkScalarRoundToScalar(fFiniteBound.fBottom));
}
// Now determine the previous Element's bound information taking into
diff --git a/src/core/SkDraw.cpp b/src/core/SkDraw.cpp
index ccab56ca62..d9bdd8e7b1 100644
--- a/src/core/SkDraw.cpp
+++ b/src/core/SkDraw.cpp
@@ -399,8 +399,8 @@ static void bw_pt_rect_32_hair_proc(const PtProcRec& rec,
static void bw_pt_hair_proc(const PtProcRec& rec, const SkPoint devPts[],
int count, SkBlitter* blitter) {
for (int i = 0; i < count; i++) {
- int x = SkScalarFloor(devPts[i].fX);
- int y = SkScalarFloor(devPts[i].fY);
+ int x = SkScalarFloorToInt(devPts[i].fX);
+ int y = SkScalarFloorToInt(devPts[i].fY);
if (rec.fClip->contains(x, y)) {
blitter->blitH(x, y, 1);
}
@@ -1195,8 +1195,8 @@ void SkDraw::drawBitmapAsMask(const SkBitmap& bitmap,
SkASSERT(bitmap.config() == SkBitmap::kA8_Config);
if (just_translate(*fMatrix, bitmap)) {
- int ix = SkScalarRound(fMatrix->getTranslateX());
- int iy = SkScalarRound(fMatrix->getTranslateY());
+ int ix = SkScalarRoundToInt(fMatrix->getTranslateX());
+ int iy = SkScalarRoundToInt(fMatrix->getTranslateY());
SkAutoLockPixels alp(bitmap);
if (!bitmap.readyToDraw()) {
@@ -1318,8 +1318,8 @@ void SkDraw::drawBitmap(const SkBitmap& bitmap, const SkMatrix& prematrix,
if (fBounder && just_translate(matrix, bitmap)) {
SkIRect ir;
- int32_t ix = SkScalarRound(matrix.getTranslateX());
- int32_t iy = SkScalarRound(matrix.getTranslateY());
+ int32_t ix = SkScalarRoundToInt(matrix.getTranslateX());
+ int32_t iy = SkScalarRoundToInt(matrix.getTranslateY());
ir.set(ix, iy, ix + bitmap.width(), iy + bitmap.height());
if (!fBounder->doIRect(ir)) {
return;
@@ -1336,8 +1336,8 @@ void SkDraw::drawBitmap(const SkBitmap& bitmap, const SkMatrix& prematrix,
if (!bitmap.readyToDraw()) {
return;
}
- int ix = SkScalarRound(matrix.getTranslateX());
- int iy = SkScalarRound(matrix.getTranslateY());
+ int ix = SkScalarRoundToInt(matrix.getTranslateX());
+ int iy = SkScalarRoundToInt(matrix.getTranslateY());
if (clipHandlesSprite(*fRC, ix, iy, bitmap)) {
uint32_t storage[kBlitterStorageLongCount];
SkBlitter* blitter = SkBlitter::ChooseSprite(*fBitmap, paint, bitmap,
@@ -2741,16 +2741,16 @@ bool SkBounder::doHairline(const SkPoint& pt0, const SkPoint& pt1,
if (v0 > v1) {
SkTSwap<SkScalar>(v0, v1);
}
- r.fLeft = SkScalarFloor(v0);
- r.fRight = SkScalarCeil(v1);
+ r.fLeft = SkScalarFloorToInt(v0);
+ r.fRight = SkScalarCeilToInt(v1);
v0 = pt0.fY;
v1 = pt1.fY;
if (v0 > v1) {
SkTSwap<SkScalar>(v0, v1);
}
- r.fTop = SkScalarFloor(v0);
- r.fBottom = SkScalarCeil(v1);
+ r.fTop = SkScalarFloorToInt(v0);
+ r.fBottom = SkScalarCeilToInt(v1);
if (paint.isAntiAlias()) {
r.inset(-1, -1);
diff --git a/src/core/SkRTree.cpp b/src/core/SkRTree.cpp
index 253a7ee1d4..fe08437da3 100644
--- a/src/core/SkRTree.cpp
+++ b/src/core/SkRTree.cpp
@@ -345,9 +345,9 @@ SkRTree::Branch SkRTree::bulkLoad(SkTDArray<Branch>* branches, int level) {
}
}
- int numStrips = SkScalarCeil(SkScalarSqrt(SkIntToScalar(numBranches) *
+ int numStrips = SkScalarCeilToInt(SkScalarSqrt(SkIntToScalar(numBranches) *
SkScalarInvert(fAspectRatio)));
- int numTiles = SkScalarCeil(SkIntToScalar(numBranches) /
+ int numTiles = SkScalarCeilToInt(SkIntToScalar(numBranches) /
SkIntToScalar(numStrips));
int currentBranch = 0;
diff --git a/src/core/SkRegion_path.cpp b/src/core/SkRegion_path.cpp
index ec4d9f01a7..a20647c966 100644
--- a/src/core/SkRegion_path.cpp
+++ b/src/core/SkRegion_path.cpp
@@ -290,8 +290,8 @@ static int count_path_runtype_values(const SkPath& path, int* itop, int* ibot) {
}
SkASSERT(top <= bot);
- *itop = SkScalarRound(top);
- *ibot = SkScalarRound(bot);
+ *itop = SkScalarRoundToInt(top);
+ *ibot = SkScalarRoundToInt(bot);
return maxEdges;
}
diff --git a/src/core/SkScan_Hairline.cpp b/src/core/SkScan_Hairline.cpp
index 3b0f152a4f..1e7e762b5a 100644
--- a/src/core/SkScan_Hairline.cpp
+++ b/src/core/SkScan_Hairline.cpp
@@ -200,8 +200,8 @@ static int compute_int_quad_dist(const SkPoint pts[3]) {
dx = SkScalarAbs(dx);
dy = SkScalarAbs(dy);
// convert to whole pixel values (use ceiling to be conservative)
- int idx = SkScalarCeil(dx);
- int idy = SkScalarCeil(dy);
+ int idx = SkScalarCeilToInt(dx);
+ int idy = SkScalarCeilToInt(dy);
// use the cheap approx for distance
if (idx > idy) {
return idx + (idy >> 1);
diff --git a/src/effects/SkBlurMask.cpp b/src/effects/SkBlurMask.cpp
index d2484c84b7..32a3d20d31 100644
--- a/src/effects/SkBlurMask.cpp
+++ b/src/effects/SkBlurMask.cpp
@@ -404,7 +404,7 @@ static int boxBlurInterp(const uint8_t* src, int src_y_stride, uint8_t* dst,
static void get_adjusted_radii(SkScalar passRadius, int *loRadius, int *hiRadius)
{
- *loRadius = *hiRadius = SkScalarCeil(passRadius);
+ *loRadius = *hiRadius = SkScalarCeilToInt(passRadius);
if (SkIntToScalar(*hiRadius) - passRadius > 0.5f) {
*loRadius = *hiRadius - 1;
}
@@ -512,8 +512,8 @@ bool SkBlurMask::BoxBlur(SkMask* dst, const SkMask& src,
// to approximate a Gaussian blur
int passCount = (kHigh_Quality == quality) ? 3 : 1;
- int rx = SkScalarCeil(passRadius);
- int outerWeight = 255 - SkScalarRound((SkIntToScalar(rx) - passRadius) * 255);
+ int rx = SkScalarCeilToInt(passRadius);
+ int outerWeight = 255 - SkScalarRoundToInt((SkIntToScalar(rx) - passRadius) * 255);
SkASSERT(rx >= 0);
SkASSERT((unsigned)outerWeight <= 255);
@@ -865,7 +865,7 @@ bool SkBlurMask::BlurGroundTruth(SkScalar sigma, SkMask* dst, const SkMask& src,
float variance = sigma * sigma;
- int windowSize = SkScalarCeil(sigma*6);
+ int windowSize = SkScalarCeilToInt(sigma*6);
// round window size up to nearest odd number
windowSize |= 1;
diff --git a/src/effects/SkDashPathEffect.cpp b/src/effects/SkDashPathEffect.cpp
index 4099058502..10fee23aff 100644
--- a/src/effects/SkDashPathEffect.cpp
+++ b/src/effects/SkDashPathEffect.cpp
@@ -277,7 +277,7 @@ bool SkDashPathEffect::filterPath(SkPath* dst, const SkPath& src,
scale = SkScalarDiv(length, fIntervalLength);
} else {
SkScalar div = SkScalarDiv(length, fIntervalLength);
- int n = SkScalarFloor(div);
+ int n = SkScalarFloorToInt(div);
scale = SkScalarDiv(length, n * fIntervalLength);
}
}
diff --git a/src/effects/SkDiscretePathEffect.cpp b/src/effects/SkDiscretePathEffect.cpp
index eece2eff86..b7ec1de3e0 100644
--- a/src/effects/SkDiscretePathEffect.cpp
+++ b/src/effects/SkDiscretePathEffect.cpp
@@ -30,7 +30,7 @@ bool SkDiscretePathEffect::filterPath(SkPath* dst, const SkPath& src,
bool doFill = rec->isFillStyle();
SkPathMeasure meas(src, doFill);
- uint32_t seed = SkScalarRound(meas.getLength());
+ uint32_t seed = SkScalarRoundToInt(meas.getLength());
SkLCGRandom rand(seed ^ ((seed << 16) | (seed >> 16)));
SkScalar scale = fPerterb;
SkPoint p;
@@ -42,7 +42,7 @@ bool SkDiscretePathEffect::filterPath(SkPath* dst, const SkPath& src,
if (fSegLength * (2 + doFill) > length) {
meas.getSegment(0, length, dst, true); // to short for us to mangle
} else {
- int n = SkScalarRound(SkScalarDiv(length, fSegLength));
+ int n = SkScalarRoundToInt(length / fSegLength);
SkScalar delta = length / n;
SkScalar distance = 0;
diff --git a/src/effects/SkEmbossMaskFilter.cpp b/src/effects/SkEmbossMaskFilter.cpp
index 905cfab941..1306d6a632 100644
--- a/src/effects/SkEmbossMaskFilter.cpp
+++ b/src/effects/SkEmbossMaskFilter.cpp
@@ -89,7 +89,7 @@ bool SkEmbossMaskFilter::filterMask(SkMask* dst, const SkMask& src,
dst->fFormat = SkMask::k3D_Format;
if (margin) {
- margin->set(SkScalarCeil(3*sigma), SkScalarCeil(3*sigma));
+ margin->set(SkScalarCeilToInt(3*sigma), SkScalarCeilToInt(3*sigma));
}
if (src.fImage == NULL) {
diff --git a/src/gpu/GrPathUtils.cpp b/src/gpu/GrPathUtils.cpp
index 8b06daf2b6..2f6006947f 100644
--- a/src/gpu/GrPathUtils.cpp
+++ b/src/gpu/GrPathUtils.cpp
@@ -51,7 +51,7 @@ uint32_t GrPathUtils::quadraticPointCount(const GrPoint points[],
// subdivide x = log4(d/tol) times. x subdivisions creates 2^(x)
// points.
// 2^(log4(x)) = sqrt(x);
- int temp = SkScalarCeil(SkScalarSqrt(SkScalarDiv(d, tol)));
+ int temp = SkScalarCeilToInt(SkScalarSqrt(SkScalarDiv(d, tol)));
int pow2 = GrNextPow2(temp);
// Because of NaNs & INFs we can wind up with a degenerate temp
// such that pow2 comes out negative. Also, our point generator
@@ -102,7 +102,7 @@ uint32_t GrPathUtils::cubicPointCount(const GrPoint points[],
if (d <= tol) {
return 1;
} else {
- int temp = SkScalarCeil(SkScalarSqrt(SkScalarDiv(d, tol)));
+ int temp = SkScalarCeilToInt(SkScalarSqrt(SkScalarDiv(d, tol)));
int pow2 = GrNextPow2(temp);
// Because of NaNs & INFs we can wind up with a degenerate temp
// such that pow2 comes out negative. Also, our point generator
diff --git a/src/pdf/SkPDFShader.cpp b/src/pdf/SkPDFShader.cpp
index 94bdf2d78d..62adf5811d 100644
--- a/src/pdf/SkPDFShader.cpp
+++ b/src/pdf/SkPDFShader.cpp
@@ -988,8 +988,8 @@ SkPDFImageShader::SkPDFImageShader(SkPDFShader::State* state) : fState(state) {
SkMatrix unflip;
unflip.setTranslate(0, SkScalarRoundToScalar(deviceBounds.height()));
unflip.preScale(SK_Scalar1, -SK_Scalar1);
- SkISize size = SkISize::Make(SkScalarRound(deviceBounds.width()),
- SkScalarRound(deviceBounds.height()));
+ SkISize size = SkISize::Make(SkScalarRoundToInt(deviceBounds.width()),
+ SkScalarRoundToInt(deviceBounds.height()));
// TODO(edisonn): should we pass here the DCT encoder of the destination device?
// TODO(edisonn): NYI Perspective, use SkPDFDeviceFlattener.
SkPDFDevice pattern(size, size, unflip);
diff --git a/src/pdf/SkPDFTypes.cpp b/src/pdf/SkPDFTypes.cpp
index aafad79c44..e3cc90c1de 100644
--- a/src/pdf/SkPDFTypes.cpp
+++ b/src/pdf/SkPDFTypes.cpp
@@ -142,7 +142,7 @@ void SkPDFScalar::Append(SkScalar value, SkWStream* stream) {
#if !defined(SK_ALLOW_LARGE_PDF_SCALARS)
if (value > 32767 || value < -32767) {
- stream->writeDecAsText(SkScalarRound(value));
+ stream->writeDecAsText(SkScalarRoundToInt(value));
return;
}
diff --git a/src/ports/SkFontHost_win.cpp b/src/ports/SkFontHost_win.cpp
index aee2b863e6..82b99d601d 100755
--- a/src/ports/SkFontHost_win.cpp
+++ b/src/ports/SkFontHost_win.cpp
@@ -1065,7 +1065,7 @@ static void build_power_table(uint8_t table[], float ee) {
for (int i = 0; i < 256; i++) {
float x = i / 255.f;
x = sk_float_pow(x, ee);
- int xx = SkScalarRound(x * 255);
+ int xx = SkScalarRoundToInt(x * 255);
table[i] = SkToU8(xx);
}
}
diff --git a/src/utils/SkParseColor.cpp b/src/utils/SkParseColor.cpp
index 37f1308bb1..26ad8b7b1c 100644
--- a/src/utils/SkParseColor.cpp
+++ b/src/utils/SkParseColor.cpp
@@ -487,8 +487,8 @@ const char* SkParse::FindColor(const char* value, SkColor* colorPtr) {
// if (end == NULL)
// return NULL;
// !!! range check for errors?
-// *colorPtr = SkColorSetARGB(SkScalarRound(array[0]), SkScalarRound(array[1]),
-// SkScalarRound(array[2]), SkScalarRound(array[3]));
+// *colorPtr = SkColorSetARGB(SkScalarRoundToInt(array[0]), SkScalarRoundToInt(array[1]),
+// SkScalarRoundToInt(array[2]), SkScalarRoundToInt(array[3]));
// return end;
} else
return FindNamedColor(value, strlen(value), colorPtr);
diff --git a/src/views/SkParsePaint.cpp b/src/views/SkParsePaint.cpp
index 344da0b572..5b4476423e 100644
--- a/src/views/SkParsePaint.cpp
+++ b/src/views/SkParsePaint.cpp
@@ -96,7 +96,7 @@ void SkPaint_Inflate(SkPaint* paint, const SkDOM& dom, const SkDOM::Node* node)
if (dom.findScalar(node, "opacity", &x))
{
x = SkMaxScalar(0, SkMinScalar(x, SK_Scalar1));
- paint->setAlpha(SkScalarRound(x * 255));
+ paint->setAlpha(SkScalarRoundToInt(x * 255));
}
int index = dom.findList(node, "text-anchor", "left,center,right");
diff --git a/src/views/SkStackViewLayout.cpp b/src/views/SkStackViewLayout.cpp
index 9a3a352853..aba6f2e93a 100644
--- a/src/views/SkStackViewLayout.cpp
+++ b/src/views/SkStackViewLayout.cpp
@@ -167,11 +167,11 @@ void SkStackViewLayout::onLayoutChildren(SkView* parent)
while ((child = iter.next()) != NULL)
{
if (fRound)
- pos = SkIntToScalar(SkScalarRound(pos));
+ pos = SkScalarRoundToScalar(pos);
(child->*mainLocP)(pos);
SkScalar crossLoc = crossStartM + gAlignProcs[fAlign]((child->*crossGetSizeP)(), crossLimit);
if (fRound)
- crossLoc = SkIntToScalar(SkScalarRound(crossLoc));
+ crossLoc = SkScalarRoundToScalar(crossLoc);
(child->*crossLocP)(crossLoc);
if (crossSetSizeP)
diff --git a/src/views/SkWindow.cpp b/src/views/SkWindow.cpp
index 32914502d9..7a4d71a2c0 100644
--- a/src/views/SkWindow.cpp
+++ b/src/views/SkWindow.cpp
@@ -134,8 +134,8 @@ bool SkWindow::handleInval(const SkRect* localR)
devR.round(&ir);
} else {
ir.set(0, 0,
- SkScalarRound(this->width()),
- SkScalarRound(this->height()));
+ SkScalarRoundToInt(this->width()),
+ SkScalarRoundToInt(this->height()));
}
fDirtyRgn.op(ir, SkRegion::kUnion_Op);
@@ -145,8 +145,8 @@ bool SkWindow::handleInval(const SkRect* localR)
void SkWindow::forceInvalAll() {
fDirtyRgn.setRect(0, 0,
- SkScalarCeil(this->width()),
- SkScalarCeil(this->height()));
+ SkScalarCeilToInt(this->width()),
+ SkScalarCeilToInt(this->height()));
}
#if defined(SK_BUILD_FOR_WINCE) && defined(USE_GX_SCREEN)
diff --git a/src/views/unix/SkOSWindow_Unix.cpp b/src/views/unix/SkOSWindow_Unix.cpp
index 9fa2b304b9..374dbccc34 100644
--- a/src/views/unix/SkOSWindow_Unix.cpp
+++ b/src/views/unix/SkOSWindow_Unix.cpp
@@ -330,7 +330,8 @@ bool SkOSWindow::attach(SkBackEndTypes, int msaaSampleCount, AttachmentInfo* inf
fUnixWindow.fWin,
fUnixWindow.fGLContext);
glViewport(0, 0,
- SkScalarRound(this->width()), SkScalarRound(this->height()));
+ SkScalarRoundToInt(this->width()),
+ SkScalarRoundToInt(this->height()));
glClearColor(0, 0, 0, 0);
glClearStencil(0);
glClear(GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
diff --git a/src/views/win/SkOSWindow_win.cpp b/src/views/win/SkOSWindow_win.cpp
index 7549ea21da..e91d73a292 100644
--- a/src/views/win/SkOSWindow_win.cpp
+++ b/src/views/win/SkOSWindow_win.cpp
@@ -361,7 +361,9 @@ bool SkOSWindow::attachGL(int msaaSampleCount, AttachmentInfo* info) {
info->fSampleCount = 0;
}
- glViewport(0, 0, SkScalarRound(this->width()), SkScalarRound(this->height()));
+ glViewport(0, 0,
+ SkScalarRoundToInt(this->width()),
+ SkScalarRoundToInt(this->height()));
return true;
}
return false;
@@ -500,8 +502,9 @@ bool SkOSWindow::attachANGLE(int msaaSampleCount, AttachmentInfo* info) {
SkAutoTUnref<const GrGLInterface> intf(GrGLCreateANGLEInterface());
if (intf ) {
- ANGLE_GL_CALL(intf, Viewport(0, 0, SkScalarRound(this->width()),
- SkScalarRound(this->height())));
+ ANGLE_GL_CALL(intf, Viewport(0, 0,
+ SkScalarRoundToInt(this->width()),
+ SkScalarRoundToInt(this->height())));
}
return true;
}
diff --git a/tests/PathCoverageTest.cpp b/tests/PathCoverageTest.cpp
index ede1fdc64e..25b5fd1c09 100644
--- a/tests/PathCoverageTest.cpp
+++ b/tests/PathCoverageTest.cpp
@@ -27,8 +27,8 @@ static const uint32_t MAX_POINTS_PER_CURVE = 1 << MAX_COEFF_SHIFT;
// For determining the maximum possible number of points to use in
// drawing a quadratic, we want to err on the high side.
static inline int cheap_distance(SkScalar dx, SkScalar dy) {
- int idx = SkAbs32(SkScalarRound(dx));
- int idy = SkAbs32(SkScalarRound(dy));
+ int idx = SkAbs32(SkScalarRoundToInt(dx));
+ int idy = SkAbs32(SkScalarRoundToInt(dy));
if (idx > idy) {
idx += idy >> 1;
} else {
@@ -79,7 +79,7 @@ static uint32_t quadraticPointCount_EC(const SkPoint points[], SkScalar tol) {
static uint32_t quadraticPointCount_CE(const SkPoint points[]) {
SkScalar distance = compute_distance(points);
- return estimate_pointCount(SkScalarRound(distance));
+ return estimate_pointCount(SkScalarRoundToInt(distance));
}
static uint32_t quadraticPointCount_CC(const SkPoint points[], SkScalar tol) {
diff --git a/tests/PathOpsExtendedTest.cpp b/tests/PathOpsExtendedTest.cpp
index ca6f86507d..1083a897e1 100644
--- a/tests/PathOpsExtendedTest.cpp
+++ b/tests/PathOpsExtendedTest.cpp
@@ -347,11 +347,11 @@ bool drawAsciiPaths(const SkPath& one, const SkPath& two, bool drawPaths) {
larger.join(bounds2);
SkBitmap bits;
char out[256];
- int bitWidth = SkScalarCeil(larger.width()) + 2;
+ int bitWidth = SkScalarCeilToInt(larger.width()) + 2;
if (bitWidth * 2 + 1 >= (int) sizeof(out)) {
return false;
}
- int bitHeight = SkScalarCeil(larger.height()) + 2;
+ int bitHeight = SkScalarCeilToInt(larger.height()) + 2;
if (bitHeight >= (int) sizeof(out)) {
return false;
}
diff --git a/tools/skhello.cpp b/tools/skhello.cpp
index 93dad56df5..55748d2e1b 100644
--- a/tools/skhello.cpp
+++ b/tools/skhello.cpp
@@ -81,8 +81,8 @@ int tool_main(int argc, char** argv) {
SkScalar width = paint.measureText(text.c_str(), text.size());
SkScalar spacing = paint.getFontSpacing();
- int w = SkScalarRound(width) + 30;
- int h = SkScalarRound(spacing) + 30;
+ int w = SkScalarRoundToInt(width) + 30;
+ int h = SkScalarRoundToInt(spacing) + 30;
static const struct {
bool (*fProc)(int w, int h, const char path[], const char text[],