fix warnings
Review URL: https://codereview.appspot.com/7073044 git-svn-id: http://skia.googlecode.com/svn/trunk@7064 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
parent
f286329ad1
commit
140d7286c5
@ -52,8 +52,8 @@ inline void computeInverseScales(const SkMatrix* transform, float &inverseScaleX
|
||||
float m01 = transform->getSkewY();
|
||||
float m10 = transform->getSkewX();
|
||||
float m11 = transform->getScaleY();
|
||||
float scaleX = sqrt(m00 * m00 + m01 * m01);
|
||||
float scaleY = sqrt(m10 * m10 + m11 * m11);
|
||||
float scaleX = sk_float_sqrt(m00 * m00 + m01 * m01);
|
||||
float scaleY = sk_float_sqrt(m10 * m10 + m11 * m11);
|
||||
inverseScaleX = (scaleX != 0) ? (1.0f / scaleX) : 1.0f;
|
||||
inverseScaleY = (scaleY != 0) ? (1.0f / scaleY) : 1.0f;
|
||||
} else {
|
||||
@ -82,7 +82,7 @@ inline void copyAlphaVertex(AlphaVertex* destPtr, const AlphaVertex* srcPtr) {
|
||||
*/
|
||||
inline SkVector totalOffsetFromNormals(const SkVector& normalA, const SkVector& normalB) {
|
||||
SkVector pseudoNormal = normalA + normalB;
|
||||
pseudoNormal.scale(1.0f / (1.0f + fabs(normalA.dot(normalB))));
|
||||
pseudoNormal.scale(1.0f / (1.0f + sk_float_abs(normalA.dot(normalB))));
|
||||
return pseudoNormal;
|
||||
}
|
||||
|
||||
@ -661,8 +661,8 @@ void PathRenderer::RecursiveCubicBezierVertices(
|
||||
float sqrInvScaleX, float sqrInvScaleY, SkTArray<Vertex, true>* outputVertices) {
|
||||
float dx = p2x - p1x;
|
||||
float dy = p2y - p1y;
|
||||
float d1 = fabs((c1x - p2x) * dy - (c1y - p2y) * dx);
|
||||
float d2 = fabs((c2x - p2x) * dy - (c2y - p2y) * dx);
|
||||
float d1 = sk_float_abs((c1x - p2x) * dy - (c1y - p2y) * dx);
|
||||
float d2 = sk_float_abs((c2x - p2x) * dy - (c2y - p2y) * dx);
|
||||
float d = d1 + d2;
|
||||
|
||||
// multiplying by sqrInvScaleY/X equivalent to multiplying in dimensional scale factors
|
||||
|
@ -138,7 +138,7 @@ private:
|
||||
class BlurRectCompareGM : public skiagm::GM {
|
||||
SkString fName;
|
||||
unsigned int fRectWidth, fRectHeight;
|
||||
float fRadius;
|
||||
SkScalar fRadius;
|
||||
public:
|
||||
BlurRectCompareGM(const char name[], unsigned int rectWidth, unsigned int rectHeight, float radius) :
|
||||
fName(name)
|
||||
@ -149,7 +149,7 @@ public:
|
||||
|
||||
int width() const { return fRectWidth; }
|
||||
int height() const { return fRectHeight; }
|
||||
int radius() const { return fRadius; }
|
||||
SkScalar radius() const { return fRadius; }
|
||||
|
||||
protected:
|
||||
virtual SkString onShortName() {
|
||||
@ -160,7 +160,7 @@ protected:
|
||||
return SkISize::Make(640, 480);
|
||||
}
|
||||
|
||||
virtual void makeMask( SkMask *m, SkRect r ) = 0;
|
||||
virtual void makeMask( SkMask *m, const SkRect& ) = 0;
|
||||
|
||||
virtual void onDraw(SkCanvas* canvas) {
|
||||
SkRect r;
|
||||
@ -184,12 +184,14 @@ private:
|
||||
|
||||
class BlurRectFastGM: public BlurRectCompareGM {
|
||||
public:
|
||||
BlurRectFastGM(const char name[], unsigned int rect_width, unsigned int rect_height, float blur_radius) :
|
||||
BlurRectCompareGM( name, rect_width, rect_height, blur_radius ) {}
|
||||
BlurRectFastGM(const char name[], unsigned int rect_width,
|
||||
unsigned int rect_height, float blur_radius) :
|
||||
BlurRectCompareGM( name, rect_width, rect_height, blur_radius ) {}
|
||||
protected:
|
||||
virtual void makeMask( SkMask *m, SkRect r ) {
|
||||
SkBlurMask::BlurRect( m, r, radius(), SkBlurMask::kNormal_Style, SkBlurMask::kHigh_Quality );
|
||||
}
|
||||
virtual void makeMask( SkMask *m, const SkRect& r) SK_OVERRIDE {
|
||||
SkBlurMask::BlurRect( m, r, radius(), SkBlurMask::kNormal_Style,
|
||||
SkBlurMask::kHigh_Quality );
|
||||
}
|
||||
};
|
||||
|
||||
class BlurRectSlowGM: public BlurRectCompareGM {
|
||||
@ -197,17 +199,18 @@ public:
|
||||
BlurRectSlowGM(const char name[], unsigned int rect_width, unsigned int rect_height, float blur_radius) :
|
||||
BlurRectCompareGM( name, rect_width, rect_height, blur_radius ) {}
|
||||
protected:
|
||||
virtual void makeMask( SkMask *m, SkRect r ) {
|
||||
SkMask src;
|
||||
src.fFormat = SkMask::kA8_Format;
|
||||
src.fRowBytes = r.width();
|
||||
src.fBounds = SkIRect::MakeWH(r.width(), r.height());
|
||||
src.fImage = SkMask::AllocImage( src.computeTotalImageSize() );
|
||||
virtual void makeMask( SkMask *m, const SkRect& r) SK_OVERRIDE {
|
||||
SkMask src;
|
||||
r.roundOut(&src.fBounds);
|
||||
src.fBounds.offset(-src.fBounds.fLeft, -src.fBounds.fTop); // move to origin
|
||||
src.fFormat = SkMask::kA8_Format;
|
||||
src.fRowBytes = src.fBounds.width();
|
||||
src.fImage = SkMask::AllocImage( src.computeTotalImageSize() );
|
||||
|
||||
memset( src.fImage, 0xff, src.computeTotalImageSize() );
|
||||
memset( src.fImage, 0xff, src.computeTotalImageSize() );
|
||||
|
||||
SkBlurMask::BlurSeparable( m, src, radius()/2, SkBlurMask::kNormal_Style, SkBlurMask::kHigh_Quality );
|
||||
}
|
||||
SkBlurMask::BlurSeparable( m, src, radius()/2, SkBlurMask::kNormal_Style, SkBlurMask::kHigh_Quality );
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
@ -245,7 +245,7 @@ protected:
|
||||
// 1on/1off 1x1 squares with phase of 1 and non-integer length - rects fastpath
|
||||
canvas->save();
|
||||
canvas->translate(332, 0);
|
||||
this->drawDashedLines(canvas, 99.5, SK_ScalarHalf, SK_Scalar1, 1, false);
|
||||
this->drawDashedLines(canvas, 99.5f, SK_ScalarHalf, SK_Scalar1, 1, false);
|
||||
canvas->restore();
|
||||
|
||||
// 1on/1off 3x3 squares with phase of 0 - points fast path
|
||||
|
@ -249,11 +249,12 @@ protected:
|
||||
|
||||
SkPoint pos, tan;
|
||||
for (SkScalar dist = 0; dist <= total; dist += delta) {
|
||||
(void)meas.getPosTan(dist, &pos, &tan);
|
||||
tan.scale(radius);
|
||||
tan.rotateCCW();
|
||||
canvas->drawLine(pos.x() + tan.x(), pos.y() + tan.y(),
|
||||
pos.x() - tan.x(), pos.y() - tan.y(), paint);
|
||||
if (meas.getPosTan(dist, &pos, &tan)) {
|
||||
tan.scale(radius);
|
||||
tan.rotateCCW();
|
||||
canvas->drawLine(pos.x() + tan.x(), pos.y() + tan.y(),
|
||||
pos.x() - tan.x(), pos.y() - tan.y(), paint);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -701,7 +701,7 @@ bool SkBitmap::ComputeIsOpaque(const SkBitmap& bm) {
|
||||
if (!table) {
|
||||
return false;
|
||||
}
|
||||
SkPMColor c = ~0;
|
||||
SkPMColor c = (SkPMColor)~0;
|
||||
for (int i = bm.getColorTable()->count() - 1; i >= 0; --i) {
|
||||
c &= table[i];
|
||||
}
|
||||
@ -724,7 +724,7 @@ bool SkBitmap::ComputeIsOpaque(const SkBitmap& bm) {
|
||||
return true;
|
||||
} break;
|
||||
case SkBitmap::kARGB_8888_Config: {
|
||||
SkPMColor c = ~0;
|
||||
SkPMColor c = (SkPMColor)~0;
|
||||
for (int y = 0; y < height; ++y) {
|
||||
const SkPMColor* row = bm.getAddr32(0, y);
|
||||
for (int x = 0; x < width; ++x) {
|
||||
|
@ -20,7 +20,7 @@
|
||||
enum {
|
||||
// Deferred canvas will auto-flush when recording reaches this limit
|
||||
kDefaultMaxRecordingStorageBytes = 64*1024*1024,
|
||||
kDeferredCanvasBitmapSizeThreshold = ~0, // Disables this feature
|
||||
kDeferredCanvasBitmapSizeThreshold = ~0U, // Disables this feature
|
||||
};
|
||||
|
||||
enum PlaybackMode {
|
||||
|
Loading…
Reference in New Issue
Block a user