aboutsummaryrefslogtreecommitdiffhomepage
path: root/samplecode
diff options
context:
space:
mode:
authorGravatar robertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-05-08 13:15:37 +0000
committerGravatar robertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-05-08 13:15:37 +0000
commitc6ce750c73c6586a5c2e88a0620b04e9569af401 (patch)
treebfa313ab7b16bae4898a767524f510218ca71161 /samplecode
parent83edde21f3945f988656c023384bd33e87f8b48d (diff)
Fixed some fixed point build Windows compiler complaints
Diffstat (limited to 'samplecode')
-rw-r--r--samplecode/ClockFaceView.cpp10
-rw-r--r--samplecode/SampleLineClipper.cpp3
-rw-r--r--samplecode/SamplePolyToPoly.cpp4
-rw-r--r--samplecode/SampleSlides.cpp2
-rw-r--r--samplecode/SampleTextOnPath.cpp6
-rw-r--r--samplecode/TransitionView.cpp3
6 files changed, 17 insertions, 11 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);
}