diff options
author | caryclark@google.com <caryclark@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-06-06 12:10:45 +0000 |
---|---|---|
committer | caryclark@google.com <caryclark@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-06-06 12:10:45 +0000 |
commit | 1313086ef4d901176e569d1f4b6362250ac02cd7 (patch) | |
tree | 8b3b55db16e783e6237b2b9b53125a59a2bfa101 /gm/gammatext.cpp | |
parent | 83ecdc3ac69c9208493c4c3fc8ea9f84b1350535 (diff) |
fix warnings on Mac in gm
Fix these class of warnings:
- unused functions
- unused locals
- sign mismatch
- missing function prototypes
- missing newline at end of file
- 64 to 32 bit truncation
The changes prefer to link in dead code in the debug build
with 'if (false)' than to comment it out, but trivial cases
are commented out or sometimes deleted if it appears to be
a copy/paste error.
Review URL: https://codereview.appspot.com/6305046
git-svn-id: http://skia.googlecode.com/svn/trunk@4185 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'gm/gammatext.cpp')
-rw-r--r-- | gm/gammatext.cpp | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/gm/gammatext.cpp b/gm/gammatext.cpp index 1ba382774a..bbd2409af8 100644 --- a/gm/gammatext.cpp +++ b/gm/gammatext.cpp @@ -12,10 +12,12 @@ #include "SkTypeface.h" static SkShader* make_heatGradient(const SkPoint pts[2]) { +#if 0 // UNUSED const SkColor colors[] = { SK_ColorBLACK, SK_ColorBLUE, SK_ColorCYAN, SK_ColorGREEN, SK_ColorYELLOW, SK_ColorRED, SK_ColorWHITE }; +#endif const SkColor bw[] = { SK_ColorBLACK, SK_ColorWHITE }; return SkGradientShader::CreateLinear(pts, bw, NULL, @@ -66,10 +68,10 @@ static CGFontRef typefaceToCGFont(const SkTypeface* face) { static void cgSetPaintForText(CGContextRef cg, const SkPaint& paint) { SkColor c = paint.getColor(); CGFloat rgba[] = { - SkColorGetB(c) / 255.0, - SkColorGetG(c) / 255.0, - SkColorGetR(c) / 255.0, - SkColorGetA(c) / 255.0, + SkColorGetB(c) / 255.0f, + SkColorGetG(c) / 255.0f, + SkColorGetR(c) / 255.0f, + SkColorGetA(c) / 255.0f, }; CGContextSetRGBFillColor(cg, rgba[0], rgba[1], rgba[2], rgba[3]); @@ -169,12 +171,15 @@ protected: SkScalar y = SkIntToScalar(40); SkScalar stopy = SkIntToScalar(HEIGHT); while (y < stopy) { -#if 1 - canvas->drawText(text, len, x, y, paint); -#else - cgDrawText(cg, text, len, SkScalarToFloat(x), - static_cast<float>(HEIGHT) - SkScalarToFloat(y), - paint); + if (true) { + canvas->drawText(text, len, x, y, paint); + } +#ifdef SK_BUILD_FOR_MAC + else { + cgDrawText(cg, text, len, SkScalarToFloat(x), + static_cast<float>(HEIGHT) - SkScalarToFloat(y), + paint); + } #endif y += paint.getTextSize() * 2; } |