remove SkFloatToScalar macro
BUG= R=reed@google.com, djsollen@google.com Author: caryclark@google.com Review URL: https://codereview.chromium.org/85463005 git-svn-id: http://skia.googlecode.com/svn/trunk@12385 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
parent
2a1f4464d1
commit
4b413c8bb1
@ -32,8 +32,8 @@ public:
|
||||
doPath ? "path" : "rect",
|
||||
doAA ? "AA" : "BW");
|
||||
|
||||
fClipRect.set(SkFloatToScalar(10.5f), SkFloatToScalar(10.5f),
|
||||
SkFloatToScalar(50.5f), SkFloatToScalar(50.5f));
|
||||
fClipRect.set(10.5f, 10.5f,
|
||||
50.5f, 50.5f);
|
||||
fClipPath.addRoundRect(fClipRect, SkIntToScalar(10), SkIntToScalar(10));
|
||||
fDrawRect.set(SkIntToScalar(0), SkIntToScalar(0),
|
||||
SkIntToScalar(100), SkIntToScalar(100));
|
||||
|
@ -20,7 +20,7 @@ class BicubicBench : public SkBenchmark {
|
||||
|
||||
public:
|
||||
BicubicBench(float x, float y)
|
||||
: fScale(SkSize::Make(SkFloatToScalar(x), SkFloatToScalar(y))) {
|
||||
: fScale(SkSize::Make(x, y)) {
|
||||
fName.printf("bicubic_%gx%g",
|
||||
SkScalarToFloat(fScale.fWidth), SkScalarToFloat(fScale.fHeight));
|
||||
}
|
||||
|
@ -15,9 +15,9 @@
|
||||
#include "SkBlurMaskFilter.h"
|
||||
|
||||
#define SMALL SkIntToScalar(2)
|
||||
#define REAL SkFloatToScalar(1.5f)
|
||||
#define REAL 1.5f
|
||||
#define BIG SkIntToScalar(10)
|
||||
#define REALBIG SkFloatToScalar(100.5f)
|
||||
#define REALBIG 100.5f
|
||||
|
||||
static const char* gStyleName[] = {
|
||||
"normal",
|
||||
|
@ -18,8 +18,8 @@
|
||||
#define FILTER_HEIGHT_SMALL 32
|
||||
#define FILTER_WIDTH_LARGE 256
|
||||
#define FILTER_HEIGHT_LARGE 256
|
||||
#define BLUR_SIGMA_SMALL SkFloatToScalar(1.0f)
|
||||
#define BLUR_SIGMA_LARGE SkFloatToScalar(10.0f)
|
||||
#define BLUR_SIGMA_SMALL 1.0f
|
||||
#define BLUR_SIGMA_LARGE 10.0f
|
||||
|
||||
class BlurImageFilterBench : public SkBenchmark {
|
||||
public:
|
||||
|
@ -14,11 +14,11 @@
|
||||
#include "SkBlurMask.h"
|
||||
|
||||
#define SMALL SkIntToScalar(2)
|
||||
#define REAL SkFloatToScalar(1.5f)
|
||||
#define REAL 1.5f
|
||||
static const SkScalar kMedium = SkIntToScalar(5);
|
||||
#define BIG SkIntToScalar(10)
|
||||
static const SkScalar kMedBig = SkIntToScalar(20);
|
||||
#define REALBIG SkFloatToScalar(30.5f)
|
||||
#define REALBIG 30.5f
|
||||
|
||||
class BlurRectBench: public SkBenchmark {
|
||||
int fLoopCount;
|
||||
|
@ -28,7 +28,7 @@ protected:
|
||||
}
|
||||
|
||||
static SkImageFilter* make_brightness(float amount, SkImageFilter* input = NULL) {
|
||||
SkScalar amount255 = SkScalarMul(SkFloatToScalar(amount), SkIntToScalar(255));
|
||||
SkScalar amount255 = SkScalarMul(amount, SkIntToScalar(255));
|
||||
SkScalar matrix[20] = { 1, 0, 0, 0, amount255,
|
||||
0, 1, 0, 0, amount255,
|
||||
0, 0, 1, 0, amount255,
|
||||
@ -40,10 +40,10 @@ protected:
|
||||
static SkImageFilter* make_grayscale(SkImageFilter* input = NULL) {
|
||||
SkScalar matrix[20];
|
||||
memset(matrix, 0, 20 * sizeof(SkScalar));
|
||||
matrix[0] = matrix[5] = matrix[10] = SkFloatToScalar(0.2126f);
|
||||
matrix[1] = matrix[6] = matrix[11] = SkFloatToScalar(0.7152f);
|
||||
matrix[2] = matrix[7] = matrix[12] = SkFloatToScalar(0.0722f);
|
||||
matrix[18] = SkFloatToScalar(1.0f);
|
||||
matrix[0] = matrix[5] = matrix[10] = 0.2126f;
|
||||
matrix[1] = matrix[6] = matrix[11] = 0.7152f;
|
||||
matrix[2] = matrix[7] = matrix[12] = 0.0722f;
|
||||
matrix[18] = 1.0f;
|
||||
SkAutoTUnref<SkColorFilter> filter(new SkColorMatrixFilter(matrix));
|
||||
return SkColorFilterImageFilter::Create(filter, input);
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ private:
|
||||
class ScaleMatrixBench : public MatrixBench {
|
||||
public:
|
||||
ScaleMatrixBench() : INHERITED("scale") {
|
||||
fSX = fSY = SkFloatToScalar(1.5f);
|
||||
fSX = fSY = 1.5f;
|
||||
fM0.reset();
|
||||
fM1.setScale(fSX, fSY);
|
||||
fM2.setTranslate(fSX, fSY);
|
||||
@ -383,17 +383,17 @@ public:
|
||||
fMatrix.reset();
|
||||
fIteration = 0;
|
||||
if (flags & kScale_Flag) {
|
||||
fMatrix.postScale(SkFloatToScalar(1.5f), SkFloatToScalar(2.5f));
|
||||
fMatrix.postScale(1.5f, 2.5f);
|
||||
}
|
||||
if (flags & kTranslate_Flag) {
|
||||
fMatrix.postTranslate(SkFloatToScalar(1.5f), SkFloatToScalar(2.5f));
|
||||
fMatrix.postTranslate(1.5f, 2.5f);
|
||||
}
|
||||
if (flags & kRotate_Flag) {
|
||||
fMatrix.postRotate(SkFloatToScalar(45.0f));
|
||||
fMatrix.postRotate(45.0f);
|
||||
}
|
||||
if (flags & kPerspective_Flag) {
|
||||
fMatrix.setPerspX(SkFloatToScalar(1.5f));
|
||||
fMatrix.setPerspY(SkFloatToScalar(2.5f));
|
||||
fMatrix.setPerspX(1.5f);
|
||||
fMatrix.setPerspY(2.5f);
|
||||
}
|
||||
if (0 == (flags & kUncachedTypeMask_Flag)) {
|
||||
fMatrix.getType();
|
||||
|
@ -21,7 +21,7 @@ public:
|
||||
SkIntToScalar( 1), SkIntToScalar(-7), SkIntToScalar( 1),
|
||||
SkIntToScalar( 1), SkIntToScalar( 1), SkIntToScalar( 1),
|
||||
};
|
||||
SkScalar gain = SkFloatToScalar(0.3f), bias = SkIntToScalar(100);
|
||||
SkScalar gain = 0.3f, bias = SkIntToScalar(100);
|
||||
SkIPoint target = SkIPoint::Make(1, 1);
|
||||
fFilter = new SkMatrixConvolutionImageFilter(kernelSize, kernel, gain, bias, target, tileMode, convolveAlpha);
|
||||
}
|
||||
|
@ -14,7 +14,7 @@
|
||||
#include "SkMorphologyImageFilter.h"
|
||||
|
||||
#define SMALL SkIntToScalar(2)
|
||||
#define REAL SkFloatToScalar(1.5f)
|
||||
#define REAL 1.5f
|
||||
#define BIG SkIntToScalar(10)
|
||||
|
||||
enum MorphologyType {
|
||||
|
@ -186,7 +186,7 @@ protected:
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas* canvas) {
|
||||
static const SkScalar kHalfRectSize = SkFloatToScalar(0.75f);
|
||||
static const SkScalar kHalfRectSize = 0.75f;
|
||||
|
||||
SkPaint paint;
|
||||
this->setupPaint(&paint);
|
||||
|
@ -44,7 +44,7 @@ public:
|
||||
fPalette->setVisibleP(true);
|
||||
this->attachChildToFront(fPalette);
|
||||
fPalette->unref();
|
||||
fBrushSize = SkFloatToScalar(2.5);
|
||||
fBrushSize = 2.5;
|
||||
fAA = false;
|
||||
fPaletteVisible = true;
|
||||
fSync = true;
|
||||
|
@ -490,7 +490,7 @@ static SkPdfResult DrawText(SkPdfContext* pdfContext,
|
||||
|
||||
// TODO(edisonn): implement font scaler
|
||||
// if (fCurFont && fCurFont->GetFontScale() != 0) {
|
||||
// paint.setTextScaleX(SkFloatToScalar(fCurFont->GetFontScale() / 100.0));
|
||||
// paint.setTextScaleX(fCurFont->GetFontScale() / 100.0);
|
||||
// }
|
||||
|
||||
pdfContext->fGraphicsState.applyGraphicsState(&paint, false);
|
||||
|
@ -309,8 +309,8 @@ DEF_GM(return new BlurRectGM("blurrect", NULL, 0xFF, SkBlurMaskFilter::kSolid_Bl
|
||||
DEF_GM(return new BlurRectGM("blurrect", NULL, 0xFF, SkBlurMaskFilter::kOuter_BlurStyle);)
|
||||
DEF_GM(return new BlurRectGM("blurrect", NULL, 0xFF, SkBlurMaskFilter::kInner_BlurStyle);)
|
||||
|
||||
static const SkScalar kBig = SkFloatToScalar(20);
|
||||
static const SkScalar kSmall = SkFloatToScalar(2);
|
||||
static const SkScalar kBig = 20;
|
||||
static const SkScalar kSmall = 2;
|
||||
|
||||
// regular size rects, blurs should be small enough not to completely overlap.
|
||||
|
||||
|
@ -111,7 +111,7 @@ protected:
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
|
||||
canvas->scale(SkFloatToScalar(1.5f), SkFloatToScalar(1.5f));
|
||||
canvas->scale(1.5f, 1.5f);
|
||||
|
||||
const int blurRadii[] = { 1, 3, 6, 10 };
|
||||
const int cornerRadii[] = { 1, 3, 6, 10 };
|
||||
|
@ -23,7 +23,7 @@ static SkImageFilter* make_blur(float amount, SkImageFilter* input = NULL) {
|
||||
}
|
||||
|
||||
static SkImageFilter* make_brightness(float amount, SkImageFilter* input = NULL) {
|
||||
SkScalar amount255 = SkScalarMul(SkFloatToScalar(amount), SkIntToScalar(255));
|
||||
SkScalar amount255 = SkScalarMul(amount, SkIntToScalar(255));
|
||||
SkScalar matrix[20] = { 1, 0, 0, 0, amount255,
|
||||
0, 1, 0, 0, amount255,
|
||||
0, 0, 1, 0, amount255,
|
||||
@ -35,10 +35,10 @@ static SkImageFilter* make_brightness(float amount, SkImageFilter* input = NULL)
|
||||
static SkImageFilter* make_grayscale(SkImageFilter* input = NULL) {
|
||||
SkScalar matrix[20];
|
||||
memset(matrix, 0, 20 * sizeof(SkScalar));
|
||||
matrix[0] = matrix[5] = matrix[10] = SkFloatToScalar(0.2126f);
|
||||
matrix[1] = matrix[6] = matrix[11] = SkFloatToScalar(0.7152f);
|
||||
matrix[2] = matrix[7] = matrix[12] = SkFloatToScalar(0.0722f);
|
||||
matrix[18] = SkFloatToScalar(1.0f);
|
||||
matrix[0] = matrix[5] = matrix[10] = 0.2126f;
|
||||
matrix[1] = matrix[6] = matrix[11] = 0.7152f;
|
||||
matrix[2] = matrix[7] = matrix[12] = 0.0722f;
|
||||
matrix[18] = 1.0f;
|
||||
SkAutoTUnref<SkColorFilter> filter(new SkColorMatrixFilter(matrix));
|
||||
return SkColorFilterImageFilter::Create(filter, input);
|
||||
}
|
||||
@ -62,7 +62,7 @@ protected:
|
||||
void drawClippedRect(SkCanvas* canvas, const SkRect& r, const SkPaint& paint, float outset = 0.0f) {
|
||||
canvas->save();
|
||||
SkRect clip(r);
|
||||
clip.outset(SkFloatToScalar(outset), SkFloatToScalar(outset));
|
||||
clip.outset(outset, outset);
|
||||
canvas->clipRect(clip);
|
||||
canvas->drawRect(r, paint);
|
||||
canvas->restore();
|
||||
|
@ -122,19 +122,19 @@ protected:
|
||||
setColorMatrix(&paint, matrix);
|
||||
canvas->drawBitmap(bmps[i], 240, 0, &paint);
|
||||
|
||||
matrix.setSaturation(SkFloatToScalar(0.0f));
|
||||
matrix.setSaturation(0.0f);
|
||||
setColorMatrix(&paint, matrix);
|
||||
canvas->drawBitmap(bmps[i], 0, 80, &paint);
|
||||
|
||||
matrix.setSaturation(SkFloatToScalar(0.5f));
|
||||
matrix.setSaturation(0.5f);
|
||||
setColorMatrix(&paint, matrix);
|
||||
canvas->drawBitmap(bmps[i], 80, 80, &paint);
|
||||
|
||||
matrix.setSaturation(SkFloatToScalar(1.0f));
|
||||
matrix.setSaturation(1.0f);
|
||||
setColorMatrix(&paint, matrix);
|
||||
canvas->drawBitmap(bmps[i], 160, 80, &paint);
|
||||
|
||||
matrix.setSaturation(SkFloatToScalar(2.0f));
|
||||
matrix.setSaturation(2.0f);
|
||||
setColorMatrix(&paint, matrix);
|
||||
canvas->drawBitmap(bmps[i], 240, 80, &paint);
|
||||
|
||||
|
@ -100,10 +100,10 @@ protected:
|
||||
// device boundaries so we need to "undo" the effect of the
|
||||
// scale and translate
|
||||
SkRect bounds = SkRect::MakeLTRB(
|
||||
SkFloatToScalar(4.0f/3.0f * -20),
|
||||
SkFloatToScalar(4.0f/3.0f * -20),
|
||||
SkFloatToScalar(4.0f/3.0f * (this->getISize().fWidth - 20)),
|
||||
SkFloatToScalar(4.0f/3.0f * (this->getISize().fHeight - 20)));
|
||||
4.0f/3.0f * -20,
|
||||
4.0f/3.0f * -20,
|
||||
4.0f/3.0f * (this->getISize().fWidth - 20),
|
||||
4.0f/3.0f * (this->getISize().fHeight - 20));
|
||||
|
||||
bounds.inset(SkIntToScalar(100), SkIntToScalar(100));
|
||||
SkPaint boundPaint;
|
||||
|
@ -21,19 +21,19 @@ public:
|
||||
this->setBGColor(SkColorSetRGB(0xDD,0xA0,0xDD));
|
||||
|
||||
// offset the rects a bit so we get antialiasing even in the rect case
|
||||
SkScalar xA = SkFloatToScalar(0.65f);
|
||||
SkScalar xB = SkFloatToScalar(10.65f);
|
||||
SkScalar xC = SkFloatToScalar(20.65f);
|
||||
SkScalar xD = SkFloatToScalar(30.65f);
|
||||
SkScalar xE = SkFloatToScalar(40.65f);
|
||||
SkScalar xF = SkFloatToScalar(50.65f);
|
||||
SkScalar xA = 0.65f;
|
||||
SkScalar xB = 10.65f;
|
||||
SkScalar xC = 20.65f;
|
||||
SkScalar xD = 30.65f;
|
||||
SkScalar xE = 40.65f;
|
||||
SkScalar xF = 50.65f;
|
||||
|
||||
SkScalar yA = SkFloatToScalar(0.65f);
|
||||
SkScalar yB = SkFloatToScalar(10.65f);
|
||||
SkScalar yC = SkFloatToScalar(20.65f);
|
||||
SkScalar yD = SkFloatToScalar(30.65f);
|
||||
SkScalar yE = SkFloatToScalar(40.65f);
|
||||
SkScalar yF = SkFloatToScalar(50.65f);
|
||||
SkScalar yA = 0.65f;
|
||||
SkScalar yB = 10.65f;
|
||||
SkScalar yC = 20.65f;
|
||||
SkScalar yD = 30.65f;
|
||||
SkScalar yE = 40.65f;
|
||||
SkScalar yF = 50.65f;
|
||||
|
||||
fWidth = xF - xA;
|
||||
fHeight = yF - yA;
|
||||
|
@ -176,11 +176,11 @@ protected:
|
||||
30 * SK_Scalar1, 0);
|
||||
|
||||
// triangle where one edge is a degenerate quad
|
||||
fPaths.push_back().moveTo(SkFloatToScalar(8.59375f), 45 * SK_Scalar1);
|
||||
fPaths.back().quadTo(SkFloatToScalar(16.9921875f), 45 * SK_Scalar1,
|
||||
SkFloatToScalar(31.25f), 45 * SK_Scalar1);
|
||||
fPaths.push_back().moveTo(8.59375f, 45 * SK_Scalar1);
|
||||
fPaths.back().quadTo(16.9921875f, 45 * SK_Scalar1,
|
||||
31.25f, 45 * SK_Scalar1);
|
||||
fPaths.back().lineTo(100 * SK_Scalar1, 100 * SK_Scalar1);
|
||||
fPaths.back().lineTo(SkFloatToScalar(8.59375f), 45 * SK_Scalar1);
|
||||
fPaths.back().lineTo(8.59375f, 45 * SK_Scalar1);
|
||||
|
||||
// triangle where one edge is a quad with a repeated point
|
||||
fPaths.push_back().moveTo(0, 25 * SK_Scalar1);
|
||||
@ -197,14 +197,14 @@ protected:
|
||||
// triangle where one edge is a quad with a nearly repeated point
|
||||
fPaths.push_back().moveTo(0, 25 * SK_Scalar1);
|
||||
fPaths.back().lineTo(50 * SK_Scalar1, 0);
|
||||
fPaths.back().quadTo(50 * SK_Scalar1, SkFloatToScalar(49.95f),
|
||||
fPaths.back().quadTo(50 * SK_Scalar1, 49.95f,
|
||||
50 * SK_Scalar1, 50 * SK_Scalar1);
|
||||
|
||||
// triangle where one edge is a cubic with a 3x nearly repeated point
|
||||
fPaths.push_back().moveTo(0, 25 * SK_Scalar1);
|
||||
fPaths.back().lineTo(50 * SK_Scalar1, 0);
|
||||
fPaths.back().cubicTo(50 * SK_Scalar1, SkFloatToScalar(49.95f),
|
||||
50 * SK_Scalar1, SkFloatToScalar(49.97f),
|
||||
fPaths.back().cubicTo(50 * SK_Scalar1, 49.95f,
|
||||
50 * SK_Scalar1, 49.97f,
|
||||
50 * SK_Scalar1, 50 * SK_Scalar1);
|
||||
|
||||
// triangle where there is a point degenerate cubic at one corner
|
||||
@ -253,7 +253,7 @@ protected:
|
||||
|
||||
// small circle. This is listed last so that it has device coords far
|
||||
// from the origin (small area relative to x,y values).
|
||||
fPaths.push_back().addCircle(0, 0, SkFloatToScalar(1.2f));
|
||||
fPaths.push_back().addCircle(0, 0, 1.2f);
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas* canvas) {
|
||||
|
@ -263,7 +263,7 @@ protected:
|
||||
// 1on/1off 3x3 squares with phase of 1.5 - rects fast path
|
||||
canvas->save();
|
||||
canvas->translate(112, 110);
|
||||
this->drawDashedLines(canvas, 100, SkFloatToScalar(1.5f), SkIntToScalar(3), 3, false);
|
||||
this->drawDashedLines(canvas, 100, 1.5f, SkIntToScalar(3), 3, false);
|
||||
canvas->restore();
|
||||
|
||||
// 1on/1off 1x1 circles with phase of 1 - no fast path yet
|
||||
|
@ -24,7 +24,7 @@ static const SkColor gColors[] = {
|
||||
};
|
||||
|
||||
// These annoying defines are necessary, because the only other alternative
|
||||
// is to use SkIntToScalar(...) or SkFloatToScalar(...) everywhere.
|
||||
// is to use SkIntToScalar(...) everywhere.
|
||||
static const SkScalar sZero = 0;
|
||||
static const SkScalar sHalf = SK_ScalarHalf;
|
||||
static const SkScalar sOne = SK_Scalar1;
|
||||
|
@ -262,7 +262,7 @@ protected:
|
||||
this->drawBG(canvas);
|
||||
|
||||
SkColor colors[] = { SK_ColorRED, SK_ColorGREEN, SK_ColorGREEN, SK_ColorRED };
|
||||
SkScalar pos[] = { 0, SkFloatToScalar(0.01f), SkFloatToScalar(0.99f), SK_Scalar1 };
|
||||
SkScalar pos[] = { 0, 0.01f, 0.99f, SK_Scalar1 };
|
||||
SkPoint c0;
|
||||
c0.iset(-80, 25);
|
||||
SkScalar r0 = SkIntToScalar(70);
|
||||
@ -343,9 +343,9 @@ protected:
|
||||
center.set(SkIntToScalar(dim.width())/2, SkIntToScalar(dim.height())/2);
|
||||
SkScalar radius = SkIntToScalar(dim.width())/2;
|
||||
const SkColor colors[] = { 0x7f7f7f7f, 0x7f7f7f7f, 0xb2000000 };
|
||||
const SkScalar pos[] = { SkFloatToScalar(0.0f),
|
||||
SkFloatToScalar(0.35f),
|
||||
SkFloatToScalar(1.0f) };
|
||||
const SkScalar pos[] = { 0.0f,
|
||||
0.35f,
|
||||
1.0f };
|
||||
SkShader* shader =
|
||||
SkGradientShader::CreateRadial(center, radius, colors,
|
||||
pos, SK_ARRAY_COUNT(pos),
|
||||
|
@ -95,13 +95,13 @@ protected:
|
||||
{
|
||||
SkPath* problem2 = &fPaths.push_back();
|
||||
problem2->moveTo(SkIntToScalar(5), SkIntToScalar(1));
|
||||
problem2->lineTo(SkFloatToScalar(4.32787323f), SkFloatToScalar(1.67212653f));
|
||||
problem2->cubicTo(SkFloatToScalar(2.75223875f), SkFloatToScalar(3.24776125f),
|
||||
SkFloatToScalar(3.00581908f), SkFloatToScalar(4.51236057f),
|
||||
SkFloatToScalar(3.7580452f), SkFloatToScalar(4.37367964f));
|
||||
problem2->cubicTo(SkFloatToScalar(4.66472578f), SkFloatToScalar(3.888381f),
|
||||
SkFloatToScalar(5.f), SkFloatToScalar(2.875f),
|
||||
SkFloatToScalar(5.f), SkFloatToScalar(1.f));
|
||||
problem2->lineTo(4.32787323f, 1.67212653f);
|
||||
problem2->cubicTo(2.75223875f, 3.24776125f,
|
||||
3.00581908f, 4.51236057f,
|
||||
3.7580452f, 4.37367964f);
|
||||
problem2->cubicTo(4.66472578f, 3.888381f,
|
||||
5.f, 2.875f,
|
||||
5.f, 1.f);
|
||||
problem2->close();
|
||||
}
|
||||
|
||||
@ -137,8 +137,8 @@ protected:
|
||||
{
|
||||
// Arc example to test imperfect truncation bug (crbug.com/295626)
|
||||
static const SkScalar kRad = SkIntToScalar(2000);
|
||||
static const SkScalar kStartAngle = SkFloatToScalar(262.59717f);
|
||||
static const SkScalar kSweepAngle = SkScalarHalf(SkFloatToScalar(17.188717f));
|
||||
static const SkScalar kStartAngle = 262.59717f;
|
||||
static const SkScalar kSweepAngle = SkScalarHalf(17.188717f);
|
||||
|
||||
SkPath* bug = &fPaths.push_back();
|
||||
|
||||
|
@ -140,7 +140,7 @@ protected:
|
||||
SkScalar matrix[20] = { SK_Scalar1, 0, 0, 0, 0,
|
||||
0, SK_Scalar1, 0, 0, 0,
|
||||
0, 0, SK_Scalar1, 0, 0,
|
||||
0, 0, 0, SkFloatToScalar(0.5f), 0 };
|
||||
0, 0, 0, 0.5f, 0 };
|
||||
|
||||
SkAutoTUnref<SkColorFilter> matrixFilter(new SkColorMatrixFilter(matrix));
|
||||
SkAutoTUnref<SkImageFilter> colorMorph(SkColorFilterImageFilter::Create(matrixFilter, morph));
|
||||
@ -156,7 +156,7 @@ protected:
|
||||
SkScalar matrix[20] = { SK_Scalar1, 0, 0, 0, 0,
|
||||
0, SK_Scalar1, 0, 0, 0,
|
||||
0, 0, SK_Scalar1, 0, 0,
|
||||
0, 0, 0, SkFloatToScalar(0.5f), 0 };
|
||||
0, 0, 0, 0.5f, 0 };
|
||||
SkColorMatrixFilter matrixCF(matrix);
|
||||
SkAutoTUnref<SkImageFilter> matrixFilter(SkColorFilterImageFilter::Create(&matrixCF));
|
||||
SimpleOffsetFilter offsetFilter(SkIntToScalar(10), SkIntToScalar(10), matrixFilter);
|
||||
|
@ -56,7 +56,7 @@ protected:
|
||||
SkIntToScalar( 1), SkIntToScalar( 1), SkIntToScalar( 1),
|
||||
};
|
||||
SkISize kernelSize = SkISize::Make(3, 3);
|
||||
SkScalar gain = SkFloatToScalar(0.3f), bias = SkIntToScalar(100);
|
||||
SkScalar gain = 0.3f, bias = SkIntToScalar(100);
|
||||
SkPaint paint;
|
||||
SkAutoTUnref<SkImageFilter> filter(
|
||||
SkNEW_ARGS(SkMatrixConvolutionImageFilter, (kernelSize,
|
||||
|
@ -127,9 +127,9 @@ protected:
|
||||
|
||||
SkColor genColor(SkRandom* rand) {
|
||||
SkScalar hsv[3];
|
||||
hsv[0] = SkFloatToScalar(rand->nextRangeF(0.0f, 360.0f));
|
||||
hsv[1] = SkFloatToScalar(rand->nextRangeF(0.75f, 1.0f));
|
||||
hsv[2] = SkFloatToScalar(rand->nextRangeF(0.75f, 1.0f));
|
||||
hsv[0] = rand->nextRangeF(0.0f, 360.0f);
|
||||
hsv[1] = rand->nextRangeF(0.75f, 1.0f);
|
||||
hsv[2] = rand->nextRangeF(0.75f, 1.0f);
|
||||
|
||||
return SkHSVToColor(hsv);
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ protected:
|
||||
test(canvas, 100, 300, SkPerlinNoiseShader::kFractalNoise_Type,
|
||||
0.1f, 0.1f, 3, 4, false);
|
||||
|
||||
canvas->scale(SkFloatToScalar(0.75f), SkFloatToScalar(1.0f));
|
||||
canvas->scale(0.75f, 1.0f);
|
||||
|
||||
test(canvas, 0, 400, SkPerlinNoiseShader::kFractalNoise_Type,
|
||||
0.1f, 0.1f, 2, 0, false);
|
||||
|
@ -128,9 +128,9 @@ protected:
|
||||
|
||||
SkColor genColor(SkRandom* rand) {
|
||||
SkScalar hsv[3];
|
||||
hsv[0] = SkFloatToScalar(rand->nextRangeF(0.0f, 360.0f));
|
||||
hsv[1] = SkFloatToScalar(rand->nextRangeF(0.75f, 1.0f));
|
||||
hsv[2] = SkFloatToScalar(rand->nextRangeF(0.75f, 1.0f));
|
||||
hsv[0] = rand->nextRangeF(0.0f, 360.0f);
|
||||
hsv[1] = rand->nextRangeF(0.75f, 1.0f);
|
||||
hsv[2] = rand->nextRangeF(0.75f, 1.0f);
|
||||
|
||||
return SkHSVToColor(hsv);
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ protected:
|
||||
|
||||
virtual SkMatrix onGetInitialTransform() const SK_OVERRIDE {
|
||||
SkMatrix result;
|
||||
SkScalar scale = SkFloatToScalar(0.8f);
|
||||
SkScalar scale = 0.8f;
|
||||
result.setScale(scale, scale);
|
||||
result.postTranslate(SkIntToScalar(7), SkIntToScalar(23));
|
||||
return result;
|
||||
@ -54,7 +54,7 @@ protected:
|
||||
SkIntToScalar(240)));
|
||||
|
||||
SkMatrix canvasScale;
|
||||
SkScalar scale = SkFloatToScalar(0.7f);
|
||||
SkScalar scale = 0.7f;
|
||||
canvasScale.setScale(scale, scale);
|
||||
canvas->concat(canvasScale);
|
||||
|
||||
@ -74,9 +74,9 @@ protected:
|
||||
}
|
||||
|
||||
SkShader* MakeShader(int width, int height, bool background) {
|
||||
SkScalar scale = SkFloatToScalar(0.5f);
|
||||
SkScalar scale = 0.5f;
|
||||
if (background) {
|
||||
scale = SkFloatToScalar(0.6f);
|
||||
scale = 0.6f;
|
||||
}
|
||||
SkScalar shaderWidth = SkScalarDiv(SkIntToScalar(width), scale);
|
||||
SkScalar shaderHeight = SkScalarDiv(SkIntToScalar(height), scale);
|
||||
|
@ -53,10 +53,10 @@ public:
|
||||
: fGeomType(geomType) {
|
||||
|
||||
// offset the rects a bit so we get anti-aliasing in the rect case
|
||||
fBase.set(SkFloatToScalar(100.65f),
|
||||
SkFloatToScalar(100.65f),
|
||||
SkFloatToScalar(150.65f),
|
||||
SkFloatToScalar(150.65f));
|
||||
fBase.set(100.65f,
|
||||
100.65f,
|
||||
150.65f,
|
||||
150.65f);
|
||||
fRect = fBase;
|
||||
fRect.inset(5, 5);
|
||||
fRect.offset(25, 25);
|
||||
|
@ -14,6 +14,7 @@
|
||||
'defines': [
|
||||
'SK_GAMMA_SRGB',
|
||||
'SK_GAMMA_APPLY_TO_A8',
|
||||
'SK_SCALAR_TO_FLOAT_EXCLUDED', # temporary to allow Chrome to call SkFloatToScalar
|
||||
],
|
||||
|
||||
# Validate the 'skia_os' setting against 'OS', because only certain
|
||||
|
@ -18,7 +18,7 @@ class SkWStream;
|
||||
|
||||
/** SK_ScalarDefaultDPI is 72 DPI.
|
||||
*/
|
||||
#define SK_ScalarDefaultRasterDPI SkFloatToScalar(72.0f)
|
||||
#define SK_ScalarDefaultRasterDPI 72.0f
|
||||
|
||||
/**
|
||||
* High-level API for creating a document-based canvas. To use..
|
||||
|
@ -78,7 +78,9 @@
|
||||
#define SkScalarToFixed(x) SkFloatToFixed(x)
|
||||
|
||||
#define SkScalarToFloat(n) (n)
|
||||
#ifndef SK_SCALAR_TO_FLOAT_EXCLUDED
|
||||
#define SkFloatToScalar(n) (n)
|
||||
#endif
|
||||
|
||||
#define SkScalarToDouble(n) (double)(n)
|
||||
#define SkDoubleToScalar(n) (float)(n)
|
||||
@ -198,7 +200,9 @@
|
||||
#define SkFixedToScalar(x) (x)
|
||||
#define SkScalarToFixed(x) (x)
|
||||
#define SkScalarToFloat(n) SkFixedToFloat(n)
|
||||
#ifndef SK_SCALAR_TO_FLOAT_EXCLUDED
|
||||
#define SkFloatToScalar(n) SkFloatToFixed(n)
|
||||
#endif
|
||||
|
||||
#define SkScalarToDouble(n) SkFixedToDouble(n)
|
||||
#define SkDoubleToScalar(n) SkDoubleToFixed(n)
|
||||
|
@ -154,7 +154,7 @@ static void apply_shader(SkPaint* paint, float scale)
|
||||
SkLayerRasterizer* rast = new SkLayerRasterizer;
|
||||
|
||||
p.setAntiAlias(true);
|
||||
r7(rast, p, SkFloatToScalar(scale));
|
||||
r7(rast, p, scale);
|
||||
paint->setRasterizer(rast)->unref();
|
||||
|
||||
paint->setColor(SK_ColorBLUE);
|
||||
|
@ -85,95 +85,95 @@ protected:
|
||||
paints[p].setAlpha(a > 1 ? 0x80 : 0xff);
|
||||
|
||||
canvas->save();
|
||||
rect = SkRect::MakeLTRB(SkFloatToScalar(0.f),
|
||||
SkFloatToScalar(0.f),
|
||||
SkFloatToScalar(40.f),
|
||||
SkFloatToScalar(40.f));
|
||||
rect = SkRect::MakeLTRB(0.f,
|
||||
0.f,
|
||||
40.f,
|
||||
40.f);
|
||||
canvas->drawRect(rect, paints[p]);
|
||||
canvas->translate(dx, 0);
|
||||
|
||||
rect = SkRect::MakeLTRB(SkFloatToScalar(0.5f),
|
||||
SkFloatToScalar(0.5f),
|
||||
SkFloatToScalar(40.5f),
|
||||
SkFloatToScalar(40.5f));
|
||||
rect = SkRect::MakeLTRB(0.5f,
|
||||
0.5f,
|
||||
40.5f,
|
||||
40.5f);
|
||||
canvas->drawRect(rect, paints[p]);
|
||||
canvas->translate(dx, 0);
|
||||
|
||||
rect = SkRect::MakeLTRB(SkFloatToScalar(0.5f),
|
||||
SkFloatToScalar(0.5f),
|
||||
SkFloatToScalar(40.f),
|
||||
SkFloatToScalar(40.f));
|
||||
rect = SkRect::MakeLTRB(0.5f,
|
||||
0.5f,
|
||||
40.f,
|
||||
40.f);
|
||||
canvas->drawRect(rect, paints[p]);
|
||||
canvas->translate(dx, 0);
|
||||
|
||||
rect = SkRect::MakeLTRB(SkFloatToScalar(0.75f),
|
||||
SkFloatToScalar(0.75f),
|
||||
SkFloatToScalar(40.75f),
|
||||
SkFloatToScalar(40.75f));
|
||||
rect = SkRect::MakeLTRB(0.75f,
|
||||
0.75f,
|
||||
40.75f,
|
||||
40.75f);
|
||||
canvas->drawRect(rect, paints[p]);
|
||||
canvas->translate(dx, 0);
|
||||
|
||||
canvas->save();
|
||||
canvas->translate(SkFloatToScalar(.33f), SkFloatToScalar(.67f));
|
||||
rect = SkRect::MakeLTRB(SkFloatToScalar(0.0f),
|
||||
SkFloatToScalar(0.0f),
|
||||
SkFloatToScalar(40.0f),
|
||||
SkFloatToScalar(40.0f));
|
||||
canvas->translate(.33f, .67f);
|
||||
rect = SkRect::MakeLTRB(0.0f,
|
||||
0.0f,
|
||||
40.0f,
|
||||
40.0f);
|
||||
canvas->drawRect(rect, paints[p]);
|
||||
canvas->restore();
|
||||
canvas->translate(dx, 0);
|
||||
|
||||
canvas->save();
|
||||
matrix.setRotate(SkFloatToScalar(45.f));
|
||||
matrix.setRotate(45.f);
|
||||
canvas->concat(matrix);
|
||||
canvas->translate(SkFloatToScalar(20.0f / sqrtf(2.f)),
|
||||
SkFloatToScalar(20.0f / sqrtf(2.f)));
|
||||
rect = SkRect::MakeLTRB(SkFloatToScalar(-20.0f),
|
||||
SkFloatToScalar(-20.0f),
|
||||
SkFloatToScalar(20.0f),
|
||||
SkFloatToScalar(20.0f));
|
||||
canvas->translate(20.0f / sqrtf(2.f),
|
||||
20.0f / sqrtf(2.f));
|
||||
rect = SkRect::MakeLTRB(-20.0f,
|
||||
-20.0f,
|
||||
20.0f,
|
||||
20.0f);
|
||||
canvas->drawRect(rect, paints[p]);
|
||||
canvas->restore();
|
||||
canvas->translate(dx, 0);
|
||||
|
||||
canvas->save();
|
||||
canvas->rotate(SkFloatToScalar(90.f));
|
||||
rect = SkRect::MakeLTRB(SkFloatToScalar(0.0f),
|
||||
SkFloatToScalar(0.0f),
|
||||
SkFloatToScalar(40.0f),
|
||||
SkFloatToScalar(-40.0f));
|
||||
canvas->rotate(90.f);
|
||||
rect = SkRect::MakeLTRB(0.0f,
|
||||
0.0f,
|
||||
40.0f,
|
||||
-40.0f);
|
||||
canvas->drawRect(rect, paints[p]);
|
||||
canvas->restore();
|
||||
canvas->translate(dx, 0);
|
||||
|
||||
canvas->save();
|
||||
canvas->rotate(SkFloatToScalar(90.f));
|
||||
rect = SkRect::MakeLTRB(SkFloatToScalar(0.5f),
|
||||
SkFloatToScalar(0.5f),
|
||||
SkFloatToScalar(40.5f),
|
||||
SkFloatToScalar(-40.5f));
|
||||
canvas->rotate(90.f);
|
||||
rect = SkRect::MakeLTRB(0.5f,
|
||||
0.5f,
|
||||
40.5f,
|
||||
-40.5f);
|
||||
canvas->drawRect(rect, paints[p]);
|
||||
canvas->restore();
|
||||
canvas->translate(dx, 0);
|
||||
|
||||
canvas->save();
|
||||
matrix.setScale(SkFloatToScalar(-1.f), SkFloatToScalar(-1.f));
|
||||
matrix.setScale(-1.f, -1.f);
|
||||
canvas->concat(matrix);
|
||||
rect = SkRect::MakeLTRB(SkFloatToScalar(0.5f),
|
||||
SkFloatToScalar(0.5f),
|
||||
SkFloatToScalar(-40.5f),
|
||||
SkFloatToScalar(-40.5f));
|
||||
rect = SkRect::MakeLTRB(0.5f,
|
||||
0.5f,
|
||||
-40.5f,
|
||||
-40.5f);
|
||||
canvas->drawRect(rect, paints[p]);
|
||||
canvas->restore();
|
||||
canvas->translate(dx, 0);
|
||||
|
||||
canvas->save();
|
||||
matrix.setScale(SkFloatToScalar(2.1f), SkFloatToScalar(4.1f));
|
||||
matrix.setScale(2.1f, 4.1f);
|
||||
canvas->concat(matrix);
|
||||
rect = SkRect::MakeLTRB(SkFloatToScalar(0.1f),
|
||||
SkFloatToScalar(0.1f),
|
||||
SkFloatToScalar(19.1f),
|
||||
SkFloatToScalar(9.1f));
|
||||
rect = SkRect::MakeLTRB(0.1f,
|
||||
0.1f,
|
||||
19.1f,
|
||||
9.1f);
|
||||
canvas->drawRect(rect, paints[p]);
|
||||
canvas->restore();
|
||||
canvas->translate(dx, 0);
|
||||
|
@ -285,8 +285,8 @@ protected:
|
||||
path.addCircle(SkIntToScalar(20), SkIntToScalar(20), SkIntToScalar(20),
|
||||
SkPath::kCCW_Direction);
|
||||
for (int index = 0; index < 10; index++) {
|
||||
SkScalar x = SkFloatToScalar((float) cos(index / 10.0f * 2 * 3.1415925358f));
|
||||
SkScalar y = SkFloatToScalar((float) sin(index / 10.0f * 2 * 3.1415925358f));
|
||||
SkScalar x = (float) cos(index / 10.0f * 2 * 3.1415925358f);
|
||||
SkScalar y = (float) sin(index / 10.0f * 2 * 3.1415925358f);
|
||||
x *= index & 1 ? 7 : 14;
|
||||
y *= index & 1 ? 7 : 14;
|
||||
x += SkIntToScalar(20);
|
||||
|
@ -658,8 +658,8 @@ static bool curr_title(SkWindow* wind, SkString* title) {
|
||||
|
||||
void SampleWindow::setZoomCenter(float x, float y)
|
||||
{
|
||||
fZoomCenterX = SkFloatToScalar(x);
|
||||
fZoomCenterY = SkFloatToScalar(y);
|
||||
fZoomCenterX = x;
|
||||
fZoomCenterY = y;
|
||||
}
|
||||
|
||||
bool SampleWindow::zoomIn()
|
||||
@ -1549,7 +1549,7 @@ static SkBitmap::Config cycle_configs(SkBitmap::Config c) {
|
||||
}
|
||||
|
||||
void SampleWindow::changeZoomLevel(float delta) {
|
||||
fZoomLevel += SkFloatToScalar(delta);
|
||||
fZoomLevel += delta;
|
||||
if (fZoomLevel > 0) {
|
||||
fZoomLevel = SkMinScalar(fZoomLevel, MAX_ZOOM_LEVEL);
|
||||
fZoomScale = fZoomLevel + SK_Scalar1;
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include "SkParsePath.h"
|
||||
static void testparse() {
|
||||
SkRect r;
|
||||
r.set(0, 0, SkFloatToScalar(10), SkFloatToScalar(10.5f));
|
||||
r.set(0, 0, 10, 10.5f);
|
||||
SkPath p, p2;
|
||||
SkString str, str2;
|
||||
|
||||
@ -123,7 +123,7 @@ protected:
|
||||
virtual void onDrawContent(SkCanvas* canvas) {
|
||||
fSweep = SampleCode::GetAnimScalar(SkIntToScalar(360)/24,
|
||||
SkIntToScalar(360));
|
||||
// fSweep = SkFloatToScalar(359.99f);
|
||||
// fSweep = 359.99f;
|
||||
|
||||
SkRect r;
|
||||
SkPaint paint;
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
static void draw_gradient2(SkCanvas* canvas, const SkRect& rect, SkScalar delta) {
|
||||
SkColor colors[] = { SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE, SK_ColorMAGENTA };
|
||||
SkScalar pos[] = { 0, SkFloatToScalar(0.25f), SkFloatToScalar(0.75f), SK_Scalar1 };
|
||||
SkScalar pos[] = { 0, 0.25f, 0.75f, SK_Scalar1 };
|
||||
|
||||
SkScalar l = rect.fLeft;
|
||||
SkScalar t = rect.fTop;
|
||||
|
@ -55,7 +55,7 @@ static void draw_sweep(SkCanvas* c, int width, int height, SkScalar angle) {
|
||||
SkScalar y = r.centerY();
|
||||
SkScalar radius = r.width() / 2;
|
||||
SkScalar thickness = p.getStrokeWidth();
|
||||
SkScalar sweep = SkFloatToScalar(360.0f);
|
||||
SkScalar sweep = 360.0f;
|
||||
SkPath path;
|
||||
|
||||
path.moveTo(x + radius, y);
|
||||
|
@ -33,8 +33,8 @@ static void paint_proc2(SkPaint* paint) {
|
||||
paint->setMaskFilter(
|
||||
SkBlurMaskFilter::CreateEmboss(SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(1)),
|
||||
dir,
|
||||
SkFloatToScalar(0.1f),
|
||||
SkFloatToScalar(0.05f)))->unref();
|
||||
0.1f,
|
||||
0.05f))->unref();
|
||||
}
|
||||
|
||||
static void paint_proc3(SkPaint* paint) {
|
||||
|
@ -72,7 +72,7 @@ protected:
|
||||
const SkScalar H = SkIntToScalar(fBitmaps[0].height() + 1);
|
||||
SkPaint paint;
|
||||
|
||||
const SkScalar scale = SkFloatToScalar(0.897917f);
|
||||
const SkScalar scale = 0.897917f;
|
||||
canvas->scale(SK_Scalar1, scale);
|
||||
|
||||
for (int k = 0; k < 2; k++) {
|
||||
|
@ -80,7 +80,7 @@ static float make_number(bool positiveOnly) {
|
||||
}
|
||||
|
||||
static SkScalar make_scalar(bool positiveOnly = false) {
|
||||
return SkFloatToScalar(make_number(positiveOnly));
|
||||
return make_number(positiveOnly);
|
||||
}
|
||||
|
||||
static SkRect make_rect(int offset = 1) {
|
||||
|
@ -77,12 +77,12 @@ protected:
|
||||
if (false) {
|
||||
SkPoint pts[4];
|
||||
pts[0].set(1.61061274e+09f, 6291456);
|
||||
pts[1].set(SkFloatToScalar(-7.18397061e+15f),
|
||||
SkFloatToScalar(-1.53091184e+13f));
|
||||
pts[2].set(SkFloatToScalar(-1.30077315e+16f),
|
||||
SkFloatToScalar(-2.77196141e+13f));
|
||||
pts[3].set(SkFloatToScalar(-1.30077315e+16f),
|
||||
SkFloatToScalar(-2.77196162e+13f));
|
||||
pts[1].set(-7.18397061e+15f,
|
||||
-1.53091184e+13f);
|
||||
pts[2].set(-1.30077315e+16f,
|
||||
-2.77196141e+13f);
|
||||
pts[3].set(-1.30077315e+16f,
|
||||
-2.77196162e+13f);
|
||||
|
||||
SkPath path;
|
||||
path.moveTo(pts[0]);
|
||||
|
@ -39,8 +39,8 @@ static void test_chromium_9005() {
|
||||
|
||||
SkCanvas canvas(bm);
|
||||
|
||||
SkPoint pt0 = { SkFloatToScalar(799.33374f), SkFloatToScalar(1.2360189f) };
|
||||
SkPoint pt1 = { SkFloatToScalar(808.49969f), SkFloatToScalar(-7.4338055f) };
|
||||
SkPoint pt0 = { 799.33374f, 1.2360189f };
|
||||
SkPoint pt1 = { 808.49969f, -7.4338055f };
|
||||
|
||||
SkPaint paint;
|
||||
paint.setAntiAlias(true);
|
||||
|
@ -104,7 +104,7 @@ protected:
|
||||
SkPaint paint;
|
||||
|
||||
canvas->save();
|
||||
canvas->scale(SkFloatToScalar(0.5f), SkFloatToScalar(0.5f));
|
||||
canvas->scale(0.5f, 0.5f);
|
||||
canvas->drawBitmap(fBitmap, 0, 0, NULL);
|
||||
canvas->restore();
|
||||
|
||||
|
@ -41,11 +41,11 @@ public:
|
||||
m1.reset();
|
||||
|
||||
const SkScalar src1[] = {
|
||||
0, 0, 0, SkFloatToScalar(427), SkFloatToScalar(316), SkFloatToScalar(427), SkFloatToScalar(316), 0
|
||||
0, 0, 0, 427, 316, 427, 316, 0
|
||||
};
|
||||
const SkScalar dst1[] = {
|
||||
SkFloatToScalar(158), SkFloatToScalar(177.5f), SkFloatToScalar(158), SkFloatToScalar(249.5f),
|
||||
SkFloatToScalar(158), SkFloatToScalar(604.5f), SkFloatToScalar(158), SkFloatToScalar(-177.5f)
|
||||
158, 177.5f, 158, 249.5f,
|
||||
158, 604.5f, 158, -177.5f
|
||||
};
|
||||
|
||||
(void) m2.setPolyToPoly((const SkPoint*)src1, (SkPoint*)dst1, 4);
|
||||
@ -112,7 +112,7 @@ protected:
|
||||
SkString str;
|
||||
str.appendS32(count);
|
||||
canvas->drawText(str.c_str(), str.size(),
|
||||
x, SkFloatToScalar(y),
|
||||
x, y,
|
||||
*paint);
|
||||
|
||||
canvas->restore();
|
||||
|
@ -76,7 +76,7 @@ static void drawFadingText(SkCanvas* canvas,
|
||||
|
||||
// pos[1] value is where we start to fade, relative to the width
|
||||
// of our pts[] array.
|
||||
const SkScalar pos[] = { 0, SkFloatToScalar(0.9f), SK_Scalar1 };
|
||||
const SkScalar pos[] = { 0, 0.9f, SK_Scalar1 };
|
||||
|
||||
SkShader* s = SkGradientShader::CreateLinear(pts, colors, pos, 3,
|
||||
SkShader::kClamp_TileMode);
|
||||
|
@ -80,7 +80,7 @@ static void one_d_pe(SkPaint* paint) {
|
||||
path.lineTo(SkIntToScalar(gXY[i]), SkIntToScalar(gXY[i+1]));
|
||||
path.close();
|
||||
path.offset(SkIntToScalar(-6), 0);
|
||||
scale(&path, SkFloatToScalar(1.5f));
|
||||
scale(&path, 1.5f);
|
||||
|
||||
paint->setPathEffect(new SkPath1DPathEffect(path, SkIntToScalar(21), 0,
|
||||
SkPath1DPathEffect::kRotate_Style))->unref();
|
||||
|
@ -176,7 +176,7 @@ void SkPowerMode::init(SkScalar e) {
|
||||
// printf(" %d %g", i, x);
|
||||
x = powf(x, ee);
|
||||
// printf(" %g", x);
|
||||
int xx = SkScalarRound(SkFloatToScalar(x * 255));
|
||||
int xx = SkScalarRound(x * 255);
|
||||
// printf(" %d\n", xx);
|
||||
fTable[i] = SkToU8(xx);
|
||||
}
|
||||
|
@ -22,29 +22,29 @@ static void textStrokePath(SkCanvas* canvas) {
|
||||
canvas->save();
|
||||
canvas->scale(SkIntToScalar(250),SkIntToScalar(250));
|
||||
|
||||
rect.set(SkFloatToScalar(0.0f), SkFloatToScalar(0.21f),
|
||||
SkFloatToScalar(0.78f), SkFloatToScalar(0.99f));
|
||||
rect.set(0.0f, 0.21f,
|
||||
0.78f, 0.99f);
|
||||
|
||||
path.addArc(rect, SkIntToScalar(280), SkIntToScalar(350));
|
||||
|
||||
paint.setAntiAlias(true);
|
||||
paint.setStyle(SkPaint::kStroke_Style);
|
||||
paint.setColor(0xFFFF0000);
|
||||
paint.setTextSize(SkFloatToScalar(0.085f));
|
||||
paint.setStrokeWidth(SkFloatToScalar(.005f));
|
||||
paint.setTextSize(0.085f);
|
||||
paint.setStrokeWidth(.005f);
|
||||
|
||||
canvas->drawPath(path, paint);
|
||||
|
||||
paint.setLooper(new SkBlurDrawLooper(SK_ColorBLACK,
|
||||
SkBlurMask::ConvertRadiusToSigma(SkFloatToScalar(0.002f)),
|
||||
SkFloatToScalar(0.0f),
|
||||
SkFloatToScalar(0.0f)))->unref();
|
||||
SkBlurMask::ConvertRadiusToSigma(0.002f),
|
||||
0.0f,
|
||||
0.0f))->unref();
|
||||
|
||||
const char* text = "DRAWING STROKED TEXT WITH A BLUR ON A PATH";
|
||||
size_t len = strlen(text);
|
||||
|
||||
canvas->drawTextOnPathHV(text, len, path, 0,
|
||||
SkFloatToScalar(-0.025f), paint);
|
||||
-0.025f, paint);
|
||||
canvas->restore();
|
||||
}
|
||||
|
||||
|
@ -158,8 +158,8 @@ protected:
|
||||
fEnd[kPrevX] = -lr;
|
||||
fEnd[kPrevY] = -ud;
|
||||
fEnd[kNextX] = fEnd[kNextY] = 0;
|
||||
SkScalar blend[] = { SkFloatToScalar(0.8f), SkFloatToScalar(0.0f),
|
||||
SkFloatToScalar(0.0f), SK_Scalar1 };
|
||||
SkScalar blend[] = { 0.8f, 0.0f,
|
||||
0.0f, SK_Scalar1 };
|
||||
fInterp.setKeyFrame(0, SkTime::GetMSecs(), fBegin, blend);
|
||||
fInterp.setKeyFrame(1, SkTime::GetMSecs()+kDurationMS, fEnd, blend);
|
||||
}
|
||||
|
@ -10,38 +10,38 @@
|
||||
void setup_vertexbug(SkPoint verts[], SkPoint texs[], uint16_t index[]);
|
||||
|
||||
void setup_vertexbug(SkPoint verts[], SkPoint texs[], uint16_t index[]) {
|
||||
verts[0].set(SkFloatToScalar(107), SkFloatToScalar(189));
|
||||
texs[0].set(SkFloatToScalar(0), SkFloatToScalar(0));
|
||||
verts[1].set(SkFloatToScalar(116), SkFloatToScalar(189));
|
||||
texs[1].set(SkFloatToScalar(9), SkFloatToScalar(0));
|
||||
verts[2].set(SkFloatToScalar(203), SkFloatToScalar(189));
|
||||
texs[2].set(SkFloatToScalar(35), SkFloatToScalar(0));
|
||||
verts[3].set(SkFloatToScalar(212), SkFloatToScalar(189));
|
||||
texs[3].set(SkFloatToScalar(44), SkFloatToScalar(0));
|
||||
verts[4].set(SkFloatToScalar(107), SkFloatToScalar(198));
|
||||
texs[4].set(SkFloatToScalar(0), SkFloatToScalar(9));
|
||||
verts[5].set(SkFloatToScalar(116), SkFloatToScalar(198));
|
||||
texs[5].set(SkFloatToScalar(9), SkFloatToScalar(9));
|
||||
verts[6].set(SkFloatToScalar(203), SkFloatToScalar(198));
|
||||
texs[6].set(SkFloatToScalar(35), SkFloatToScalar(9));
|
||||
verts[7].set(SkFloatToScalar(212), SkFloatToScalar(198));
|
||||
texs[7].set(SkFloatToScalar(44), SkFloatToScalar(9));
|
||||
verts[8].set(SkFloatToScalar(107), SkFloatToScalar(224));
|
||||
texs[8].set(SkFloatToScalar(0), SkFloatToScalar(39));
|
||||
verts[9].set(SkFloatToScalar(116), SkFloatToScalar(224));
|
||||
texs[9].set(SkFloatToScalar(9), SkFloatToScalar(39));
|
||||
verts[10].set(SkFloatToScalar(203), SkFloatToScalar(224));
|
||||
texs[10].set(SkFloatToScalar(35), SkFloatToScalar(39));
|
||||
verts[11].set(SkFloatToScalar(212), SkFloatToScalar(224));
|
||||
texs[11].set(SkFloatToScalar(44), SkFloatToScalar(39));
|
||||
verts[12].set(SkFloatToScalar(107), SkFloatToScalar(233));
|
||||
texs[12].set(SkFloatToScalar(0), SkFloatToScalar(48));
|
||||
verts[13].set(SkFloatToScalar(116), SkFloatToScalar(233));
|
||||
texs[13].set(SkFloatToScalar(9), SkFloatToScalar(48));
|
||||
verts[14].set(SkFloatToScalar(203), SkFloatToScalar(233));
|
||||
texs[14].set(SkFloatToScalar(35), SkFloatToScalar(48));
|
||||
verts[15].set(SkFloatToScalar(212), SkFloatToScalar(233));
|
||||
texs[15].set(SkFloatToScalar(44), SkFloatToScalar(48));
|
||||
verts[0].set(107, 189);
|
||||
texs[0].set(0, 0);
|
||||
verts[1].set(116, 189);
|
||||
texs[1].set(9, 0);
|
||||
verts[2].set(203, 189);
|
||||
texs[2].set(35, 0);
|
||||
verts[3].set(212, 189);
|
||||
texs[3].set(44, 0);
|
||||
verts[4].set(107, 198);
|
||||
texs[4].set(0, 9);
|
||||
verts[5].set(116, 198);
|
||||
texs[5].set(9, 9);
|
||||
verts[6].set(203, 198);
|
||||
texs[6].set(35, 9);
|
||||
verts[7].set(212, 198);
|
||||
texs[7].set(44, 9);
|
||||
verts[8].set(107, 224);
|
||||
texs[8].set(0, 39);
|
||||
verts[9].set(116, 224);
|
||||
texs[9].set(9, 39);
|
||||
verts[10].set(203, 224);
|
||||
texs[10].set(35, 39);
|
||||
verts[11].set(212, 224);
|
||||
texs[11].set(44, 39);
|
||||
verts[12].set(107, 233);
|
||||
texs[12].set(0, 48);
|
||||
verts[13].set(116, 233);
|
||||
texs[13].set(9, 48);
|
||||
verts[14].set(203, 233);
|
||||
texs[14].set(35, 48);
|
||||
verts[15].set(212, 233);
|
||||
texs[15].set(44, 48);
|
||||
index[0] = 0; index[1] = 5; index[2] = 1;
|
||||
index[3] = 0; index[4] = 4; index[5] = 5;
|
||||
#if 0
|
||||
|
@ -53,7 +53,7 @@ void SkBBoxRecord::drawPoints(PointMode mode, size_t count, const SkPoint pts[],
|
||||
// Note: The device coordinate outset in SkBBoxHierarchyRecord::handleBBox is currently
|
||||
// done in the recording coordinate space, which is wrong.
|
||||
// http://code.google.com/p/skia/issues/detail?id=1021
|
||||
static const SkScalar kMinWidth = SkFloatToScalar(0.01f);
|
||||
static const SkScalar kMinWidth = 0.01f;
|
||||
SkScalar halfStrokeWidth = SkMaxScalar(paint.getStrokeWidth(), kMinWidth) / 2;
|
||||
bbox.outset(halfStrokeWidth, halfStrokeWidth);
|
||||
if (this->transformBounds(bbox, &paint)) {
|
||||
|
@ -31,8 +31,8 @@ void highQualityFilter(ColorPacker pack, const SkBitmapProcState& s, int x, int
|
||||
|
||||
while (count-- > 0) {
|
||||
SkPoint srcPt;
|
||||
s.fInvProc(s.fInvMatrix, SkFloatToScalar(x + 0.5f),
|
||||
SkFloatToScalar(y + 0.5f), &srcPt);
|
||||
s.fInvProc(s.fInvMatrix, x + 0.5f,
|
||||
y + 0.5f, &srcPt);
|
||||
srcPt.fX -= SK_ScalarHalf;
|
||||
srcPt.fY -= SK_ScalarHalf;
|
||||
|
||||
|
@ -67,7 +67,7 @@ class SkBitmapFilter {
|
||||
for (int x = 0; x < SKBITMAP_FILTER_TABLE_SIZE; ++x) {
|
||||
float fx = ((float)x + .5f) * this->width() / SKBITMAP_FILTER_TABLE_SIZE;
|
||||
float filter_value = evaluate(fx);
|
||||
*ftpScalar++ = SkFloatToScalar(filter_value);
|
||||
*ftpScalar++ = filter_value;
|
||||
*ftp++ = SkFloatToFixed(filter_value);
|
||||
}
|
||||
}
|
||||
|
@ -198,7 +198,7 @@ bool SkBitmapProcState::possiblyScaleImage() {
|
||||
// so we only keep High quality if the scale is greater than this.
|
||||
//
|
||||
// Since we're dealing with the inverse, we compare against its inverse.
|
||||
const SkScalar bicubicLimit = SkFloatToScalar(4.0f);
|
||||
const SkScalar bicubicLimit = 4.0f;
|
||||
const SkScalar bicubicLimitSqd = bicubicLimit * bicubicLimit;
|
||||
if (scaleSqd < bicubicLimitSqd) { // use bicubic scanline
|
||||
return false;
|
||||
|
@ -41,7 +41,7 @@ inline SkFixed SkFDot6ToFixed(SkFDot6 x) {
|
||||
|
||||
#ifdef SK_SCALAR_IS_FLOAT
|
||||
#define SkScalarToFDot6(x) (SkFDot6)((x) * 64)
|
||||
#define SkFDot6ToScalar(x) ((SkScalar)(x) * SkFloatToScalar(0.015625f))
|
||||
#define SkFDot6ToScalar(x) ((SkScalar)(x) * 0.015625f)
|
||||
#else
|
||||
#define SkScalarToFDot6(x) ((x) >> 10)
|
||||
#define SkFDot6ToScalar(x) ((x) << 10)
|
||||
|
@ -1134,9 +1134,9 @@ bool SkXRayCrossesMonotonicCubic(const SkXRay& pt, const SkPoint cubic[4], bool*
|
||||
// instead of down
|
||||
if (cubic[3].fY > cubic[0].fY) {
|
||||
upper_t = SK_Scalar1;
|
||||
lower_t = SkFloatToScalar(0);
|
||||
lower_t = 0;
|
||||
} else {
|
||||
upper_t = SkFloatToScalar(0);
|
||||
upper_t = 0;
|
||||
lower_t = SK_Scalar1;
|
||||
}
|
||||
do {
|
||||
|
@ -176,7 +176,7 @@ static bool is_between_unsorted(SkScalar value,
|
||||
static void sect_with_horizontal_test_for_pin_results() {
|
||||
const SkPoint pts[] = {
|
||||
{ -540000, -720000 },
|
||||
{ SkFloatToScalar(-9.10000017e-05f), SkFloatToScalar(9.99999996e-13f) }
|
||||
{ -9.10000017e-05f, 9.99999996e-13f }
|
||||
};
|
||||
float x = sect_with_horizontal(pts, 0);
|
||||
SkASSERT(is_between_unsorted(x, pts[0].fX, pts[1].fX));
|
||||
|
@ -36,21 +36,21 @@ class SkSRGBColorSpaceLuminance : public SkColorSpaceLuminance {
|
||||
SkASSERT(0 == gamma);
|
||||
//The magic numbers are derived from the sRGB specification.
|
||||
//See http://www.color.org/chardata/rgb/srgb.xalter .
|
||||
if (luminance <= SkFloatToScalar(0.04045f)) {
|
||||
return luminance / SkFloatToScalar(12.92f);
|
||||
if (luminance <= 0.04045f) {
|
||||
return luminance / 12.92f;
|
||||
}
|
||||
return SkScalarPow((luminance + SkFloatToScalar(0.055f)) / SkFloatToScalar(1.055f),
|
||||
SkFloatToScalar(2.4f));
|
||||
return SkScalarPow((luminance + 0.055f) / 1.055f,
|
||||
2.4f);
|
||||
}
|
||||
virtual SkScalar fromLuma(SkScalar SkDEBUGCODE(gamma), SkScalar luma) const SK_OVERRIDE {
|
||||
SkASSERT(0 == gamma);
|
||||
//The magic numbers are derived from the sRGB specification.
|
||||
//See http://www.color.org/chardata/rgb/srgb.xalter .
|
||||
if (luma <= SkFloatToScalar(0.0031308f)) {
|
||||
return luma * SkFloatToScalar(12.92f);
|
||||
if (luma <= 0.0031308f) {
|
||||
return luma * 12.92f;
|
||||
}
|
||||
return SkFloatToScalar(1.055f) * SkScalarPow(luma, SkScalarInvert(SkFloatToScalar(2.4f)))
|
||||
- SkFloatToScalar(0.055f);
|
||||
return 1.055f * SkScalarPow(luma, SkScalarInvert(2.4f))
|
||||
- 0.055f;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -35,9 +35,9 @@ public:
|
||||
SkScalar r = luminance.toLuma(gamma, SkIntToScalar(SkColorGetR(c)) / 255);
|
||||
SkScalar g = luminance.toLuma(gamma, SkIntToScalar(SkColorGetG(c)) / 255);
|
||||
SkScalar b = luminance.toLuma(gamma, SkIntToScalar(SkColorGetB(c)) / 255);
|
||||
SkScalar luma = r * SkFloatToScalar(SK_LUM_COEFF_R) +
|
||||
g * SkFloatToScalar(SK_LUM_COEFF_G) +
|
||||
b * SkFloatToScalar(SK_LUM_COEFF_B);
|
||||
SkScalar luma = r * SK_LUM_COEFF_R +
|
||||
g * SK_LUM_COEFF_G +
|
||||
b * SK_LUM_COEFF_B;
|
||||
SkASSERT(luma <= SK_Scalar1);
|
||||
return SkScalarRoundToInt(luminance.fromLuma(gamma, luma) * 255);
|
||||
}
|
||||
|
@ -1696,7 +1696,7 @@ void SkScalerContext::MakeRec(const SkPaint& paint,
|
||||
* With higher values lcd fringing is worse and the smoothing effect of
|
||||
* partial coverage is diminished.
|
||||
*/
|
||||
rec->setContrast(SkFloatToScalar(0.5f));
|
||||
rec->setContrast(0.5f);
|
||||
#endif
|
||||
|
||||
rec->fReservedAlign = 0;
|
||||
|
@ -115,7 +115,7 @@ bool SkBicubicImageFilter::onFilterImage(Proxy* proxy,
|
||||
src.getBounds(&srcRect);
|
||||
SkMatrix inverse;
|
||||
inverse.setRectToRect(dstRect, srcRect, SkMatrix::kFill_ScaleToFit);
|
||||
inverse.postTranslate(SkFloatToScalar(-0.5f), SkFloatToScalar(-0.5f));
|
||||
inverse.postTranslate(-0.5f, -0.5f);
|
||||
|
||||
for (int y = dstIRect.fTop; y < dstIRect.fBottom; ++y) {
|
||||
SkPMColor* dptr = result->getAddr32(dstIRect.fLeft, y);
|
||||
|
@ -21,7 +21,7 @@ SkScalar SkBlurMask::ConvertRadiusToSigma(SkScalar radius) {
|
||||
// Firefox used to do the same too, until 4.0 where they fixed it. So at some
|
||||
// point we should probably get rid of these scaling constants and rebaseline
|
||||
// all the blur tests.
|
||||
static const SkScalar kBLUR_SIGMA_SCALE = SkFloatToScalar(0.57735f);
|
||||
static const SkScalar kBLUR_SIGMA_SCALE = 0.57735f;
|
||||
|
||||
return radius ? kBLUR_SIGMA_SCALE * radius + 0.5f : 0.0f;
|
||||
}
|
||||
@ -405,7 +405,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);
|
||||
if (SkIntToScalar(*hiRadius) - passRadius > SkFloatToScalar(0.5f)) {
|
||||
if (SkIntToScalar(*hiRadius) - passRadius > 0.5f) {
|
||||
*loRadius = *hiRadius - 1;
|
||||
}
|
||||
}
|
||||
|
@ -540,8 +540,8 @@ bool SkBlurMaskFilterImpl::canFilterMaskGPU(const SkRect& srcBounds,
|
||||
SkRect srcRect(srcBounds);
|
||||
|
||||
// Outset srcRect and clipRect by 3 * sigma, to compute affected blur area.
|
||||
srcRect.outset(SkFloatToScalar(sigma3), SkFloatToScalar(sigma3));
|
||||
clipRect.outset(SkFloatToScalar(sigma3), SkFloatToScalar(sigma3));
|
||||
srcRect.outset(sigma3, sigma3);
|
||||
clipRect.outset(sigma3, sigma3);
|
||||
srcRect.intersect(clipRect);
|
||||
*maskRect = srcRect;
|
||||
return true;
|
||||
|
@ -108,9 +108,9 @@ static void setrow(SkScalar row[], SkScalar r, SkScalar g, SkScalar b) {
|
||||
row[2] = b;
|
||||
}
|
||||
|
||||
static const SkScalar kHueR = SkFloatToScalar(0.213f);
|
||||
static const SkScalar kHueG = SkFloatToScalar(0.715f);
|
||||
static const SkScalar kHueB = SkFloatToScalar(0.072f);
|
||||
static const SkScalar kHueR = 0.213f;
|
||||
static const SkScalar kHueG = 0.715f;
|
||||
static const SkScalar kHueB = 0.072f;
|
||||
|
||||
void SkColorMatrix::setSaturation(SkScalar sat) {
|
||||
memset(fMat, 0, sizeof(fMat));
|
||||
@ -125,17 +125,17 @@ void SkColorMatrix::setSaturation(SkScalar sat) {
|
||||
fMat[18] = SK_Scalar1;
|
||||
}
|
||||
|
||||
static const SkScalar kR2Y = SkFloatToScalar(0.299f);
|
||||
static const SkScalar kG2Y = SkFloatToScalar(0.587f);
|
||||
static const SkScalar kB2Y = SkFloatToScalar(0.114f);
|
||||
static const SkScalar kR2Y = 0.299f;
|
||||
static const SkScalar kG2Y = 0.587f;
|
||||
static const SkScalar kB2Y = 0.114f;
|
||||
|
||||
static const SkScalar kR2U = SkFloatToScalar(-0.16874f);
|
||||
static const SkScalar kG2U = SkFloatToScalar(-0.33126f);
|
||||
static const SkScalar kB2U = SkFloatToScalar(0.5f);
|
||||
static const SkScalar kR2U = -0.16874f;
|
||||
static const SkScalar kG2U = -0.33126f;
|
||||
static const SkScalar kB2U = 0.5f;
|
||||
|
||||
static const SkScalar kR2V = SkFloatToScalar(0.5f);
|
||||
static const SkScalar kG2V = SkFloatToScalar(-0.41869f);
|
||||
static const SkScalar kB2V = SkFloatToScalar(-0.08131f);
|
||||
static const SkScalar kR2V = 0.5f;
|
||||
static const SkScalar kG2V = -0.41869f;
|
||||
static const SkScalar kB2V = -0.08131f;
|
||||
|
||||
void SkColorMatrix::setRGB2YUV() {
|
||||
memset(fMat, 0, sizeof(fMat));
|
||||
@ -146,10 +146,10 @@ void SkColorMatrix::setRGB2YUV() {
|
||||
fMat[18] = SK_Scalar1;
|
||||
}
|
||||
|
||||
static const SkScalar kV2R = SkFloatToScalar(1.402f);
|
||||
static const SkScalar kU2G = SkFloatToScalar(-0.34414f);
|
||||
static const SkScalar kV2G = SkFloatToScalar(-0.71414f);
|
||||
static const SkScalar kU2B = SkFloatToScalar(1.772f);
|
||||
static const SkScalar kV2R = 1.402f;
|
||||
static const SkScalar kU2G = -0.34414f;
|
||||
static const SkScalar kV2G = -0.71414f;
|
||||
static const SkScalar kU2B = 1.772f;
|
||||
|
||||
void SkColorMatrix::setYUV2RGB() {
|
||||
memset(fMat, 0, sizeof(fMat));
|
||||
|
@ -49,7 +49,7 @@ template<SkDisplacementMapEffect::ChannelSelectorType typeX,
|
||||
SkDisplacementMapEffect::ChannelSelectorType typeY>
|
||||
void computeDisplacement(SkScalar scale, SkBitmap* dst, SkBitmap* displ, SkBitmap* src, const SkIRect& bounds)
|
||||
{
|
||||
static const SkScalar Inv8bit = SkScalarDiv(SK_Scalar1, SkFloatToScalar(255.0f));
|
||||
static const SkScalar Inv8bit = SkScalarDiv(SK_Scalar1, 255.0f);
|
||||
const int srcW = src->width();
|
||||
const int srcH = src->height();
|
||||
const SkScalar scaleForColor = SkScalarMul(scale, Inv8bit);
|
||||
@ -413,7 +413,7 @@ GrEffectRef* GrDisplacementMapEffect::TestCreate(SkRandom* random,
|
||||
SkDisplacementMapEffect::ChannelSelectorType yChannelSelector =
|
||||
static_cast<SkDisplacementMapEffect::ChannelSelectorType>(
|
||||
random->nextRangeU(1, kMaxComponent));
|
||||
SkScalar scale = random->nextRangeScalar(0, SkFloatToScalar(100.0f));
|
||||
SkScalar scale = random->nextRangeScalar(0, 100.0f);
|
||||
|
||||
return GrDisplacementMapEffect::Create(xChannelSelector, yChannelSelector, scale,
|
||||
textures[texIdxDispl], textures[texIdxColor]);
|
||||
|
@ -22,10 +22,10 @@ namespace SkGpuBlurUtils {
|
||||
#define MAX_BLUR_SIGMA 4.0f
|
||||
|
||||
static void scale_rect(SkRect* rect, float xScale, float yScale) {
|
||||
rect->fLeft = SkScalarMul(rect->fLeft, SkFloatToScalar(xScale));
|
||||
rect->fTop = SkScalarMul(rect->fTop, SkFloatToScalar(yScale));
|
||||
rect->fRight = SkScalarMul(rect->fRight, SkFloatToScalar(xScale));
|
||||
rect->fBottom = SkScalarMul(rect->fBottom, SkFloatToScalar(yScale));
|
||||
rect->fLeft = SkScalarMul(rect->fLeft, xScale);
|
||||
rect->fTop = SkScalarMul(rect->fTop, yScale);
|
||||
rect->fRight = SkScalarMul(rect->fRight, xScale);
|
||||
rect->fBottom = SkScalarMul(rect->fBottom, yScale);
|
||||
}
|
||||
|
||||
static float adjust_sigma(float sigma, int *scaleFactor, int *radius) {
|
||||
|
@ -30,8 +30,8 @@ namespace {
|
||||
|
||||
const SkScalar gOneThird = SkScalarInvert(SkIntToScalar(3));
|
||||
const SkScalar gTwoThirds = SkScalarDiv(SkIntToScalar(2), SkIntToScalar(3));
|
||||
const SkScalar gOneHalf = SkFloatToScalar(0.5f);
|
||||
const SkScalar gOneQuarter = SkFloatToScalar(0.25f);
|
||||
const SkScalar gOneHalf = 0.5f;
|
||||
const SkScalar gOneQuarter = 0.25f;
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
void setUniformPoint3(const GrGLUniformManager& uman, UniformHandle uni, const SkPoint3& point) {
|
||||
@ -675,7 +675,7 @@ public:
|
||||
fS = target - location;
|
||||
fS.normalize();
|
||||
fCosOuterConeAngle = SkScalarCos(SkDegreesToRadians(cutoffAngle));
|
||||
const SkScalar antiAliasThreshold = SkFloatToScalar(0.016f);
|
||||
const SkScalar antiAliasThreshold = 0.016f;
|
||||
fCosInnerConeAngle = fCosOuterConeAngle + antiAliasThreshold;
|
||||
fConeScale = SkScalarInvert(antiAliasThreshold);
|
||||
}
|
||||
@ -791,8 +791,8 @@ private:
|
||||
|
||||
// According to the spec, the specular term should be in the range [1, 128] :
|
||||
// http://www.w3.org/TR/SVG/filters.html#feSpecularLightingSpecularExponentAttribute
|
||||
const SkScalar SkSpotLight::kSpecularExponentMin = SkFloatToScalar(1.0f);
|
||||
const SkScalar SkSpotLight::kSpecularExponentMax = SkFloatToScalar(128.0f);
|
||||
const SkScalar SkSpotLight::kSpecularExponentMin = 1.0f;
|
||||
const SkScalar SkSpotLight::kSpecularExponentMax = 128.0f;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -45,7 +45,7 @@ inline int checkNoise(int noiseValue, int limitValue, int newValue) {
|
||||
}
|
||||
|
||||
inline SkScalar smoothCurve(SkScalar t) {
|
||||
static const SkScalar SK_Scalar3 = SkFloatToScalar(3.0f);
|
||||
static const SkScalar SK_Scalar3 = 3.0f;
|
||||
|
||||
// returns t * t * (3 - 2 * t)
|
||||
return SkScalarMul(SkScalarSquare(t), SK_Scalar3 - 2 * t);
|
||||
@ -165,7 +165,7 @@ public:
|
||||
}
|
||||
|
||||
// Half of the largest possible value for 16 bit unsigned int
|
||||
static const SkScalar gHalfMax16bits = SkFloatToScalar(32767.5f);
|
||||
static const SkScalar gHalfMax16bits = 32767.5f;
|
||||
|
||||
// Compute gradients from permutated noise data
|
||||
for (int channel = 0; channel < 4; ++channel) {
|
||||
@ -729,10 +729,10 @@ GrEffectRef* GrPerlinNoiseEffect::TestCreate(SkRandom* random,
|
||||
bool stitchTiles = random->nextBool();
|
||||
SkScalar seed = SkIntToScalar(random->nextU());
|
||||
SkISize tileSize = SkISize::Make(random->nextRangeU(4, 4096), random->nextRangeU(4, 4096));
|
||||
SkScalar baseFrequencyX = random->nextRangeScalar(SkFloatToScalar(0.01f),
|
||||
SkFloatToScalar(0.99f));
|
||||
SkScalar baseFrequencyY = random->nextRangeScalar(SkFloatToScalar(0.01f),
|
||||
SkFloatToScalar(0.99f));
|
||||
SkScalar baseFrequencyX = random->nextRangeScalar(0.01f,
|
||||
0.99f);
|
||||
SkScalar baseFrequencyY = random->nextRangeScalar(0.01f,
|
||||
0.99f);
|
||||
|
||||
SkShader* shader = random->nextBool() ?
|
||||
SkPerlinNoiseShader::CreateFractalNoise(baseFrequencyX, baseFrequencyY, numOctaves, seed,
|
||||
|
@ -762,7 +762,7 @@ bool GrAAHairLinePathRenderer::createLineGeom(const SkPath& path,
|
||||
add_line(&lines[2*i], toSrc, drawState->getCoverageColor(), &verts);
|
||||
}
|
||||
// All the verts computed by add_line are within sqrt(1^2 + 0.5^2) of the end points.
|
||||
static const SkScalar kSqrtOfOneAndAQuarter = SkFloatToScalar(1.118f);
|
||||
static const SkScalar kSqrtOfOneAndAQuarter = 1.118f;
|
||||
// Add a little extra to account for vector normalization precision.
|
||||
static const SkScalar kOutset = kSqrtOfOneAndAQuarter + SK_Scalar1 / 20;
|
||||
devBounds->outset(kOutset, kOutset);
|
||||
|
@ -33,8 +33,8 @@ const SkMatrix& TestMatrix(SkRandom* random) {
|
||||
gMatrices[3].postTranslate(SkIntToScalar(66), SkIntToScalar(-33));
|
||||
gMatrices[3].postScale(SkIntToScalar(2), SK_ScalarHalf);
|
||||
gMatrices[4].setRotate(SkIntToScalar(215));
|
||||
gMatrices[4].set(SkMatrix::kMPersp0, SkFloatToScalar(0.00013f));
|
||||
gMatrices[4].set(SkMatrix::kMPersp1, SkFloatToScalar(-0.000039f));
|
||||
gMatrices[4].set(SkMatrix::kMPersp0, 0.00013f);
|
||||
gMatrices[4].set(SkMatrix::kMPersp1, -0.000039f);
|
||||
gOnce = true;
|
||||
}
|
||||
return gMatrices[random->nextULessThan(static_cast<uint32_t>(SK_ARRAY_COUNT(gMatrices)))];
|
||||
|
@ -34,7 +34,7 @@ SkScalar GrPathUtils::scaleToleranceToSrc(SkScalar devTol,
|
||||
}
|
||||
|
||||
static const int MAX_POINTS_PER_CURVE = 1 << 10;
|
||||
static const SkScalar gMinCurveTol = SkFloatToScalar(0.0001f);
|
||||
static const SkScalar gMinCurveTol = 0.0001f;
|
||||
|
||||
uint32_t GrPathUtils::quadraticPointCount(const GrPoint points[],
|
||||
SkScalar tol) {
|
||||
@ -250,7 +250,7 @@ void GrPathUtils::QuadUVMatrix::set(const GrPoint qPts[3]) {
|
||||
m.postConcat(UVpts);
|
||||
|
||||
// The matrix should not have perspective.
|
||||
SkDEBUGCODE(static const SkScalar gTOL = SkFloatToScalar(1.f / 100.f));
|
||||
SkDEBUGCODE(static const SkScalar gTOL = 1.f / 100.f);
|
||||
SkASSERT(SkScalarAbs(m.get(SkMatrix::kMPersp0)) < gTOL);
|
||||
SkASSERT(SkScalarAbs(m.get(SkMatrix::kMPersp1)) < gTOL);
|
||||
|
||||
|
@ -45,7 +45,7 @@
|
||||
// This constant represents the screen alignment criterion in texels for
|
||||
// requiring texture domain clamping to prevent color bleeding when drawing
|
||||
// a sub region of a larger source image.
|
||||
#define COLOR_BLEED_TOLERANCE SkFloatToScalar(0.001f)
|
||||
#define COLOR_BLEED_TOLERANCE 0.001f
|
||||
|
||||
#define DO_DEFERRED_CLEAR() \
|
||||
do { \
|
||||
|
@ -745,7 +745,7 @@ SkPDFDevice::SkPDFDevice(const SkISize& pageSize, const SkISize& contentSize,
|
||||
fLastMarginContentEntry(NULL),
|
||||
fClipStack(NULL),
|
||||
fEncoder(NULL),
|
||||
fRasterDpi(SkFloatToScalar(72.0f)) {
|
||||
fRasterDpi(72.0f) {
|
||||
// Just report that PDF does not supports perspective in the
|
||||
// initial transform.
|
||||
NOT_IMPLEMENTED(initialTransform.hasPerspective(), true);
|
||||
@ -776,7 +776,7 @@ SkPDFDevice::SkPDFDevice(const SkISize& layerSize,
|
||||
fLastMarginContentEntry(NULL),
|
||||
fClipStack(NULL),
|
||||
fEncoder(NULL),
|
||||
fRasterDpi(SkFloatToScalar(72.0f)) {
|
||||
fRasterDpi(72.0f) {
|
||||
fInitialTransform.reset();
|
||||
this->init();
|
||||
}
|
||||
|
@ -556,9 +556,9 @@ SkPDFImage::SkPDFImage(SkStream* stream,
|
||||
SkASSERT(!isAlpha);
|
||||
SkAutoTUnref<SkPDFInt> zeroVal(new SkPDFInt(0));
|
||||
SkAutoTUnref<SkPDFScalar> scale5Val(
|
||||
new SkPDFScalar(SkFloatToScalar(8.2258f))); // 255/2^5-1
|
||||
new SkPDFScalar(8.2258f)); // 255/2^5-1
|
||||
SkAutoTUnref<SkPDFScalar> scale6Val(
|
||||
new SkPDFScalar(SkFloatToScalar(4.0476f))); // 255/2^6-1
|
||||
new SkPDFScalar(4.0476f)); // 255/2^6-1
|
||||
SkAutoTUnref<SkPDFArray> decodeValue(new SkPDFArray());
|
||||
decodeValue->reserve(6);
|
||||
decodeValue->append(zeroVal.get());
|
||||
|
@ -273,7 +273,7 @@ static CGFloat ScalarToCG(SkScalar scalar) {
|
||||
|
||||
static SkScalar CGToScalar(CGFloat cgFloat) {
|
||||
if (sizeof(CGFloat) == sizeof(float)) {
|
||||
return SkFloatToScalar(cgFloat);
|
||||
return cgFloat;
|
||||
} else {
|
||||
SkASSERT(sizeof(CGFloat) == sizeof(double));
|
||||
return SkDoubleToScalar(cgFloat);
|
||||
@ -1075,7 +1075,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 = SkScalarRoundToInt(SkFloatToScalar(x * 255));
|
||||
int xx = SkScalarRoundToInt(x * 255);
|
||||
table[i] = SkToU8(xx);
|
||||
}
|
||||
}
|
||||
@ -1325,7 +1325,7 @@ void SkScalerContext_Mac::generatePath(const SkGlyph& glyph, SkPath* path) {
|
||||
fRec.getSingleMatrix(&m);
|
||||
|
||||
// start out by assuming that we want no hining in X and Y
|
||||
scaleX = scaleY = SkFloatToScalar(kScaleForSubPixelPositionHinting);
|
||||
scaleX = scaleY = kScaleForSubPixelPositionHinting;
|
||||
// now see if we need to restore hinting for axis-aligned baselines
|
||||
switch (SkComputeAxisAlignmentForHText(m)) {
|
||||
case kX_SkAxisAlignment:
|
||||
|
@ -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(SkFloatToScalar(x * 255));
|
||||
int xx = SkScalarRound(x * 255);
|
||||
table[i] = SkToU8(xx);
|
||||
}
|
||||
}
|
||||
|
@ -1378,10 +1378,10 @@ void DWriteFontTypeface::onFilterRec(SkScalerContext::Rec* rec) const {
|
||||
SkTScopedComPtr<IDWriteRenderingParams> defaultRenderingParams;
|
||||
if (SUCCEEDED(factory->CreateRenderingParams(&defaultRenderingParams))) {
|
||||
float gamma = defaultRenderingParams->GetGamma();
|
||||
rec->setDeviceGamma(SkFloatToScalar(gamma));
|
||||
rec->setPaintGamma(SkFloatToScalar(gamma));
|
||||
rec->setDeviceGamma(gamma);
|
||||
rec->setPaintGamma(gamma);
|
||||
|
||||
rec->setContrast(SkFloatToScalar(defaultRenderingParams->GetEnhancedContrast()));
|
||||
rec->setContrast(defaultRenderingParams->GetEnhancedContrast());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -365,23 +365,23 @@ void Sk3DView::restore() {
|
||||
#ifdef SK_BUILD_FOR_ANDROID
|
||||
void Sk3DView::setCameraLocation(SkScalar x, SkScalar y, SkScalar z) {
|
||||
// the camera location is passed in inches, set in pt
|
||||
SkScalar lz = z * SkFloatToScalar(72.0f);
|
||||
fCamera.fLocation.set(x * SkFloatToScalar(72.0f), y * SkFloatToScalar(72.0f), lz);
|
||||
SkScalar lz = z * 72.0f;
|
||||
fCamera.fLocation.set(x * 72.0f, y * 72.0f, lz);
|
||||
fCamera.fObserver.set(0, 0, lz);
|
||||
fCamera.update();
|
||||
|
||||
}
|
||||
|
||||
SkScalar Sk3DView::getCameraLocationX() {
|
||||
return fCamera.fLocation.fX / SkFloatToScalar(72.0f);
|
||||
return fCamera.fLocation.fX / 72.0f;
|
||||
}
|
||||
|
||||
SkScalar Sk3DView::getCameraLocationY() {
|
||||
return fCamera.fLocation.fY / SkFloatToScalar(72.0f);
|
||||
return fCamera.fLocation.fY / 72.0f;
|
||||
}
|
||||
|
||||
SkScalar Sk3DView::getCameraLocationZ() {
|
||||
return fCamera.fLocation.fZ / SkFloatToScalar(72.0f);
|
||||
return fCamera.fLocation.fZ / 72.0f;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -55,7 +55,7 @@ static void Line2path_pixelCircle(SkPath* path, const char* line,
|
||||
if (GetBit(line,i)) {
|
||||
path->addCircle(i + SK_ScalarHalf,
|
||||
lineIdx + SK_ScalarHalf,
|
||||
SkFloatToScalar(SQRT_2 / 2.0f));
|
||||
SQRT_2 / 2.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ void STDMETHODCALLTYPE SkDWriteGeometrySink::SetSegmentFlags(D2D1_PATH_SEGMENT v
|
||||
}
|
||||
|
||||
void STDMETHODCALLTYPE SkDWriteGeometrySink::BeginFigure(D2D1_POINT_2F startPoint, D2D1_FIGURE_BEGIN figureBegin) {
|
||||
fPath->moveTo(SkFloatToScalar(startPoint.x), SkFloatToScalar(startPoint.y));
|
||||
fPath->moveTo(startPoint.x, startPoint.y);
|
||||
if (figureBegin == D2D1_FIGURE_BEGIN_HOLLOW) {
|
||||
SkDEBUGFAIL("Invalid D2D1_FIGURE_BEGIN value.");
|
||||
}
|
||||
@ -73,7 +73,7 @@ void STDMETHODCALLTYPE SkDWriteGeometrySink::BeginFigure(D2D1_POINT_2F startPoin
|
||||
|
||||
void STDMETHODCALLTYPE SkDWriteGeometrySink::AddLines(const D2D1_POINT_2F *points, UINT pointsCount) {
|
||||
for (const D2D1_POINT_2F *end = &points[pointsCount]; points < end; ++points) {
|
||||
fPath->lineTo(SkFloatToScalar(points->x), SkFloatToScalar(points->y));
|
||||
fPath->lineTo(points->x, points->y);
|
||||
}
|
||||
}
|
||||
|
||||
@ -121,12 +121,12 @@ void STDMETHODCALLTYPE SkDWriteGeometrySink::AddBeziers(const D2D1_BEZIER_SEGMEN
|
||||
{ beziers->point3.x, beziers->point3.y }, };
|
||||
Quadratic quadratic;
|
||||
if (check_quadratic(cubic, quadratic)) {
|
||||
fPath->quadTo(SkFloatToScalar(quadratic[1].x), SkFloatToScalar(quadratic[1].y),
|
||||
SkFloatToScalar(quadratic[2].x), SkFloatToScalar(quadratic[2].y));
|
||||
fPath->quadTo(quadratic[1].x, quadratic[1].y,
|
||||
quadratic[2].x, quadratic[2].y);
|
||||
} else {
|
||||
fPath->cubicTo(SkFloatToScalar(beziers->point1.x), SkFloatToScalar(beziers->point1.y),
|
||||
SkFloatToScalar(beziers->point2.x), SkFloatToScalar(beziers->point2.y),
|
||||
SkFloatToScalar(beziers->point3.x), SkFloatToScalar(beziers->point3.y));
|
||||
fPath->cubicTo(beziers->point1.x, beziers->point1.y,
|
||||
beziers->point2.x, beziers->point2.y,
|
||||
beziers->point3.x, beziers->point3.y);
|
||||
}
|
||||
prevPt = beziers->point3;
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ static void unit_axis_align(SkVector* unit) {
|
||||
|
||||
void SkFlingState::reset(float sx, float sy) {
|
||||
fActive = true;
|
||||
fDirection.set(SkFloatToScalar(sx), SkFloatToScalar(sy));
|
||||
fDirection.set(sx, sy);
|
||||
fSpeed0 = SkPoint::Normalize(&fDirection);
|
||||
fSpeed0 = pin_max_fling(fSpeed0);
|
||||
fTime0 = getseconds();
|
||||
@ -82,7 +82,7 @@ bool SkFlingState::evaluateMatrix(SkMatrix* matrix) {
|
||||
tx = (float)sk_float_round2int(tx);
|
||||
ty = (float)sk_float_round2int(ty);
|
||||
}
|
||||
matrix->setTranslate(SkFloatToScalar(tx), SkFloatToScalar(ty));
|
||||
matrix->setTranslate(tx, ty);
|
||||
// printf("---- evaluate (%g %g)\n", tx, ty);
|
||||
|
||||
return true;
|
||||
@ -182,7 +182,7 @@ int SkTouchGesture::findRec(void* owner) const {
|
||||
}
|
||||
|
||||
static SkScalar center(float pos0, float pos1) {
|
||||
return SkFloatToScalar((pos0 + pos1) * 0.5f);
|
||||
return (pos0 + pos1) * 0.5f;
|
||||
}
|
||||
|
||||
static const float MAX_ZOOM_SCALE = 4;
|
||||
|
@ -386,10 +386,10 @@ static void test_regressions() {
|
||||
{
|
||||
SkAAClip clip;
|
||||
SkRect r;
|
||||
r.fLeft = SkFloatToScalar(129.892181f);
|
||||
r.fTop = SkFloatToScalar(10.3999996f);
|
||||
r.fRight = SkFloatToScalar(130.892181f);
|
||||
r.fBottom = SkFloatToScalar(20.3999996f);
|
||||
r.fLeft = 129.892181f;
|
||||
r.fTop = 10.3999996f;
|
||||
r.fRight = 130.892181f;
|
||||
r.fBottom = 20.3999996f;
|
||||
clip.setRect(r, true);
|
||||
}
|
||||
}
|
||||
|
@ -349,7 +349,7 @@ static void test_sigma_range(skiatest::Reporter* reporter, GrContextFactory* fac
|
||||
int groundTruthResult[kSize];
|
||||
int bruteForce1DResult[kSize];
|
||||
|
||||
SkScalar sigma = SkFloatToScalar(10.0f);
|
||||
SkScalar sigma = 10.0f;
|
||||
|
||||
for (int i = 0; i < 4; ++i, sigma /= 10) {
|
||||
|
||||
|
@ -44,8 +44,8 @@ static bool CurvesAreEqual(const SkPoint c0[4],
|
||||
const SkPoint c1[4],
|
||||
float tol) {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
if (SkScalarAbs(c0[i].fX - c1[i].fX) > SkFloatToScalar(tol) ||
|
||||
SkScalarAbs(c0[i].fY - c1[i].fY) > SkFloatToScalar(tol)
|
||||
if (SkScalarAbs(c0[i].fX - c1[i].fX) > tol ||
|
||||
SkScalarAbs(c0[i].fY - c1[i].fY) > tol
|
||||
) {
|
||||
PrintCurve("c0", c0);
|
||||
PrintCurve("c1", c1);
|
||||
@ -61,10 +61,10 @@ static SkPoint* SetCurve(float x0, float y0,
|
||||
float x2, float y2,
|
||||
float x3, float y3,
|
||||
SkPoint crv[4]) {
|
||||
crv[0].fX = SkFloatToScalar(x0); crv[0].fY = SkFloatToScalar(y0);
|
||||
crv[1].fX = SkFloatToScalar(x1); crv[1].fY = SkFloatToScalar(y1);
|
||||
crv[2].fX = SkFloatToScalar(x2); crv[2].fY = SkFloatToScalar(y2);
|
||||
crv[3].fX = SkFloatToScalar(x3); crv[3].fY = SkFloatToScalar(y3);
|
||||
crv[0].fX = x0; crv[0].fY = y0;
|
||||
crv[1].fX = x1; crv[1].fY = y1;
|
||||
crv[2].fX = x2; crv[2].fY = y2;
|
||||
crv[3].fX = x3; crv[3].fY = y3;
|
||||
return crv;
|
||||
}
|
||||
|
||||
@ -81,7 +81,7 @@ static void TestCubicClipping(skiatest::Reporter* reporter) {
|
||||
SkPoint clipped[4], shouldbe[4];
|
||||
SkIRect clipRect;
|
||||
bool success;
|
||||
const float tol = SkFloatToScalar(1e-4f);
|
||||
const float tol = 1e-4f;
|
||||
|
||||
// Test no clip, with plenty of room.
|
||||
clipRect.set(-2, -2, 6, 14);
|
||||
|
@ -22,8 +22,8 @@ static void test_hairclipping(skiatest::Reporter* reporter) {
|
||||
|
||||
SkCanvas canvas(bm);
|
||||
canvas.clipRect(SkRect::MakeWH(SkIntToScalar(4), SkIntToScalar(2)));
|
||||
canvas.drawLine(SkFloatToScalar(1.5f), SkFloatToScalar(1.5f),
|
||||
SkFloatToScalar(3.5f), SkFloatToScalar(3.5f), paint);
|
||||
canvas.drawLine(1.5f, 1.5f,
|
||||
3.5f, 3.5f, paint);
|
||||
|
||||
/**
|
||||
* We had a bug where we misinterpreted the bottom of the clip, and
|
||||
@ -52,10 +52,10 @@ static void test_edgeclipper() {
|
||||
SkEdgeClipper clipper;
|
||||
|
||||
const SkPoint pts[] = {
|
||||
{ SkFloatToScalar(3.0995476e+010f), SkFloatToScalar(42.929779f) },
|
||||
{ SkFloatToScalar(-3.0995163e+010f), SkFloatToScalar(51.050385f) },
|
||||
{ SkFloatToScalar(-3.0995157e+010f), SkFloatToScalar(51.050392f) },
|
||||
{ SkFloatToScalar(-3.0995134e+010f), SkFloatToScalar(51.050400f) },
|
||||
{ 3.0995476e+010f, 42.929779f },
|
||||
{ -3.0995163e+010f, 51.050385f },
|
||||
{ -3.0995157e+010f, 51.050392f },
|
||||
{ -3.0995134e+010f, 51.050400f },
|
||||
};
|
||||
|
||||
const SkRect clip = { 0, 0, SkIntToScalar(300), SkIntToScalar(200) };
|
||||
|
@ -120,13 +120,13 @@ static void test_treatAsSprite(skiatest::Reporter* reporter) {
|
||||
|
||||
size.set(500, 600);
|
||||
|
||||
const SkScalar tooMuchSubpixel = SkFloatToScalar(100.1f);
|
||||
const SkScalar tooMuchSubpixel = 100.1f;
|
||||
mat.setTranslate(tooMuchSubpixel, 0);
|
||||
REPORTER_ASSERT(reporter, !treat_as_sprite(mat, size, bilerBits));
|
||||
mat.setTranslate(0, tooMuchSubpixel);
|
||||
REPORTER_ASSERT(reporter, !treat_as_sprite(mat, size, bilerBits));
|
||||
|
||||
const SkScalar tinySubPixel = SkFloatToScalar(100.02f);
|
||||
const SkScalar tinySubPixel = 100.02f;
|
||||
mat.setTranslate(tinySubPixel, 0);
|
||||
REPORTER_ASSERT(reporter, treat_as_sprite(mat, size, bilerBits));
|
||||
mat.setTranslate(0, tinySubPixel);
|
||||
@ -181,12 +181,12 @@ static void test_wacky_bitmapshader(skiatest::Reporter* reporter,
|
||||
SkMatrix matrix;
|
||||
|
||||
SkCanvas c(dev);
|
||||
matrix.setAll(SkFloatToScalar(-119.34097f),
|
||||
SkFloatToScalar(-43.436558f),
|
||||
SkFloatToScalar(93489.945f),
|
||||
SkFloatToScalar(43.436558f),
|
||||
SkFloatToScalar(-119.34097f),
|
||||
SkFloatToScalar(123.98426f),
|
||||
matrix.setAll(-119.34097f,
|
||||
-43.436558f,
|
||||
93489.945f,
|
||||
43.436558f,
|
||||
-119.34097f,
|
||||
123.98426f,
|
||||
0, 0, SK_Scalar1);
|
||||
c.concat(matrix);
|
||||
|
||||
@ -197,11 +197,11 @@ static void test_wacky_bitmapshader(skiatest::Reporter* reporter,
|
||||
|
||||
SkShader* s = SkShader::CreateBitmapShader(bm, SkShader::kRepeat_TileMode,
|
||||
SkShader::kRepeat_TileMode);
|
||||
matrix.setAll(SkFloatToScalar(0.0078740157f),
|
||||
matrix.setAll(0.0078740157f,
|
||||
0,
|
||||
SkIntToScalar(249),
|
||||
0,
|
||||
SkFloatToScalar(0.0078740157f),
|
||||
0.0078740157f,
|
||||
SkIntToScalar(239),
|
||||
0, 0, SK_Scalar1);
|
||||
s->setLocalMatrix(matrix);
|
||||
|
@ -80,8 +80,8 @@ static void test_drawText(skiatest::Reporter* reporter) {
|
||||
|
||||
for (float offsetY = 0.0f; offsetY < 1.0f; offsetY += (1.0f / 16.0f)) {
|
||||
for (float offsetX = 0.0f; offsetX < 1.0f; offsetX += (1.0f / 16.0f)) {
|
||||
SkPoint point = SkPoint::Make(SkFloatToScalar(25.0f + offsetX),
|
||||
SkFloatToScalar(25.0f + offsetY));
|
||||
SkPoint point = SkPoint::Make(25.0f + offsetX,
|
||||
25.0f + offsetY);
|
||||
|
||||
for (int align = 0; align < SkPaint::kAlignCount; ++align) {
|
||||
paint.setTextAlign(static_cast<SkPaint::Align>(align));
|
||||
|
@ -58,7 +58,7 @@ public:
|
||||
}
|
||||
|
||||
static SkImageFilter* make_scale(float amount, SkImageFilter* input = NULL) {
|
||||
SkScalar s = SkFloatToScalar(amount);
|
||||
SkScalar s = amount;
|
||||
SkScalar matrix[20] = { s, 0, 0, 0, 0,
|
||||
0, s, 0, 0, 0,
|
||||
0, 0, s, 0, 0,
|
||||
@ -70,10 +70,10 @@ public:
|
||||
static SkImageFilter* make_grayscale(SkImageFilter* input = NULL, const SkImageFilter::CropRect* cropRect = NULL) {
|
||||
SkScalar matrix[20];
|
||||
memset(matrix, 0, 20 * sizeof(SkScalar));
|
||||
matrix[0] = matrix[5] = matrix[10] = SkFloatToScalar(0.2126f);
|
||||
matrix[1] = matrix[6] = matrix[11] = SkFloatToScalar(0.7152f);
|
||||
matrix[2] = matrix[7] = matrix[12] = SkFloatToScalar(0.0722f);
|
||||
matrix[18] = SkFloatToScalar(1.0f);
|
||||
matrix[0] = matrix[5] = matrix[10] = 0.2126f;
|
||||
matrix[1] = matrix[6] = matrix[11] = 0.7152f;
|
||||
matrix[2] = matrix[7] = matrix[12] = 0.0722f;
|
||||
matrix[18] = 1.0f;
|
||||
SkAutoTUnref<SkColorFilter> filter(new SkColorMatrixFilter(matrix));
|
||||
return SkColorFilterImageFilter::Create(filter, input, cropRect);
|
||||
}
|
||||
@ -128,12 +128,12 @@ public:
|
||||
// 2 ) location and target at same value
|
||||
SkPoint3 target(location.fX, location.fY, location.fZ);
|
||||
// 3 ) large negative specular exponent value
|
||||
SkScalar specularExponent = SkFloatToScalar(-1000);
|
||||
SkScalar specularExponent = -1000;
|
||||
|
||||
SkAutoTUnref<SkImageFilter> bmSrc(new SkBitmapSource(bitmap));
|
||||
SkPaint paint;
|
||||
paint.setImageFilter(SkLightingImageFilter::CreateSpotLitSpecular(
|
||||
location, target, specularExponent, SkFloatToScalar(180),
|
||||
location, target, specularExponent, 180,
|
||||
0xFFFFFFFF, SK_Scalar1, SK_Scalar1, SK_Scalar1,
|
||||
bmSrc))->unref();
|
||||
SkCanvas canvas(result);
|
||||
@ -144,7 +144,7 @@ public:
|
||||
|
||||
{
|
||||
// This tests for scale bringing width to 0
|
||||
SkSize scale = SkSize::Make(SkFloatToScalar(-0.001f), SK_Scalar1);
|
||||
SkSize scale = SkSize::Make(-0.001f, SK_Scalar1);
|
||||
SkAutoTUnref<SkImageFilter> bmSrc(new SkBitmapSource(bitmap));
|
||||
SkAutoTUnref<SkBicubicImageFilter> bicubic(
|
||||
SkBicubicImageFilter::CreateMitchell(scale, bmSrc));
|
||||
|
@ -42,7 +42,7 @@ static void test_frontToBack(skiatest::Reporter* reporter) {
|
||||
(void)looper->addLayer(layerInfo);
|
||||
|
||||
// Add the back layer, with some layer info set.
|
||||
layerInfo.fOffset.set(SkFloatToScalar(10.0f), SkFloatToScalar(20.0f));
|
||||
layerInfo.fOffset.set(10.0f, 20.0f);
|
||||
layerInfo.fPaintBits |= SkLayerDrawLooper::kXfermode_Bit;
|
||||
SkPaint* layerPaint = looper->addLayer(layerInfo);
|
||||
layerPaint->setXfermodeMode(SkXfermode::kSrc_Mode);
|
||||
@ -55,17 +55,17 @@ static void test_frontToBack(skiatest::Reporter* reporter) {
|
||||
// The back layer should come first.
|
||||
REPORTER_ASSERT(reporter, looper->next(&canvas, &paint));
|
||||
REPORTER_ASSERT(reporter, SkXfermode::IsMode(paint.getXfermode(), SkXfermode::kSrc_Mode));
|
||||
canvas.drawRect(SkRect::MakeWH(SkFloatToScalar(50.0f), SkFloatToScalar(50.0f)), paint);
|
||||
REPORTER_ASSERT(reporter, SkFloatToScalar(10.0f) == device.fLastMatrix.getTranslateX());
|
||||
REPORTER_ASSERT(reporter, SkFloatToScalar(20.0f) == device.fLastMatrix.getTranslateY());
|
||||
canvas.drawRect(SkRect::MakeWH(50.0f, 50.0f), paint);
|
||||
REPORTER_ASSERT(reporter, 10.0f == device.fLastMatrix.getTranslateX());
|
||||
REPORTER_ASSERT(reporter, 20.0f == device.fLastMatrix.getTranslateY());
|
||||
paint.reset();
|
||||
|
||||
// Then the front layer.
|
||||
REPORTER_ASSERT(reporter, looper->next(&canvas, &paint));
|
||||
REPORTER_ASSERT(reporter, SkXfermode::IsMode(paint.getXfermode(), SkXfermode::kSrcOver_Mode));
|
||||
canvas.drawRect(SkRect::MakeWH(SkFloatToScalar(50.0f), SkFloatToScalar(50.0f)), paint);
|
||||
REPORTER_ASSERT(reporter, SkFloatToScalar(0.0f) == device.fLastMatrix.getTranslateX());
|
||||
REPORTER_ASSERT(reporter, SkFloatToScalar(0.0f) == device.fLastMatrix.getTranslateY());
|
||||
canvas.drawRect(SkRect::MakeWH(50.0f, 50.0f), paint);
|
||||
REPORTER_ASSERT(reporter, 0.0f == device.fLastMatrix.getTranslateX());
|
||||
REPORTER_ASSERT(reporter, 0.0f == device.fLastMatrix.getTranslateY());
|
||||
|
||||
// Only two layers were added, so that should be the end.
|
||||
REPORTER_ASSERT(reporter, !looper->next(&canvas, &paint));
|
||||
@ -79,7 +79,7 @@ static void test_backToFront(skiatest::Reporter* reporter) {
|
||||
(void)looper->addLayerOnTop(layerInfo);
|
||||
|
||||
// Add the front layer, with some layer info set.
|
||||
layerInfo.fOffset.set(SkFloatToScalar(10.0f), SkFloatToScalar(20.0f));
|
||||
layerInfo.fOffset.set(10.0f, 20.0f);
|
||||
layerInfo.fPaintBits |= SkLayerDrawLooper::kXfermode_Bit;
|
||||
SkPaint* layerPaint = looper->addLayerOnTop(layerInfo);
|
||||
layerPaint->setXfermodeMode(SkXfermode::kSrc_Mode);
|
||||
@ -92,17 +92,17 @@ static void test_backToFront(skiatest::Reporter* reporter) {
|
||||
// The back layer should come first.
|
||||
REPORTER_ASSERT(reporter, looper->next(&canvas, &paint));
|
||||
REPORTER_ASSERT(reporter, SkXfermode::IsMode(paint.getXfermode(), SkXfermode::kSrcOver_Mode));
|
||||
canvas.drawRect(SkRect::MakeWH(SkFloatToScalar(50.0f), SkFloatToScalar(50.0f)), paint);
|
||||
REPORTER_ASSERT(reporter, SkFloatToScalar(0.0f) == device.fLastMatrix.getTranslateX());
|
||||
REPORTER_ASSERT(reporter, SkFloatToScalar(0.0f) == device.fLastMatrix.getTranslateY());
|
||||
canvas.drawRect(SkRect::MakeWH(50.0f, 50.0f), paint);
|
||||
REPORTER_ASSERT(reporter, 0.0f == device.fLastMatrix.getTranslateX());
|
||||
REPORTER_ASSERT(reporter, 0.0f == device.fLastMatrix.getTranslateY());
|
||||
paint.reset();
|
||||
|
||||
// Then the front layer.
|
||||
REPORTER_ASSERT(reporter, looper->next(&canvas, &paint));
|
||||
REPORTER_ASSERT(reporter, SkXfermode::IsMode(paint.getXfermode(), SkXfermode::kSrc_Mode));
|
||||
canvas.drawRect(SkRect::MakeWH(SkFloatToScalar(50.0f), SkFloatToScalar(50.0f)), paint);
|
||||
REPORTER_ASSERT(reporter, SkFloatToScalar(10.0f) == device.fLastMatrix.getTranslateX());
|
||||
REPORTER_ASSERT(reporter, SkFloatToScalar(20.0f) == device.fLastMatrix.getTranslateY());
|
||||
canvas.drawRect(SkRect::MakeWH(50.0f, 50.0f), paint);
|
||||
REPORTER_ASSERT(reporter, 10.0f == device.fLastMatrix.getTranslateX());
|
||||
REPORTER_ASSERT(reporter, 20.0f == device.fLastMatrix.getTranslateY());
|
||||
|
||||
// Only two layers were added, so that should be the end.
|
||||
REPORTER_ASSERT(reporter, !looper->next(&canvas, &paint));
|
||||
@ -116,7 +116,7 @@ static void test_mixed(skiatest::Reporter* reporter) {
|
||||
(void)looper->addLayer(layerInfo);
|
||||
|
||||
// Add the front layer, with some layer info set.
|
||||
layerInfo.fOffset.set(SkFloatToScalar(10.0f), SkFloatToScalar(20.0f));
|
||||
layerInfo.fOffset.set(10.0f, 20.0f);
|
||||
layerInfo.fPaintBits |= SkLayerDrawLooper::kXfermode_Bit;
|
||||
SkPaint* layerPaint = looper->addLayerOnTop(layerInfo);
|
||||
layerPaint->setXfermodeMode(SkXfermode::kSrc_Mode);
|
||||
@ -129,17 +129,17 @@ static void test_mixed(skiatest::Reporter* reporter) {
|
||||
// The back layer should come first.
|
||||
REPORTER_ASSERT(reporter, looper->next(&canvas, &paint));
|
||||
REPORTER_ASSERT(reporter, SkXfermode::IsMode(paint.getXfermode(), SkXfermode::kSrcOver_Mode));
|
||||
canvas.drawRect(SkRect::MakeWH(SkFloatToScalar(50.0f), SkFloatToScalar(50.0f)), paint);
|
||||
REPORTER_ASSERT(reporter, SkFloatToScalar(0.0f) == device.fLastMatrix.getTranslateX());
|
||||
REPORTER_ASSERT(reporter, SkFloatToScalar(0.0f) == device.fLastMatrix.getTranslateY());
|
||||
canvas.drawRect(SkRect::MakeWH(50.0f, 50.0f), paint);
|
||||
REPORTER_ASSERT(reporter, 0.0f == device.fLastMatrix.getTranslateX());
|
||||
REPORTER_ASSERT(reporter, 0.0f == device.fLastMatrix.getTranslateY());
|
||||
paint.reset();
|
||||
|
||||
// Then the front layer.
|
||||
REPORTER_ASSERT(reporter, looper->next(&canvas, &paint));
|
||||
REPORTER_ASSERT(reporter, SkXfermode::IsMode(paint.getXfermode(), SkXfermode::kSrc_Mode));
|
||||
canvas.drawRect(SkRect::MakeWH(SkFloatToScalar(50.0f), SkFloatToScalar(50.0f)), paint);
|
||||
REPORTER_ASSERT(reporter, SkFloatToScalar(10.0f) == device.fLastMatrix.getTranslateX());
|
||||
REPORTER_ASSERT(reporter, SkFloatToScalar(20.0f) == device.fLastMatrix.getTranslateY());
|
||||
canvas.drawRect(SkRect::MakeWH(50.0f, 50.0f), paint);
|
||||
REPORTER_ASSERT(reporter, 10.0f == device.fLastMatrix.getTranslateX());
|
||||
REPORTER_ASSERT(reporter, 20.0f == device.fLastMatrix.getTranslateY());
|
||||
|
||||
// Only two layers were added, so that should be the end.
|
||||
REPORTER_ASSERT(reporter, !looper->next(&canvas, &paint));
|
||||
|
@ -144,7 +144,7 @@ static void test_blend31() {
|
||||
|
||||
float f = float_blend(src, dst, a / 31.f);
|
||||
int r1 = (int)f;
|
||||
int r2 = SkScalarRoundToInt(SkFloatToScalar(f));
|
||||
int r2 = SkScalarRoundToInt(f);
|
||||
|
||||
if (r0 != r1 && r0 != r2) {
|
||||
SkDebugf("src:%d dst:%d a:%d result:%d float:%g\n",
|
||||
@ -168,7 +168,7 @@ static void test_blend(skiatest::Reporter* reporter) {
|
||||
for (int a = 0; a <= 255; a++) {
|
||||
int r0 = SkAlphaBlend255(src, dst, a);
|
||||
float f1 = float_blend(src, dst, a / 255.f);
|
||||
int r1 = SkScalarRoundToInt(SkFloatToScalar(f1));
|
||||
int r1 = SkScalarRoundToInt(f1);
|
||||
|
||||
if (r0 != r1) {
|
||||
float diff = sk_float_abs(f1 - r1);
|
||||
|
@ -193,14 +193,14 @@ static void regression_cubic(skiatest::Reporter* reporter) {
|
||||
SkPath path, stroke;
|
||||
SkPaint paint;
|
||||
|
||||
path.moveTo(SkFloatToScalar(460.2881309415525f),
|
||||
SkFloatToScalar(303.250847066498f));
|
||||
path.cubicTo(SkFloatToScalar(463.36378422175284f),
|
||||
SkFloatToScalar(302.1169735073363f),
|
||||
SkFloatToScalar(456.32239330810046f),
|
||||
SkFloatToScalar(304.720354932878f),
|
||||
SkFloatToScalar(453.15255460013304f),
|
||||
SkFloatToScalar(305.788586869862f));
|
||||
path.moveTo(460.2881309415525f,
|
||||
303.250847066498f);
|
||||
path.cubicTo(463.36378422175284f,
|
||||
302.1169735073363f,
|
||||
456.32239330810046f,
|
||||
304.720354932878f,
|
||||
453.15255460013304f,
|
||||
305.788586869862f);
|
||||
|
||||
SkRect fillR, strokeR;
|
||||
fillR = path.getBounds();
|
||||
@ -225,13 +225,13 @@ static void regression_cubic(skiatest::Reporter* reporter) {
|
||||
static void regression_measureText(skiatest::Reporter* reporter) {
|
||||
|
||||
SkPaint paint;
|
||||
paint.setTextSize(SkFloatToScalar(12.0f));
|
||||
paint.setTextSize(12.0f);
|
||||
|
||||
SkRect r;
|
||||
r.setLTRB(SK_ScalarNaN, SK_ScalarNaN, SK_ScalarNaN, SK_ScalarNaN);
|
||||
|
||||
// test that the rect was reset
|
||||
paint.measureText("", 0, &r, SkFloatToScalar(1.0f));
|
||||
paint.measureText("", 0, &r, 1.0f);
|
||||
REPORTER_ASSERT(reporter, r.isEmpty());
|
||||
}
|
||||
|
||||
|
@ -34,8 +34,8 @@ static struct {
|
||||
{ "", { 0, 0, 0, 0 } },
|
||||
{ "M0,0L10,10", { 0, 0, SkIntToScalar(10), SkIntToScalar(10) } },
|
||||
{ "M-5.5,-0.5 Q 0 0 6,6.50",
|
||||
{ SkFloatToScalar(-5.5f), SkFloatToScalar(-0.5f),
|
||||
SkFloatToScalar(6), SkFloatToScalar(6.5f) } }
|
||||
{ -5.5f, -0.5f,
|
||||
6, 6.5f } }
|
||||
};
|
||||
|
||||
static void TestParsePath(skiatest::Reporter* reporter) {
|
||||
@ -51,13 +51,13 @@ static void TestParsePath(skiatest::Reporter* reporter) {
|
||||
}
|
||||
|
||||
SkRect r;
|
||||
r.set(0, 0, SkFloatToScalar(10), SkFloatToScalar(10.5f));
|
||||
r.set(0, 0, 10, 10.5f);
|
||||
SkPath p;
|
||||
p.addRect(r);
|
||||
test_to_from(reporter, p);
|
||||
p.addOval(r);
|
||||
test_to_from(reporter, p);
|
||||
p.addRoundRect(r, SkFloatToScalar(4), SkFloatToScalar(4.5f));
|
||||
p.addRoundRect(r, 4, 4.5f);
|
||||
test_to_from(reporter, p);
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,7 @@ static void test_small_segment() {
|
||||
const SkPoint pts[] = {
|
||||
{ 100000, 100000},
|
||||
// big jump between these points, makes a big segment
|
||||
{ SkFloatToScalar(1.0005f), SkFloatToScalar(0.9999f) },
|
||||
{ 1.0005f, 0.9999f },
|
||||
// tiny (non-zero) jump between these points
|
||||
{ SK_Scalar1, SK_Scalar1 },
|
||||
};
|
||||
@ -123,7 +123,7 @@ static void TestPathMeasure(skiatest::Reporter* reporter) {
|
||||
REPORTER_ASSERT(reporter,
|
||||
SkScalarNearlyEqual(position.fX,
|
||||
-SK_ScalarHalf,
|
||||
SkFloatToScalar(0.0001f)));
|
||||
0.0001f));
|
||||
REPORTER_ASSERT(reporter, position.fY == 0);
|
||||
REPORTER_ASSERT(reporter, tangent.fX == -SK_Scalar1);
|
||||
REPORTER_ASSERT(reporter, tangent.fY == 0);
|
||||
@ -148,26 +148,26 @@ static void TestPathMeasure(skiatest::Reporter* reporter) {
|
||||
REPORTER_ASSERT(reporter,
|
||||
SkScalarNearlyEqual(position.fX,
|
||||
SK_ScalarHalf,
|
||||
SkFloatToScalar(0.0001f)));
|
||||
0.0001f));
|
||||
REPORTER_ASSERT(reporter, position.fY == 0);
|
||||
REPORTER_ASSERT(reporter, tangent.fX == SK_Scalar1);
|
||||
REPORTER_ASSERT(reporter, tangent.fY == 0);
|
||||
REPORTER_ASSERT(reporter, meas.getPosTan(SkFloatToScalar(2.5f), &position, &tangent));
|
||||
REPORTER_ASSERT(reporter, meas.getPosTan(2.5f, &position, &tangent));
|
||||
REPORTER_ASSERT(reporter,
|
||||
SkScalarNearlyEqual(position.fX, SK_Scalar1, SkFloatToScalar(0.0001f)));
|
||||
SkScalarNearlyEqual(position.fX, SK_Scalar1, 0.0001f));
|
||||
REPORTER_ASSERT(reporter,
|
||||
SkScalarNearlyEqual(position.fY, SkFloatToScalar(1.5f)));
|
||||
SkScalarNearlyEqual(position.fY, 1.5f));
|
||||
REPORTER_ASSERT(reporter, tangent.fX == 0);
|
||||
REPORTER_ASSERT(reporter, tangent.fY == SK_Scalar1);
|
||||
REPORTER_ASSERT(reporter, meas.getPosTan(SkFloatToScalar(4.5f), &position, &tangent));
|
||||
REPORTER_ASSERT(reporter, meas.getPosTan(4.5f, &position, &tangent));
|
||||
REPORTER_ASSERT(reporter,
|
||||
SkScalarNearlyEqual(position.fX,
|
||||
SkFloatToScalar(2.5f),
|
||||
SkFloatToScalar(0.0001f)));
|
||||
2.5f,
|
||||
0.0001f));
|
||||
REPORTER_ASSERT(reporter,
|
||||
SkScalarNearlyEqual(position.fY,
|
||||
SkFloatToScalar(2.0f),
|
||||
SkFloatToScalar(0.0001f)));
|
||||
2.0f,
|
||||
0.0001f));
|
||||
REPORTER_ASSERT(reporter, tangent.fX == SK_Scalar1);
|
||||
REPORTER_ASSERT(reporter, tangent.fY == 0);
|
||||
|
||||
@ -184,7 +184,7 @@ static void TestPathMeasure(skiatest::Reporter* reporter) {
|
||||
REPORTER_ASSERT(reporter,
|
||||
SkScalarNearlyEqual(position.fX,
|
||||
SK_ScalarHalf,
|
||||
SkFloatToScalar(0.0001f)));
|
||||
0.0001f));
|
||||
REPORTER_ASSERT(reporter, position.fY == 0);
|
||||
REPORTER_ASSERT(reporter, tangent.fX == SK_Scalar1);
|
||||
REPORTER_ASSERT(reporter, tangent.fY == 0);
|
||||
@ -194,12 +194,12 @@ static void TestPathMeasure(skiatest::Reporter* reporter) {
|
||||
REPORTER_ASSERT(reporter, meas.getPosTan(SK_ScalarHalf, &position, &tangent));
|
||||
REPORTER_ASSERT(reporter,
|
||||
SkScalarNearlyEqual(position.fX,
|
||||
SkFloatToScalar(1.5f),
|
||||
SkFloatToScalar(0.0001f)));
|
||||
1.5f,
|
||||
0.0001f));
|
||||
REPORTER_ASSERT(reporter,
|
||||
SkScalarNearlyEqual(position.fY,
|
||||
SkFloatToScalar(2.0f),
|
||||
SkFloatToScalar(0.0001f)));
|
||||
2.0f,
|
||||
0.0001f));
|
||||
REPORTER_ASSERT(reporter, tangent.fX == -SK_Scalar1);
|
||||
REPORTER_ASSERT(reporter, tangent.fY == 0);
|
||||
|
||||
|
@ -1151,19 +1151,19 @@ SkPathOp ops[] = {
|
||||
};
|
||||
|
||||
static void rRect1(skiatest::Reporter* reporter) {
|
||||
SkScalar xA = SkFloatToScalar(0.65f);
|
||||
SkScalar xB = SkFloatToScalar(10.65f);
|
||||
SkScalar xC = SkFloatToScalar(20.65f);
|
||||
SkScalar xD = SkFloatToScalar(30.65f);
|
||||
SkScalar xE = SkFloatToScalar(40.65f);
|
||||
SkScalar xF = SkFloatToScalar(50.65f);
|
||||
SkScalar xA = 0.65f;
|
||||
SkScalar xB = 10.65f;
|
||||
SkScalar xC = 20.65f;
|
||||
SkScalar xD = 30.65f;
|
||||
SkScalar xE = 40.65f;
|
||||
SkScalar xF = 50.65f;
|
||||
|
||||
SkScalar yA = SkFloatToScalar(0.65f);
|
||||
SkScalar yB = SkFloatToScalar(10.65f);
|
||||
SkScalar yC = SkFloatToScalar(20.65f);
|
||||
SkScalar yD = SkFloatToScalar(30.65f);
|
||||
SkScalar yE = SkFloatToScalar(40.65f);
|
||||
SkScalar yF = SkFloatToScalar(50.65f);
|
||||
SkScalar yA = 0.65f;
|
||||
SkScalar yB = 10.65f;
|
||||
SkScalar yC = 20.65f;
|
||||
SkScalar yD = 30.65f;
|
||||
SkScalar yE = 40.65f;
|
||||
SkScalar yF = 50.65f;
|
||||
SkPath paths[5];
|
||||
SkRect rects[5];
|
||||
rects[0].set(xB, yB, xE, yE);
|
||||
|
@ -833,7 +833,7 @@ static void test_direction(skiatest::Reporter* reporter) {
|
||||
// triangle with one point really far from the origin.
|
||||
path.reset();
|
||||
// the first point is roughly 1.05e10, 1.05e10
|
||||
path.moveTo(SkFloatToScalar(SkBits2Float(0x501c7652)), SkFloatToScalar(SkBits2Float(0x501c7652)));
|
||||
path.moveTo(SkBits2Float(0x501c7652), SkBits2Float(0x501c7652));
|
||||
path.lineTo(110 * SK_Scalar1, -10 * SK_Scalar1);
|
||||
path.lineTo(-10 * SK_Scalar1, 60 * SK_Scalar1);
|
||||
check_direction(reporter, path, SkPath::kCCW_Direction);
|
||||
@ -1274,10 +1274,10 @@ static void test_conservativelyContains(skiatest::Reporter* reporter) {
|
||||
{kBaseRect, true, true, false, false},
|
||||
|
||||
// rect well inside of kBaseRect
|
||||
{SkRect::MakeLTRB(kBaseRect.fLeft + SkFloatToScalar(0.25f)*kBaseRect.width(),
|
||||
kBaseRect.fTop + SkFloatToScalar(0.25f)*kBaseRect.height(),
|
||||
kBaseRect.fRight - SkFloatToScalar(0.25f)*kBaseRect.width(),
|
||||
kBaseRect.fBottom - SkFloatToScalar(0.25f)*kBaseRect.height()),
|
||||
{SkRect::MakeLTRB(kBaseRect.fLeft + 0.25f*kBaseRect.width(),
|
||||
kBaseRect.fTop + 0.25f*kBaseRect.height(),
|
||||
kBaseRect.fRight - 0.25f*kBaseRect.width(),
|
||||
kBaseRect.fBottom - 0.25f*kBaseRect.height()),
|
||||
true, true, true, true},
|
||||
|
||||
// rects with edges off by one from kBaseRect's edges
|
||||
@ -1382,7 +1382,7 @@ static void test_conservativelyContains(skiatest::Reporter* reporter) {
|
||||
// Slightly non-convex shape, shouldn't contain any rects.
|
||||
path.reset();
|
||||
path.moveTo(0, 0);
|
||||
path.lineTo(SkIntToScalar(50), SkFloatToScalar(0.05f));
|
||||
path.lineTo(SkIntToScalar(50), 0.05f);
|
||||
path.lineTo(SkIntToScalar(100), 0);
|
||||
path.lineTo(SkIntToScalar(100), SkIntToScalar(100));
|
||||
path.lineTo(0, SkIntToScalar(100));
|
||||
@ -2962,13 +2962,13 @@ static void test_arcTo(skiatest::Reporter* reporter) {
|
||||
p.arcTo(oval, 360, 0, false);
|
||||
check_path_is_move_and_reset(reporter, &p, oval.fRight, oval.centerY());
|
||||
for (float sweep = 359, delta = 0.5f; sweep != (float) (sweep + delta); ) {
|
||||
p.arcTo(oval, 0, SkFloatToScalar(sweep), false);
|
||||
p.arcTo(oval, 0, sweep, false);
|
||||
REPORTER_ASSERT(reporter, p.getBounds() == oval);
|
||||
sweep += delta;
|
||||
delta /= 2;
|
||||
}
|
||||
for (float sweep = 361, delta = 0.5f; sweep != (float) (sweep - delta);) {
|
||||
p.arcTo(oval, 0, SkFloatToScalar(sweep), false);
|
||||
p.arcTo(oval, 0, sweep, false);
|
||||
REPORTER_ASSERT(reporter, p.getBounds() == oval);
|
||||
sweep -= delta;
|
||||
delta /= 2;
|
||||
|
@ -84,7 +84,7 @@ static float force_as_float(skiatest::Reporter* reporter, float value) {
|
||||
// test that we handle very large values correctly. i.e. that we can
|
||||
// successfully normalize something whose mag overflows a float.
|
||||
static void test_overflow(skiatest::Reporter* reporter) {
|
||||
SkScalar bigFloat = get_value(reporter, SkFloatToScalar(3.4e38f));
|
||||
SkScalar bigFloat = get_value(reporter, 3.4e38f);
|
||||
SkPoint pt = { bigFloat, bigFloat };
|
||||
|
||||
SkScalar length = pt.length();
|
||||
@ -107,7 +107,7 @@ static void test_overflow(skiatest::Reporter* reporter) {
|
||||
// test that we handle very small values correctly. i.e. that we can
|
||||
// report failure if we try to normalize them.
|
||||
static void test_underflow(skiatest::Reporter* reporter) {
|
||||
SkPoint pt = { SkFloatToScalar(1.0e-37f), SkFloatToScalar(1.0e-37f) };
|
||||
SkPoint pt = { 1.0e-37f, 1.0e-37f };
|
||||
SkPoint copy = pt;
|
||||
|
||||
REPORTER_ASSERT(reporter, 0 == SkPoint::Normalize(&pt));
|
||||
@ -127,7 +127,7 @@ DEF_TEST(Point, reporter) {
|
||||
SkScalar fLength;
|
||||
} gRec[] = {
|
||||
{ SkIntToScalar(3), SkIntToScalar(4), SkIntToScalar(5) },
|
||||
{ SkFloatToScalar(0.6f), SkFloatToScalar(0.8f), SK_Scalar1 },
|
||||
{ 0.6f, 0.8f, SK_Scalar1 },
|
||||
};
|
||||
|
||||
for (size_t i = 0; i < SK_ARRAY_COUNT(gRec); ++i) {
|
||||
|
@ -9,8 +9,8 @@
|
||||
#include "SkMatrix.h"
|
||||
#include "SkRRect.h"
|
||||
|
||||
static const SkScalar kWidth = SkFloatToScalar(100.0f);
|
||||
static const SkScalar kHeight = SkFloatToScalar(100.0f);
|
||||
static const SkScalar kWidth = 100.0f;
|
||||
static const SkScalar kHeight = 100.0f;
|
||||
|
||||
static void test_inset(skiatest::Reporter* reporter) {
|
||||
SkRRect rr, rr2;
|
||||
@ -510,7 +510,7 @@ static void test_transform_helper(skiatest::Reporter* reporter, const SkRRect& o
|
||||
|
||||
// Scale in both directions.
|
||||
SkScalar xScale = SkIntToScalar(3);
|
||||
SkScalar yScale = SkFloatToScalar(3.2f);
|
||||
SkScalar yScale = 3.2f;
|
||||
matrix.reset();
|
||||
matrix.setScaleX(xScale);
|
||||
matrix.setScaleY(yScale);
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user