fix warning from scalar --> int32 conversion
BUG=
Review URL: https://codereview.appspot.com/7065050
git-svn-id: http://skia.googlecode.com/svn/trunk@7061 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/gm/aaclip.cpp b/gm/aaclip.cpp
index b74f6d3..10bfdf4 100644
--- a/gm/aaclip.cpp
+++ b/gm/aaclip.cpp
@@ -36,11 +36,14 @@
return canvas;
}
+#ifdef SK_DEBUG
static void GetBitmap(const SkCanvas* canvas, SkBitmap* bm) {
*bm = canvas->getDevice()->accessBitmap(false);
}
+#endif
static void compare_canvas(const SkCanvas* a, const SkCanvas* b) {
+#ifdef SK_DEBUG
SkBitmap bma, bmb;
GetBitmap(a, &bma);
GetBitmap(b, &bmb);
@@ -60,6 +63,7 @@
SkASSERT(0xFF000000 == rowb[x]);
}
}
+#endif
}
static void drawRectAsPath(SkCanvas* canvas, const SkRect& r, const SkPaint& p) {
diff --git a/gm/bigmatrix.cpp b/gm/bigmatrix.cpp
index 31c0a38..deaf448 100644
--- a/gm/bigmatrix.cpp
+++ b/gm/bigmatrix.cpp
@@ -41,6 +41,7 @@
bool success = m.invert(&m);
SkASSERT(success);
+ (void) success; // silence compiler :(
SkPath path;
diff --git a/gm/bitmapscroll.cpp b/gm/bitmapscroll.cpp
index eee9668..a1c0ce4 100644
--- a/gm/bitmapscroll.cpp
+++ b/gm/bitmapscroll.cpp
@@ -131,10 +131,10 @@
// Scroll a new copy of the bitmap, and then draw it.
// scrollRect() should always return true, even if it's a no-op
SkBitmap scrolledBitmap;
- bool copyToReturnValue = origBitmap.copyTo(
+ SkDEBUGCODE(bool copyToReturnValue = )origBitmap.copyTo(
&scrolledBitmap, origBitmap.config());
SkASSERT(copyToReturnValue);
- bool scrollRectReturnValue = scrolledBitmap.scrollRect(
+ SkDEBUGCODE(bool scrollRectReturnValue = )scrolledBitmap.scrollRect(
subset, scrollX * xMult, scrollY * yMult);
SkASSERT(scrollRectReturnValue);
canvas->drawBitmap(scrolledBitmap, bitmapX, bitmapY);
diff --git a/gm/cmykjpeg.cpp b/gm/cmykjpeg.cpp
index 692bc3e..7ac4259 100644
--- a/gm/cmykjpeg.cpp
+++ b/gm/cmykjpeg.cpp
@@ -67,7 +67,7 @@
void forceLinking();
void forceLinking() {
- SkImageDecoder *creator = CreateJPEGImageDecoder();
+ SkDEBUGCODE(SkImageDecoder *creator = ) CreateJPEGImageDecoder();
SkASSERT(creator);
}
diff --git a/include/core/SkTypes.h b/include/core/SkTypes.h
index 1c80f0e..a8d283d 100644
--- a/include/core/SkTypes.h
+++ b/include/core/SkTypes.h
@@ -201,7 +201,7 @@
#define SK_MinS32 -SK_MaxS32
#define SK_MaxU32 0xFFFFFFFF
#define SK_MinU32 0
-#define SK_NaN32 0x80000000
+#define SK_NaN32 (1 << 31)
/** Returns true if the value can be represented with signed 16bits
*/
diff --git a/samplecode/SampleAAClip.cpp b/samplecode/SampleAAClip.cpp
index 196641e..617d786 100644
--- a/samplecode/SampleAAClip.cpp
+++ b/samplecode/SampleAAClip.cpp
@@ -18,7 +18,7 @@
c1.setRect(r1);
c2.op(c0, c1, op);
- SkIRect r2 = c2.getBounds();
+ SkDEBUGCODE(SkIRect r2 = c2.getBounds());
SkASSERT(r2 == expectedR);
}
diff --git a/samplecode/SampleColorFilter.cpp b/samplecode/SampleColorFilter.cpp
index e57ccb0..393f9b8 100644
--- a/samplecode/SampleColorFilter.cpp
+++ b/samplecode/SampleColorFilter.cpp
@@ -23,6 +23,7 @@
#define SK_R16_BITS 5
+#ifdef SK_DEBUG
static int round5_slow(int x) {
int orig = x & 7;
int fake = x >> 5;
@@ -38,15 +39,17 @@
}
return trunc + bias;
}
+#endif
static int round5_fast(int x) {
int result = x + 3 - (x >> 5) + (x >> 7);
result >>= 3;
-
+#ifdef SK_DEBUG
{
int r2 = round5_slow(x);
SkASSERT(r2 == result);
}
+#endif
return result;
}
diff --git a/samplecode/SampleRegion.cpp b/samplecode/SampleRegion.cpp
index 8b3a03c..b493ee4 100644
--- a/samplecode/SampleRegion.cpp
+++ b/samplecode/SampleRegion.cpp
@@ -274,13 +274,13 @@
{
char buffer[1000];
- size_t size = tmp.writeToMemory(NULL);
+ SkDEBUGCODE(size_t size = ) tmp.writeToMemory(NULL);
SkASSERT(size <= sizeof(buffer));
- size_t size2 = tmp.writeToMemory(buffer);
+ SkDEBUGCODE(size_t size2 = ) tmp.writeToMemory(buffer);
SkASSERT(size == size2);
SkRegion tmp3;
- size2 = tmp3.readFromMemory(buffer);
+ SkDEBUGCODE(size2 = ) tmp3.readFromMemory(buffer);
SkASSERT(size == size2);
SkASSERT(tmp3 == tmp);
diff --git a/src/animator/SkAnimateActive.cpp b/src/animator/SkAnimateActive.cpp
index 00ee9df..32dd1fb 100644
--- a/src/animator/SkAnimateActive.cpp
+++ b/src/animator/SkAnimateActive.cpp
@@ -174,7 +174,7 @@
if (animate->formula.size() > 0) {
SkTDOperandArray values;
values.setCount(count);
- bool success = animate->fFieldInfo->setValue(fMaker, &values, 0, 0, NULL,
+ SkDEBUGCODE(bool success = ) animate->fFieldInfo->setValue(fMaker, &values, 0, 0, NULL,
animate->getValuesType(), animate->formula);
SkASSERT(success);
fApply.applyValues(index, values.begin(), count, animate->getValuesType(), time);
@@ -212,7 +212,7 @@
if (animate->formula.size() > 0) {
SkTDOperandArray values;
values.setCount(count);
- bool success = animate->fFieldInfo->setValue(fMaker, &values, 0, 0, NULL,
+ SkDEBUGCODE(bool success = ) animate->fFieldInfo->setValue(fMaker, &values, 0, 0, NULL,
animate->getValuesType(), animate->formula);
SkASSERT(success);
fApply.applyValues(index, values.begin(), count, animate->getValuesType(), time);
diff --git a/src/animator/SkAnimatorScript.cpp b/src/animator/SkAnimatorScript.cpp
index 0e639f2..899cd3c 100644
--- a/src/animator/SkAnimatorScript.cpp
+++ b/src/animator/SkAnimatorScript.cpp
@@ -466,7 +466,7 @@
} break;
default: {
const char* id = NULL;
- bool success = maker->findKey(displayable, &id);
+ SkDEBUGCODE(bool success = ) maker->findKey(displayable, &id);
SkASSERT(success);
scriptValue->fOperand.fString = SkNEW_ARGS(SkString, (id));
type = SkType_String;
diff --git a/src/animator/SkDisplayApply.cpp b/src/animator/SkDisplayApply.cpp
index baa10e7..179641a 100644
--- a/src/animator/SkDisplayApply.cpp
+++ b/src/animator/SkDisplayApply.cpp
@@ -471,7 +471,7 @@
info->setValue(target, fActive->fSaveRestore[activeIndex], count);
} else {
SkScriptValue scriptValue;
- bool success = target->getProperty(info->propertyIndex(), &scriptValue);
+ SkDEBUGCODE(bool success = ) target->getProperty(info->propertyIndex(), &scriptValue);
SkASSERT(success == true);
last[0] = scriptValue.fOperand;
scriptValue.fOperand = fActive->fSaveRestore[activeIndex][0];
@@ -629,7 +629,7 @@
fLastTime = animate->dur;
SkTypedArray formulaValues;
formulaValues.setCount(count);
- bool success = animate->fFieldInfo->setValue(maker, &formulaValues, 0, 0, NULL,
+ SkDEBUGCODE(bool success = ) animate->fFieldInfo->setValue(maker, &formulaValues, 0, 0, NULL,
animate->getValuesType(), animate->formula);
SkASSERT(success);
if (restore)
@@ -761,7 +761,7 @@
info->setValue(target, last.begin(), count);
} else {
SkScriptValue scriptValue;
- bool success = target->getProperty(info->propertyIndex(), &scriptValue);
+ SkDEBUGCODE(bool success = ) target->getProperty(info->propertyIndex(), &scriptValue);
SkASSERT(success == true);
SkASSERT(scriptValue.fType == SkType_Float);
fActive->fSaveRestore[activeIndex][0] = scriptValue.fOperand;
diff --git a/src/animator/SkDisplayEvent.cpp b/src/animator/SkDisplayEvent.cpp
index 52c874b..c926a8a 100644
--- a/src/animator/SkDisplayEvent.cpp
+++ b/src/animator/SkDisplayEvent.cpp
@@ -174,7 +174,7 @@
return;
maker.fEvents.addEvent(this);
if (kind == kOnEnd) {
- bool found = maker.find(target.c_str(), &fTarget);
+ SkDEBUGCODE(bool found = ) maker.find(target.c_str(), &fTarget);
SkASSERT(found);
SkASSERT(fTarget && fTarget->isAnimate());
SkAnimateBase* animate = (SkAnimateBase*) fTarget;
diff --git a/src/animator/SkDisplayPost.cpp b/src/animator/SkDisplayPost.cpp
index a50d5cc..21cc9a7 100644
--- a/src/animator/SkDisplayPost.cpp
+++ b/src/animator/SkDisplayPost.cpp
@@ -235,7 +235,7 @@
const char* ch = sink.c_str();
do {
const char* end = strchr(ch, '.');
- size_t len = end ? end - ch : strlen(ch);
+ size_t len = end ? (size_t) (end - ch) : strlen(ch);
SkDisplayable* displayable = NULL;
if (SK_LITERAL_STR_EQUAL("parent", ch, len)) {
if (fTargetMaker->fParentMaker)
diff --git a/src/animator/SkScript.cpp b/src/animator/SkScript.cpp
index 92e8f3c..64e8b5c 100644
--- a/src/animator/SkScript.cpp
+++ b/src/animator/SkScript.cpp
@@ -1514,7 +1514,7 @@
break;
case SkType_Float:
if (type == SkType_Int) {
- if ((uint32_t)operand.fS32 == SK_NaN32)
+ if (operand.fS32 == SK_NaN32)
operand.fScalar = SK_ScalarNaN;
else if (SkAbs32(operand.fS32) == SK_MaxS32)
operand.fScalar = SkSign32(operand.fS32) * SK_ScalarMax;
@@ -1562,7 +1562,7 @@
SkScalar SkScriptEngine::IntToScalar(int32_t s32) {
SkScalar scalar;
- if ((uint32_t)s32 == SK_NaN32)
+ if (s32 == SK_NaN32)
scalar = SK_ScalarNaN;
else if (SkAbs32(s32) == SK_MaxS32)
scalar = SkSign32(s32) * SK_ScalarMax;
diff --git a/src/animator/SkScriptTokenizer.cpp b/src/animator/SkScriptTokenizer.cpp
index a1de5e5..ca6cab0 100644
--- a/src/animator/SkScriptTokenizer.cpp
+++ b/src/animator/SkScriptTokenizer.cpp
@@ -993,7 +993,7 @@
SkASSERT(arrayValue.fType == SkOperand2::kArray); // !!! add error handling
SkOpArray* array = arrayValue.fOperand.fArray;
SkOperand2 operand;
- bool success = array->getIndex(index, &operand);
+ SkDEBUGCODE(bool success = ) array->getIndex(index, &operand);
SkASSERT(success); // !!! add error handling
SkScriptValue2 resultValue;
resultValue.fType = array->getType();
diff --git a/src/core/SkLineClipper.cpp b/src/core/SkLineClipper.cpp
index 7b7746f..1e9ace5 100644
--- a/src/core/SkLineClipper.cpp
+++ b/src/core/SkLineClipper.cpp
@@ -168,6 +168,7 @@
#endif
#ifdef SK_SCALAR_IS_FLOAT
+#ifdef SK_DEBUG
// This is an example of why we need to pin the result computed in
// sect_with_horizontal. If we didn't explicitly pin, is_between_unsorted would
// fail.
@@ -181,6 +182,7 @@
SkASSERT(is_between_unsorted(x, pts[0].fX, pts[1].fX));
}
#endif
+#endif
int SkLineClipper::ClipLine(const SkPoint pts[], const SkRect& clip,
SkPoint lines[]) {
diff --git a/src/core/SkOrderedReadBuffer.cpp b/src/core/SkOrderedReadBuffer.cpp
index 29c036e..daca74c 100644
--- a/src/core/SkOrderedReadBuffer.cpp
+++ b/src/core/SkOrderedReadBuffer.cpp
@@ -95,7 +95,7 @@
}
void* SkOrderedReadBuffer::readEncodedString(size_t* length, SkPaint::TextEncoding encoding) {
- int32_t encodingType = fReader.readInt();
+ SkDEBUGCODE(int32_t encodingType = ) fReader.readInt();
SkASSERT(encodingType == encoding);
*length = fReader.readInt();
void* data = sk_malloc_throw(*length);
diff --git a/src/core/SkScan_Antihair.cpp b/src/core/SkScan_Antihair.cpp
index 3cbd809..b671a7b 100644
--- a/src/core/SkScan_Antihair.cpp
+++ b/src/core/SkScan_Antihair.cpp
@@ -344,10 +344,12 @@
}
#endif
+#ifdef SK_DEBUG
static bool canConvertFDot6ToFixed(SkFDot6 x) {
const int maxDot6 = SK_MaxS32 >> (16 - 6);
return SkAbs32(x) <= maxDot6;
}
+#endif
/*
* We want the fractional part of ordinate, but we want multiples of 64 to
diff --git a/src/core/SkScan_Hairline.cpp b/src/core/SkScan_Hairline.cpp
index 69095c0..9e567b6 100644
--- a/src/core/SkScan_Hairline.cpp
+++ b/src/core/SkScan_Hairline.cpp
@@ -33,10 +33,12 @@
} while (++y < stopy);
}
+#ifdef SK_DEBUG
static bool canConvertFDot6ToFixed(SkFDot6 x) {
const int maxDot6 = SK_MaxS32 >> (16 - 6);
return SkAbs32(x) <= maxDot6;
}
+#endif
void SkScan::HairLineRgn(const SkPoint& pt0, const SkPoint& pt1,
const SkRegion* clip, SkBlitter* blitter) {
diff --git a/src/effects/SkKernel33MaskFilter.cpp b/src/effects/SkKernel33MaskFilter.cpp
index 0f198cd..a8c8661 100644
--- a/src/effects/SkKernel33MaskFilter.cpp
+++ b/src/effects/SkKernel33MaskFilter.cpp
@@ -113,7 +113,7 @@
SkKernel33MaskFilter::SkKernel33MaskFilter(SkFlattenableReadBuffer& rb)
: SkKernel33ProcMaskFilter(rb) {
- const uint32_t count = rb.readIntArray(&fKernel[0][0]);
+ SkDEBUGCODE(const uint32_t count = )rb.readIntArray(&fKernel[0][0]);
SkASSERT(9 == count);
fShift = rb.readInt();
}
diff --git a/src/effects/SkMatrixConvolutionImageFilter.cpp b/src/effects/SkMatrixConvolutionImageFilter.cpp
index b5188b3..74a1163 100644
--- a/src/effects/SkMatrixConvolutionImageFilter.cpp
+++ b/src/effects/SkMatrixConvolutionImageFilter.cpp
@@ -43,7 +43,7 @@
fKernelSize.fHeight = buffer.readInt();
uint32_t size = fKernelSize.fWidth * fKernelSize.fHeight;
fKernel = SkNEW_ARRAY(SkScalar, size);
- uint32_t readSize = buffer.readScalarArray(fKernel);
+ SkDEBUGCODE(uint32_t readSize = )buffer.readScalarArray(fKernel);
SkASSERT(readSize == size);
fGain = buffer.readScalar();
fBias = buffer.readScalar();
diff --git a/src/effects/SkTableColorFilter.cpp b/src/effects/SkTableColorFilter.cpp
index ad34fbb..ff30636 100644
--- a/src/effects/SkTableColorFilter.cpp
+++ b/src/effects/SkTableColorFilter.cpp
@@ -181,10 +181,10 @@
SkASSERT(size <= sizeof(storage));
buffer.readByteArray(storage);
- size_t raw = SkPackBits::Unpack8(storage, size, fStorage);
+ SkDEBUGCODE(size_t raw = ) SkPackBits::Unpack8(storage, size, fStorage);
SkASSERT(raw <= sizeof(fStorage));
- size_t count = gCountNibBits[fFlags & 0xF];
+ SkDEBUGCODE(size_t count = gCountNibBits[fFlags & 0xF]);
SkASSERT(raw == count * 256);
}
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index 5961aaf..4e9f837 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -341,7 +341,7 @@
size_t stretchedRowBytes = rtDesc.fWidth * bpp;
- GrTexture* texture = fGpu->createTexture(rtDesc, stretchedPixels.get(), stretchedRowBytes);
+ SkDEBUGCODE(GrTexture* texture = )fGpu->createTexture(rtDesc, stretchedPixels.get(), stretchedRowBytes);
GrAssert(NULL != texture);
}
diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp
index 976448d..a67be1c 100644
--- a/src/gpu/GrDrawTarget.cpp
+++ b/src/gpu/GrDrawTarget.cpp
@@ -93,6 +93,7 @@
};
GR_STATIC_ASSERT(GrDrawState::kMaxTexCoords == GR_ARRAY_COUNT(gTexCoordMasks));
+#ifdef SK_DEBUG
bool check_layout(GrVertexLayout layout) {
// can only have 1 or 0 bits set for each stage.
for (int s = 0; s < GrDrawState::kNumStages; ++s) {
@@ -103,6 +104,7 @@
}
return true;
}
+#endif
int num_tex_coords(GrVertexLayout layout) {
int cnt = 0;
@@ -467,7 +469,7 @@
GrDrawTarget::~GrDrawTarget() {
GrAssert(1 == fGeoSrcStateStack.count());
- GeometrySrcState& geoSrc = fGeoSrcStateStack.back();
+ SkDEBUGCODE(GeometrySrcState& geoSrc = fGeoSrcStateStack.back());
GrAssert(kNone_GeometrySrcType == geoSrc.fIndexSrc);
GrAssert(kNone_GeometrySrcType == geoSrc.fVertexSrc);
fDrawState->unref();
diff --git a/src/gpu/GrGpu.cpp b/src/gpu/GrGpu.cpp
index b8f43d8..d6a6e44 100644
--- a/src/gpu/GrGpu.cpp
+++ b/src/gpu/GrGpu.cpp
@@ -360,6 +360,8 @@
newState.fPoolStartVertex = DEBUG_INVAL_START_IDX;
newState.fPoolIndexBuffer = (GrIndexBuffer*)DEBUG_INVAL_BUFFER;
newState.fPoolStartIndex = DEBUG_INVAL_START_IDX;
+#else
+ (void) newState; // silence compiler warning
#endif
}
diff --git a/src/gpu/GrMemoryPool.cpp b/src/gpu/GrMemoryPool.cpp
index 17d70ab..2518a74 100644
--- a/src/gpu/GrMemoryPool.cpp
+++ b/src/gpu/GrMemoryPool.cpp
@@ -119,6 +119,7 @@
}
void GrMemoryPool::validate() {
+#ifdef SK_DEBUG
BlockHeader* block = fHead;
BlockHeader* prev = NULL;
GrAssert(block);
@@ -156,5 +157,6 @@
} while ((block = block->fNext));
GrAssert(allocCount == fAllocationCnt);
GrAssert(prev == fTail);
+#endif
}
diff --git a/src/gpu/GrPathUtils.cpp b/src/gpu/GrPathUtils.cpp
index 4092959..d3d784c 100644
--- a/src/gpu/GrPathUtils.cpp
+++ b/src/gpu/GrPathUtils.cpp
@@ -251,7 +251,7 @@
m.postConcat(UVpts);
// The matrix should not have perspective.
- static const SkScalar gTOL = SkFloatToScalar(1.f / 100.f);
+ SkDEBUGCODE(static const SkScalar gTOL = SkFloatToScalar(1.f / 100.f));
GrAssert(SkScalarAbs(m.get(SkMatrix::kMPersp0)) < gTOL);
GrAssert(SkScalarAbs(m.get(SkMatrix::kMPersp1)) < gTOL);
diff --git a/src/gpu/GrRedBlackTree.h b/src/gpu/GrRedBlackTree.h
index 5038bb0..2ccf77f 100644
--- a/src/gpu/GrRedBlackTree.h
+++ b/src/gpu/GrRedBlackTree.h
@@ -956,7 +956,7 @@
// add 10K ints
for (int i = 0; i < 10000; ++i) {
int x = r.nextU()%100;
- Iter xi = tree.insert(x);
+ SkDEBUGCODE(Iter xi = ) tree.insert(x);
GrAssert(*xi == x);
++count[x];
}
diff --git a/src/gpu/gl/GrGLPath.cpp b/src/gpu/gl/GrGLPath.cpp
index 5324dcd..1de8713 100644
--- a/src/gpu/gl/GrGLPath.cpp
+++ b/src/gpu/gl/GrGLPath.cpp
@@ -33,6 +33,7 @@
return gTable[verb];
}
+#ifdef SK_DEBUG
inline int num_pts(const SkPath::Verb verb) {
static const int gTable[] = {
1, // move
@@ -50,6 +51,7 @@
GrAssert(verb >= 0 && (size_t)verb < GR_ARRAY_COUNT(gTable));
return gTable[verb];
}
+#endif
}
GrGLPath::GrGLPath(GrGpuGL* gpu, const SkPath& path) : INHERITED(gpu) {
diff --git a/src/gpu/gl/GrGLShaderBuilder.cpp b/src/gpu/gl/GrGLShaderBuilder.cpp
index c00cf91..0845fdd 100644
--- a/src/gpu/gl/GrGLShaderBuilder.cpp
+++ b/src/gpu/gl/GrGLShaderBuilder.cpp
@@ -172,7 +172,7 @@
int count,
const char** outName) {
GrAssert(name && strlen(name));
- static const uint32_t kVisibilityMask = kVertex_ShaderType | kFragment_ShaderType;
+ SkDEBUGCODE(static const uint32_t kVisibilityMask = kVertex_ShaderType | kFragment_ShaderType);
GrAssert(0 == (~kVisibilityMask & visibility));
GrAssert(0 != visibility);
diff --git a/src/pipe/utils/SamplePipeControllers.cpp b/src/pipe/utils/SamplePipeControllers.cpp
index 59f612b..98fdff3 100644
--- a/src/pipe/utils/SamplePipeControllers.cpp
+++ b/src/pipe/utils/SamplePipeControllers.cpp
@@ -51,7 +51,7 @@
rect.setLTRB(0, top, bitmap.width(), bottom);
top = bottom;
- bool extracted = bitmap.extractSubset(&fBitmaps[i], rect);
+ SkDEBUGCODE(bool extracted = )bitmap.extractSubset(&fBitmaps[i], rect);
SkASSERT(extracted);
SkDevice* device = new SkDevice(fBitmaps[i]);
SkCanvas* canvas = new SkCanvas(device);
diff --git a/src/ports/SkFontHost_mac_coretext.cpp b/src/ports/SkFontHost_mac_coretext.cpp
index 527b981..bc020e7 100644
--- a/src/ports/SkFontHost_mac_coretext.cpp
+++ b/src/ports/SkFontHost_mac_coretext.cpp
@@ -1524,12 +1524,15 @@
info->fDescent = (int16_t) CTFontGetDescent(ctFont);
info->fCapHeight = (int16_t) CTFontGetCapHeight(ctFont);
CGRect bbox = CTFontGetBoundingBox(ctFont);
- info->fBBox = SkIRect::MakeLTRB(
- CGToScalar(CGRectGetMinX_inline(bbox)), // Left
- CGToScalar(CGRectGetMaxY_inline(bbox)), // Top
- CGToScalar(CGRectGetMaxX_inline(bbox)), // Right
- CGToScalar(CGRectGetMinY_inline(bbox))); // Bottom
-
+
+ SkRect r;
+ r.set( CGToScalar(CGRectGetMinX_inline(bbox)), // Left
+ CGToScalar(CGRectGetMaxY_inline(bbox)), // Top
+ CGToScalar(CGRectGetMaxX_inline(bbox)), // Right
+ CGToScalar(CGRectGetMinY_inline(bbox))); // Bottom
+
+ r.roundOut(&(info->fBBox));
+
// Figure out a good guess for StemV - Min width of i, I, !, 1.
// This probably isn't very good with an italic font.
int16_t min_width = SHRT_MAX;
diff --git a/src/sfnt/SkOTTable_glyf.h b/src/sfnt/SkOTTable_glyf.h
index 30c99f6..ac34d7b 100644
--- a/src/sfnt/SkOTTable_glyf.h
+++ b/src/sfnt/SkOTTable_glyf.h
@@ -40,7 +40,7 @@
void advance(uint16_t num) {
fLocaPtr.shortOffset += num << fLocaFormat;
fCurrentGlyphOffset = fLocaFormat ? SkEndian_SwapBE32(*fLocaPtr.longOffset)
- : SkEndian_SwapBE16(*fLocaPtr.shortOffset) << 1;
+ : uint32_t(SkEndian_SwapBE16(*fLocaPtr.shortOffset) << 1);
}
const SkOTTableGlyphData* next() {
uint32_t previousGlyphOffset = fCurrentGlyphOffset;
diff --git a/src/utils/SkInterpolator.cpp b/src/utils/SkInterpolator.cpp
index 2ef2702..146adc2 100644
--- a/src/utils/SkInterpolator.cpp
+++ b/src/utils/SkInterpolator.cpp
@@ -81,7 +81,7 @@
if (offsetTime >= endTime) {
SkScalar fraction = SkScalarFraction(fRepeat);
offsetTime = fraction == 0 && fRepeat > 0 ? totalTime :
- SkScalarMulFloor(fraction, totalTime);
+ (SkMSec) SkScalarMulFloor(fraction, totalTime);
result = kFreezeEnd_Result;
} else {
int mirror = fFlags & kMirror;
diff --git a/src/xml/SkBML_XMLParser.cpp b/src/xml/SkBML_XMLParser.cpp
index dbdfe4b..bf49782 100644
--- a/src/xml/SkBML_XMLParser.cpp
+++ b/src/xml/SkBML_XMLParser.cpp
@@ -15,7 +15,7 @@
static uint8_t rbyte(SkStream& s)
{
uint8_t b;
- size_t size = s.read(&b, 1);
+ SkDEBUGCODE(size_t size = ) s.read(&b, 1);
SkASSERT(size == 1);
return b;
}
diff --git a/tests/WritePixelsTest.cpp b/tests/WritePixelsTest.cpp
index f5c4175..715d8f7 100644
--- a/tests/WritePixelsTest.cpp
+++ b/tests/WritePixelsTest.cpp
@@ -136,7 +136,7 @@
static SkBitmap bmp;
if (bmp.isNull()) {
bmp.setConfig(SkBitmap::kARGB_8888_Config, DEV_W, DEV_H);
- bool alloc = bmp.allocPixels();
+ SkDEBUGCODE(bool alloc = ) bmp.allocPixels();
SkASSERT(alloc);
SkAutoLockPixels alp(bmp);
intptr_t pixels = reinterpret_cast<intptr_t>(bmp.getPixels());