diff options
author | robertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-05-08 13:15:37 +0000 |
---|---|---|
committer | robertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-05-08 13:15:37 +0000 |
commit | c6ce750c73c6586a5c2e88a0620b04e9569af401 (patch) | |
tree | bfa313ab7b16bae4898a767524f510218ca71161 | |
parent | 83edde21f3945f988656c023384bd33e87f8b48d (diff) |
Fixed some fixed point build Windows compiler complaints
http://codereview.appspot.com/6197063/
git-svn-id: http://skia.googlecode.com/svn/trunk@3867 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r-- | samplecode/ClockFaceView.cpp | 10 | ||||
-rw-r--r-- | samplecode/SampleLineClipper.cpp | 3 | ||||
-rw-r--r-- | samplecode/SamplePolyToPoly.cpp | 4 | ||||
-rw-r--r-- | samplecode/SampleSlides.cpp | 2 | ||||
-rw-r--r-- | samplecode/SampleTextOnPath.cpp | 6 | ||||
-rw-r--r-- | samplecode/TransitionView.cpp | 3 | ||||
-rw-r--r-- | src/core/SkLineClipper.cpp | 2 | ||||
-rw-r--r-- | tests/PathMeasureTest.cpp | 4 |
8 files changed, 20 insertions, 14 deletions
diff --git a/samplecode/ClockFaceView.cpp b/samplecode/ClockFaceView.cpp index 98275453d2..85559929b1 100644 --- a/samplecode/ClockFaceView.cpp +++ b/samplecode/ClockFaceView.cpp @@ -80,7 +80,7 @@ protected: this->INHERITED::begin(uvBounds, dst); } // virtual void end(SkPath* dst) {} - virtual void next(const SkPoint& loc, int u, int v, SkPath* dst) + virtual void next(const SkPoint& loc, int u, int v, SkPath* dst) { if (fPts) { *fPts->append() = loc; @@ -131,7 +131,7 @@ static SkPathEffect* makepe(float interp, SkTDArray<SkPoint>* pts) { } static void r7(SkLayerRasterizer* rast, SkPaint& p, SkScalar interp) { - p.setPathEffect(makepe(interp, NULL))->unref(); + p.setPathEffect(makepe(SkScalarToFloat(interp), NULL))->unref(); rast->addLayer(p); #if 0 p.setPathEffect(new InverseFillPE())->unref(); @@ -152,7 +152,7 @@ static void apply_shader(SkPaint* paint, float scale) SkLayerRasterizer* rast = new SkLayerRasterizer; p.setAntiAlias(true); - r7(rast, p, scale); + r7(rast, p, SkFloatToScalar(scale)); paint->setRasterizer(rast)->unref(); paint->setColor(SK_ColorBLUE); @@ -163,7 +163,7 @@ class ClockFaceView : public SkView { SkScalar fInterp; SkScalar fDx; public: - ClockFaceView() + ClockFaceView() { fFace = SkTypeface::CreateFromFile("/Users/reed/Downloads/p052024l.pfb"); fInterp = 0; @@ -226,7 +226,7 @@ protected: paint.setTypeface(fFace); - apply_shader(&paint, fInterp); + apply_shader(&paint, SkScalarToFloat(fInterp)); canvas->drawText(str.c_str(), str.size(), x, y, paint); // drawdots(canvas, paint); diff --git a/samplecode/SampleLineClipper.cpp b/samplecode/SampleLineClipper.cpp index 85654706c8..94374b53d3 100644 --- a/samplecode/SampleLineClipper.cpp +++ b/samplecode/SampleLineClipper.cpp @@ -29,7 +29,8 @@ static int test0(SkPoint pts[], SkRect* clip) { pts[0].set(200000, 140); pts[1].set(-740000, 483); - pts[2].set(1.00000102e-06f, 9.10000017e-05f); + pts[2].set(SkFloatToScalar(1.00000102e-06f), + SkFloatToScalar(9.10000017e-05f)); clip->set(0, 0, 640, 480); return 2; } diff --git a/samplecode/SamplePolyToPoly.cpp b/samplecode/SamplePolyToPoly.cpp index dbda4da797..c12b402ab8 100644 --- a/samplecode/SamplePolyToPoly.cpp +++ b/samplecode/SamplePolyToPoly.cpp @@ -113,7 +113,9 @@ protected: float y = D/2 - (fm.fAscent + fm.fDescent)/2; SkString str; str.appendS32(count); - canvas->drawText(str.c_str(), str.size(), x, y, *paint); + canvas->drawText(str.c_str(), str.size(), + x, SkFloatToScalar(y), + *paint); canvas->restore(); } diff --git a/samplecode/SampleSlides.cpp b/samplecode/SampleSlides.cpp index 52510360a5..49a4ee5945 100644 --- a/samplecode/SampleSlides.cpp +++ b/samplecode/SampleSlides.cpp @@ -75,7 +75,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, 1.5); + scale(&path, SkFloatToScalar(1.5f)); paint->setPathEffect(new SkPath1DPathEffect(path, SkIntToScalar(21), 0, SkPath1DPathEffect::kRotate_Style))->unref(); diff --git a/samplecode/SampleTextOnPath.cpp b/samplecode/SampleTextOnPath.cpp index 91100a64ee..00d9cba76b 100644 --- a/samplecode/SampleTextOnPath.cpp +++ b/samplecode/SampleTextOnPath.cpp @@ -21,7 +21,8 @@ static void textStrokePath(SkCanvas* canvas) { canvas->save(); canvas->scale(SkIntToScalar(250),SkIntToScalar(250)); - rect.set(0.0f, 0.21f, 0.78f, 0.99f); + rect.set(SkFloatToScalar(0.0f), SkFloatToScalar(0.21f), + SkFloatToScalar(0.78f), SkFloatToScalar(0.99f)); path.addArc(rect, SkIntToScalar(280), SkIntToScalar(350)); @@ -41,7 +42,8 @@ static void textStrokePath(SkCanvas* canvas) { const char* text = "DRAWING STROKED TEXT WITH A BLUR ON A PATH"; size_t len = strlen(text); - canvas->drawTextOnPathHV(text, len, path, 0, -0.025f, paint); + canvas->drawTextOnPathHV(text, len, path, 0, + SkFloatToScalar(-0.025f), paint); canvas->restore(); } diff --git a/samplecode/TransitionView.cpp b/samplecode/TransitionView.cpp index 76e18b6a30..5e45e37a20 100644 --- a/samplecode/TransitionView.cpp +++ b/samplecode/TransitionView.cpp @@ -146,7 +146,8 @@ protected: fEnd[kPrevX] = -lr; fEnd[kPrevY] = -ud; fEnd[kNextX] = fEnd[kNextY] = 0; - SkScalar blend[] = {0.8f, 0.0f, 0.0f, 1.0f}; + SkScalar blend[] = { SkFloatToScalar(0.8f), SkFloatToScalar(0.0f), + SkFloatToScalar(0.0f), SK_Scalar1 }; fInterp.setKeyFrame(0, SkTime::GetMSecs(), fBegin, blend); fInterp.setKeyFrame(1, SkTime::GetMSecs()+500, fEnd, blend); } diff --git a/src/core/SkLineClipper.cpp b/src/core/SkLineClipper.cpp index 477596cb03..b2560d69b3 100644 --- a/src/core/SkLineClipper.cpp +++ b/src/core/SkLineClipper.cpp @@ -175,7 +175,7 @@ static bool is_between_unsorted(SkScalar value, static void sect_with_horizontal_test_for_pin_results() { const SkPoint pts[] = { { -540000, -720000 }, - { -9.10000017e-05f, 9.99999996e-13f } + { SkFloatToScalar(-9.10000017e-05f), SkFloatToScalar(9.99999996e-13f) } }; float x = sect_with_horizontal(pts, 0); SkASSERT(is_between_unsorted(x, pts[0].fX, pts[1].fX)); diff --git a/tests/PathMeasureTest.cpp b/tests/PathMeasureTest.cpp index 453cdebb45..ee78c6b6f0 100644 --- a/tests/PathMeasureTest.cpp +++ b/tests/PathMeasureTest.cpp @@ -51,9 +51,9 @@ static void test_small_segment(skiatest::Reporter* reporter) { const SkPoint pts[] = { { 100000, 100000}, // big jump between these points, makes a big segment - { 1.0005, 0.9999 }, + { SkFloatToScalar(1.0005f), SkFloatToScalar(0.9999f) }, // tiny (non-zero) jump between these points - { 1, 1 }, + { SK_Scalar1, SK_Scalar1 }, }; path.moveTo(pts[0]); |