Fixed Windows compiler complaints
http://codereview.appspot.com/6392044
git-svn-id: http://skia.googlecode.com/svn/trunk@4511 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/animator/SkScriptTokenizer.cpp b/src/animator/SkScriptTokenizer.cpp
index 54aa2bf..1be7427 100644
--- a/src/animator/SkScriptTokenizer.cpp
+++ b/src/animator/SkScriptTokenizer.cpp
@@ -750,7 +750,7 @@
decompile(data.bytes(), data.size());
#endif
SkScriptRuntime runtime(fCallBackArray);
- runtime.executeTokens((unsigned char*) data.bytes());
+ runtime.executeTokens((unsigned char*) data->bytes());
SkScriptValue2 value1;
runtime.getResult(&value1.fOperand);
value1.fType = fReturnType;
@@ -1158,7 +1158,7 @@
decompile(data.bytes(), data.size());
#endif
SkScriptRuntime runtime(fCallBackArray);
- runtime.executeTokens((unsigned char*)data.bytes());
+ runtime.executeTokens((unsigned char*)data->bytes());
runtime.getResult(&value1.fOperand);
if (attributes->fResultIsBoolean == kResultIsBoolean)
value1.fType = SkOperand2::kS32;
diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp
index c2a308e..60095ab 100644
--- a/src/gpu/GrDrawTarget.cpp
+++ b/src/gpu/GrDrawTarget.cpp
@@ -540,7 +540,7 @@
}
bool GrDrawTarget::StageUsesTexCoords(GrVertexLayout layout, int stage) {
- return layout & gStageTexCoordMasks[stage];
+ return SkToBool(layout & gStageTexCoordMasks[stage]);
}
bool GrDrawTarget::reserveVertexAndIndexSpace(GrVertexLayout vertexLayout,
diff --git a/src/gpu/GrPathUtils.cpp b/src/gpu/GrPathUtils.cpp
index aa18792..4e487fd 100644
--- a/src/gpu/GrPathUtils.cpp
+++ b/src/gpu/GrPathUtils.cpp
@@ -199,12 +199,16 @@
// [0 0 1]
// [1 1 1]
// We invert the control pt matrix and post concat to both sides to get M.
- UVpts.setAll(0, 0.5f, 1.f,
- 0, 0, 1.f,
- 1.f, 1.f, 1.f);
+ UVpts.setAll(0, GR_ScalarHalf, GR_Scalar1,
+ 0, 0, GR_Scalar1,
+ SkScalarToPersp(GR_Scalar1),
+ SkScalarToPersp(GR_Scalar1),
+ SkScalarToPersp(GR_Scalar1));
m.setAll(qPts[0].fX, qPts[1].fX, qPts[2].fX,
qPts[0].fY, qPts[1].fY, qPts[2].fY,
- 1.f, 1.f, 1.f);
+ SkScalarToPersp(GR_Scalar1),
+ SkScalarToPersp(GR_Scalar1),
+ SkScalarToPersp(GR_Scalar1));
if (!m.invert(&m)) {
// The quad is degenerate. Hopefully this is rare. Find the pts that are
// farthest apart to compute a line (unless it is really a pt).
@@ -247,7 +251,7 @@
m.postConcat(UVpts);
// The matrix should not have perspective.
- static const GrScalar gTOL = 1.f / 100.f;
+ static const GrScalar gTOL = GrFloatToScalar(1.f / 100.f);
GrAssert(GrScalarAbs(m.get(SkMatrix::kMPersp0)) < gTOL);
GrAssert(GrScalarAbs(m.get(SkMatrix::kMPersp1)) < gTOL);
diff --git a/src/gpu/gl/GrGpuGL_program.cpp b/src/gpu/gl/GrGpuGL_program.cpp
index d506c6c..736be93 100644
--- a/src/gpu/gl/GrGpuGL_program.cpp
+++ b/src/gpu/gl/GrGpuGL_program.cpp
@@ -119,7 +119,7 @@
// and perform a y-flip.
GrMatrix m;
m.setScale(GrIntToScalar(2) / rt->width(), GrIntToScalar(-2) / rt->height());
- m.postTranslate(-1.f , 1.f);
+ m.postTranslate(-GR_Scalar1, GR_Scalar1);
m.preConcat(vm);
// GL wants a column-major 4x4.
diff --git a/src/pdf/SkPDFDevice.cpp b/src/pdf/SkPDFDevice.cpp
index 68c210d..d05b640 100644
--- a/src/pdf/SkPDFDevice.cpp
+++ b/src/pdf/SkPDFDevice.cpp
@@ -1119,7 +1119,7 @@
gsState.updateDrawingState(entry->fState);
SkAutoDataUnref copy(entry->fContent.copyToData());
- data->write(copy.data(), copy.size());
+ data->write(copy->data(), copy->size());
entry = entry->fNext.get();
}
gsState.drainStack();
diff --git a/src/pdf/SkPDFImage.cpp b/src/pdf/SkPDFImage.cpp
index 72379b1..429667a 100644
--- a/src/pdf/SkPDFImage.cpp
+++ b/src/pdf/SkPDFImage.cpp
@@ -338,10 +338,10 @@
SkRefPtr<SkPDFInt> zeroVal = new SkPDFInt(0);
zeroVal->unref(); // SkRefPtr and new both took a reference.
SkRefPtr<SkPDFScalar> scale5Val =
- new SkPDFScalar(8.2258f); // 255/2^5-1
+ new SkPDFScalar(SkFloatToScalar(8.2258f)); // 255/2^5-1
scale5Val->unref(); // SkRefPtr and new both took a reference.
SkRefPtr<SkPDFScalar> scale6Val =
- new SkPDFScalar(4.0476f); // 255/2^6-1
+ new SkPDFScalar(SkFloatToScalar(4.0476f)); // 255/2^6-1
scale6Val->unref(); // SkRefPtr and new both took a reference.
SkRefPtr<SkPDFArray> decodeValue = new SkPDFArray();
decodeValue->unref(); // SkRefPtr and new both took a reference.
diff --git a/src/pipe/SkGPipeWrite.cpp b/src/pipe/SkGPipeWrite.cpp
index e257144..e546b5c 100644
--- a/src/pipe/SkGPipeWrite.cpp
+++ b/src/pipe/SkGPipeWrite.cpp
@@ -51,7 +51,7 @@
if (writer) {
writer->write32(size);
SkAutoDataUnref data(stream.copyToData());
- writer->writePad(data.data(), size);
+ writer->writePad(data->data(), size);
}
return 4 + SkAlign4(size);
}
diff --git a/src/views/SkTouchGesture.cpp b/src/views/SkTouchGesture.cpp
index 31adc74..1828f03 100644
--- a/src/views/SkTouchGesture.cpp
+++ b/src/views/SkTouchGesture.cpp
@@ -14,9 +14,9 @@
#define DISCRETIZE_TRANSLATE_TO_AVOID_FLICKER true
-static const float MAX_FLING_SPEED = 1500;
+static const SkScalar MAX_FLING_SPEED = SkIntToScalar(1500);
-static float pin_max_fling(float speed) {
+static SkScalar pin_max_fling(SkScalar speed) {
if (speed > MAX_FLING_SPEED) {
speed = MAX_FLING_SPEED;
}
@@ -50,7 +50,7 @@
void SkFlingState::reset(float sx, float sy) {
fActive = true;
- fDirection.set(sx, sy);
+ fDirection.set(SkFloatToScalar(sx), SkFloatToScalar(sy));
fSpeed0 = SkPoint::Normalize(&fDirection);
fSpeed0 = pin_max_fling(fSpeed0);
fTime0 = getseconds();
@@ -82,7 +82,7 @@
tx = (float)sk_float_round2int(tx);
ty = (float)sk_float_round2int(ty);
}
- matrix->setTranslate(tx, ty);
+ matrix->setTranslate(SkFloatToScalar(tx), SkFloatToScalar(ty));
// printf("---- evaluate (%g %g)\n", tx, ty);
return true;
@@ -181,8 +181,8 @@
return -1;
}
-static float center(float pos0, float pos1) {
- return (pos0 + pos1) * 0.5f;
+static SkScalar center(float pos0, float pos1) {
+ return SkFloatToScalar((pos0 + pos1) * 0.5f);
}
static const float MAX_ZOOM_SCALE = 4;
@@ -190,7 +190,7 @@
float SkTouchGesture::limitTotalZoom(float scale) const {
// this query works 'cause we know that we're square-scale w/ no skew/rotation
- const float curr = fGlobalM[0];
+ const float curr = SkScalarToFloat(fGlobalM[0]);
if (scale > 1 && curr * scale > MAX_ZOOM_SCALE) {
scale = MAX_ZOOM_SCALE / curr;