Fixed minor Release & fixed point compiler warnings on Linux
authorrobertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Wed, 25 Apr 2012 16:54:51 +0000 (16:54 +0000)
committerrobertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Wed, 25 Apr 2012 16:54:51 +0000 (16:54 +0000)
http://codereview.appspot.com/6118050/

git-svn-id: http://skia.googlecode.com/svn/trunk@3766 2bbb7eff-a529-9590-31e7-b0007b416f81

samplecode/SampleAnimBlur.cpp
samplecode/SampleEffects.cpp
samplecode/SampleFontScalerTest.cpp
src/core/SkCanvas.cpp
src/gpu/GrAAHairLinePathRenderer.cpp
src/gpu/GrDrawState.h
src/gpu/GrTesselatedPathRenderer.cpp

index 7f077e6..cada0cd 100644 (file)
@@ -45,7 +45,7 @@ protected:
         };
         SkRandom random;
 
-        for (int i = 0; i < SK_ARRAY_COUNT(gStyles); ++i) {
+        for (size_t i = 0; i < SK_ARRAY_COUNT(gStyles); ++i) {
             SkMaskFilter* mf = SkBlurMaskFilter::Create(blurRadius,
                                        gStyles[i],
                                        SkBlurMaskFilter::kHighQuality_BlurFlag);
index bf83bae..9aab94a 100644 (file)
 
 static void test_edgeclipper() {
     SkPoint pts[] = {
-        { -8.38822452e+21f, -7.69721471e+19f },
-        { 1.57645875e+23f, 1.44634003e+21f },
-        { 1.61519691e+23f, 1.48208059e+21f },
-        { 3.13963584e+23f, 2.88057438e+21f }
+        { SkFloatToScalar(-8.38822452e+21f),
+                                           SkFloatToScalar(-7.69721471e+19f) },
+        { SkFloatToScalar(1.57645875e+23f), SkFloatToScalar(1.44634003e+21f) },
+        { SkFloatToScalar(1.61519691e+23f), SkFloatToScalar(1.48208059e+21f) },
+        { SkFloatToScalar(3.13963584e+23f), SkFloatToScalar(2.88057438e+21f) }
     };
     SkRect clip = { 0, 0, 300, 200 };
     
index 83f962e..e6321de 100644 (file)
@@ -77,9 +77,12 @@ protected:
         if (false) {
             SkPoint pts[4];
             pts[0].set(1.61061274e+09f, 6291456);
-            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);
+            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));
 
             SkPath path;
             path.moveTo(pts[0]);
index fc308d4..af55958 100644 (file)
@@ -1214,7 +1214,7 @@ void SkCanvas::replayClips(ClipVisitor* visitor) const {
     SkClipStack::B2FIter                iter(fClipStack);
     const SkClipStack::B2FIter::Clip*   clip;
 
-    SkRect empty = {};
+    SkRect empty = { 0, 0, 0, 0 };
     while ((clip = iter.next()) != NULL) {
         if (clip->fPath) {
             visitor->clipPath(*clip->fPath, clip->fOp, clip->fDoAA);
index 66dbe8c..701bf3a 100644 (file)
@@ -164,7 +164,7 @@ int num_quad_subdivs(const SkPoint p[3]) {
     // maybe different when do this using gpu (geo or tess shaders)
     static const SkScalar gSubdivTol = 175 * SK_Scalar1;
 
-    if (dsqd <= gSubdivTol*gSubdivTol) {
+    if (dsqd <= SkScalarMul(gSubdivTol, gSubdivTol)) {
         return 0;
     } else {
         // subdividing the quad reduces d by 4. so we want x = log4(d/tol)
@@ -177,7 +177,9 @@ int num_quad_subdivs(const SkPoint p[3]) {
         log = GrMin(GrMax(0, log), kMaxSub);
         return log;
 #else
-        SkScalar log = SkScalarLog(SkScalarDiv(dsqd,gSubdivTol*gSubdivTol));
+        SkScalar log = SkScalarLog(
+                          SkScalarDiv(dsqd, 
+                                      SkScalarMul(gSubdivTol, gSubdivTol)));
         static const SkScalar conv = SkScalarInvert(SkScalarLog(2));
         log = SkScalarMul(log, conv);
         return  GrMin(GrMax(0, SkScalarCeilToInt(log)),kMaxSub);
index 12c8861..e5c30b6 100644 (file)
@@ -460,6 +460,7 @@ public:
         AutoRenderTargetRestore() : fDrawState(NULL), fSavedTarget(NULL) {}
         AutoRenderTargetRestore(GrDrawState* ds, GrRenderTarget* newTarget) {
             fDrawState = NULL;
+            fSavedTarget = NULL;
             this->set(ds, newTarget);
         }
         ~AutoRenderTargetRestore() { this->set(NULL, NULL); }
index 23074d9..5920ae1 100644 (file)
@@ -43,8 +43,12 @@ static inline GrDrawState::Edge computeEdge(const GrPoint& p,
 
 static inline GrPoint sanitizePoint(const GrPoint& pt) {
     GrPoint r;
-    r.fX = SkScalarPin(pt.fX, -kMaxVertexValue, kMaxVertexValue);
-    r.fY = SkScalarPin(pt.fY, -kMaxVertexValue, kMaxVertexValue);
+    r.fX = SkScalarPin(pt.fX, 
+                       SkFloatToScalar(-kMaxVertexValue), 
+                       SkFloatToScalar(kMaxVertexValue));
+    r.fY = SkScalarPin(pt.fY, 
+                       SkFloatToScalar(-kMaxVertexValue), 
+                       SkFloatToScalar(kMaxVertexValue));
     return r;
 }