diff options
Diffstat (limited to 'src')
27 files changed, 48 insertions, 31 deletions
diff --git a/src/animator/SkAnimateActive.cpp b/src/animator/SkAnimateActive.cpp index 00ee9df451..32dd1fb1ad 100644 --- a/src/animator/SkAnimateActive.cpp +++ b/src/animator/SkAnimateActive.cpp @@ -174,7 +174,7 @@ void SkActive::create(SkDrawable* drawable, SkMSec time) { 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 @@ bool SkActive::immediate(bool enable) { 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 0e639f29e4..899cd3c70f 100644 --- a/src/animator/SkAnimatorScript.cpp +++ b/src/animator/SkAnimatorScript.cpp @@ -466,7 +466,7 @@ bool SkAnimatorScript::Unbox(void* m, SkScriptValue* scriptValue) { } 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 baa10e7c3f..179641a22f 100644 --- a/src/animator/SkDisplayApply.cpp +++ b/src/animator/SkDisplayApply.cpp @@ -471,7 +471,7 @@ void SkApply::endSave(int index) { 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 @@ bool SkApply::interpolate(SkAnimateMaker& maker, SkMSec rawTime) { 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 @@ void SkApply::save(int index) { 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 52c874b68a..c926a8aea0 100644 --- a/src/animator/SkDisplayEvent.cpp +++ b/src/animator/SkDisplayEvent.cpp @@ -174,7 +174,7 @@ void SkDisplayEvent::onEndElement(SkAnimateMaker& maker) 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 a50d5cce93..21cc9a77e7 100644 --- a/src/animator/SkDisplayPost.cpp +++ b/src/animator/SkDisplayPost.cpp @@ -235,7 +235,7 @@ void SkPost::findSinkID() { 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 92e8f3c23e..64e8b5cf1b 100644 --- a/src/animator/SkScript.cpp +++ b/src/animator/SkScript.cpp @@ -1514,7 +1514,7 @@ bool SkScriptEngine::ConvertTo(SkScriptEngine* engine, SkDisplayTypes toType, Sk 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 @@ bool SkScriptEngine::ConvertTo(SkScriptEngine* engine, SkDisplayTypes toType, Sk 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 a1de5e5792..ca6cab0d34 100644 --- a/src/animator/SkScriptTokenizer.cpp +++ b/src/animator/SkScriptTokenizer.cpp @@ -993,7 +993,7 @@ void SkScriptEngine2::processLogicalOp(Op op) { 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 7b7746f76f..1e9ace53be 100644 --- a/src/core/SkLineClipper.cpp +++ b/src/core/SkLineClipper.cpp @@ -168,6 +168,7 @@ static bool is_between_unsorted(SkScalar value, #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 @@ static void sect_with_horizontal_test_for_pin_results() { 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 29c036e49d..daca74c090 100644 --- a/src/core/SkOrderedReadBuffer.cpp +++ b/src/core/SkOrderedReadBuffer.cpp @@ -95,7 +95,7 @@ char* SkOrderedReadBuffer::readString() { } 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 3cbd809d9d..b671a7ba5a 100644 --- a/src/core/SkScan_Antihair.cpp +++ b/src/core/SkScan_Antihair.cpp @@ -344,10 +344,12 @@ static int any_bad_ints(int a, int b, int c, int d) { } #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 69095c0c6d..9e567b6d25 100644 --- a/src/core/SkScan_Hairline.cpp +++ b/src/core/SkScan_Hairline.cpp @@ -33,10 +33,12 @@ static void vertline(int y, int stopy, SkFixed fx, SkFixed dx, } 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 0f198cd371..a8c8661359 100644 --- a/src/effects/SkKernel33MaskFilter.cpp +++ b/src/effects/SkKernel33MaskFilter.cpp @@ -113,7 +113,7 @@ void SkKernel33MaskFilter::flatten(SkFlattenableWriteBuffer& wb) const { 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 b5188b324b..74a11633e4 100644 --- a/src/effects/SkMatrixConvolutionImageFilter.cpp +++ b/src/effects/SkMatrixConvolutionImageFilter.cpp @@ -43,7 +43,7 @@ SkMatrixConvolutionImageFilter::SkMatrixConvolutionImageFilter(SkFlattenableRead 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 ad34fbb6c6..ff30636ec7 100644 --- a/src/effects/SkTableColorFilter.cpp +++ b/src/effects/SkTableColorFilter.cpp @@ -181,10 +181,10 @@ SkTable_ColorFilter::SkTable_ColorFilter(SkFlattenableReadBuffer& buffer) : INHE 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 5961aaf8ff..4e9f837867 100644 --- a/src/gpu/GrContext.cpp +++ b/src/gpu/GrContext.cpp @@ -341,7 +341,7 @@ GrTexture* GrContext::createResizedTexture(const GrTextureDesc& desc, 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 976448d699..a67be1c550 100644 --- a/src/gpu/GrDrawTarget.cpp +++ b/src/gpu/GrDrawTarget.cpp @@ -93,6 +93,7 @@ const GrVertexLayout gTexCoordMasks[] = { }; 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 @@ bool check_layout(GrVertexLayout layout) { } return true; } +#endif int num_tex_coords(GrVertexLayout layout) { int cnt = 0; @@ -467,7 +469,7 @@ GrDrawTarget::GrDrawTarget() : fClip(NULL) { 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 b8f43d81c5..d6a6e44ca8 100644 --- a/src/gpu/GrGpu.cpp +++ b/src/gpu/GrGpu.cpp @@ -360,6 +360,8 @@ void GrGpu::geometrySourceWillPush() { 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 17d70ab90d..2518a7486f 100644 --- a/src/gpu/GrMemoryPool.cpp +++ b/src/gpu/GrMemoryPool.cpp @@ -119,6 +119,7 @@ void GrMemoryPool::DeleteBlock(BlockHeader* block) { } void GrMemoryPool::validate() { +#ifdef SK_DEBUG BlockHeader* block = fHead; BlockHeader* prev = NULL; GrAssert(block); @@ -156,5 +157,6 @@ void GrMemoryPool::validate() { } while ((block = block->fNext)); GrAssert(allocCount == fAllocationCnt); GrAssert(prev == fTail); +#endif } diff --git a/src/gpu/GrPathUtils.cpp b/src/gpu/GrPathUtils.cpp index 4092959c29..d3d784c1ca 100644 --- a/src/gpu/GrPathUtils.cpp +++ b/src/gpu/GrPathUtils.cpp @@ -251,7 +251,7 @@ void GrPathUtils::QuadUVMatrix::set(const GrPoint qPts[3]) { 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 5038bb07bd..2ccf77fb50 100644 --- a/src/gpu/GrRedBlackTree.h +++ b/src/gpu/GrRedBlackTree.h @@ -956,7 +956,7 @@ void GrRedBlackTree<T,C>::UnitTest() { // 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 5324dcd1fe..1de8713774 100644 --- a/src/gpu/gl/GrGLPath.cpp +++ b/src/gpu/gl/GrGLPath.cpp @@ -33,6 +33,7 @@ inline GrGLubyte verb_to_gl_path_cmd(const SkPath::Verb verb) { return gTable[verb]; } +#ifdef SK_DEBUG inline int num_pts(const SkPath::Verb verb) { static const int gTable[] = { 1, // move @@ -50,6 +51,7 @@ inline int num_pts(const SkPath::Verb verb) { 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 c00cf91686..0845fdd225 100644 --- a/src/gpu/gl/GrGLShaderBuilder.cpp +++ b/src/gpu/gl/GrGLShaderBuilder.cpp @@ -172,7 +172,7 @@ GrGLUniformManager::UniformHandle GrGLShaderBuilder::addUniformArray(uint32_t vi 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 59f612bf00..98fdff31d6 100644 --- a/src/pipe/utils/SamplePipeControllers.cpp +++ b/src/pipe/utils/SamplePipeControllers.cpp @@ -51,7 +51,7 @@ TiledPipeController::TiledPipeController(const SkBitmap& bitmap, 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 527b9816ce..bc020e78ff 100644 --- a/src/ports/SkFontHost_mac_coretext.cpp +++ b/src/ports/SkFontHost_mac_coretext.cpp @@ -1524,12 +1524,15 @@ SkAdvancedTypefaceMetrics* SkFontHost::GetAdvancedTypefaceMetrics( 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 30c99f62fa..ac34d7b816 100644 --- a/src/sfnt/SkOTTable_glyf.h +++ b/src/sfnt/SkOTTable_glyf.h @@ -40,7 +40,7 @@ struct SkOTTableGlyph { 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 2ef27020d6..146adc2848 100644 --- a/src/utils/SkInterpolator.cpp +++ b/src/utils/SkInterpolator.cpp @@ -81,7 +81,7 @@ SkInterpolatorBase::Result SkInterpolatorBase::timeToT(SkMSec time, SkScalar* T, 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 dbdfe4b4da..bf497821da 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; } |