skia2/samplecode
reed@google.com 82065d667f remove SkRefCnt safeRef() and safeUnref(), and replace the call-sites with
SkSafeRef() and SkSafeUnref().

This is basically a bug waiting to happen. An optimizing compiler can remove
checks for null on "this" if it chooses. However, SkRefCnt::safeRef() relies on
precisely this check...

void SkRefCnt::safeRef() {
    if (this) {
        this->ref();
    }
}

Since a compiler might skip the if-clause, it breaks the intention of this
method, hence its removal.

static inline void SkSafeRef(SkRefCnt* obj) {
    if (obj) {
        obj->ref();
    }
}

This form is not ignored by an optimizing compile, so we use it instead.




git-svn-id: http://skia.googlecode.com/svn/trunk@762 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-02-07 15:30:46 +00:00
..
ClockFaceView.cpp experiment 2009-10-20 03:26:17 +00:00
OverView.cpp add onSendClickToChildren to views, so a view can capture all clicks. 2009-11-16 14:52:01 +00:00
SampleAll.cpp merge with changes for GPU backend 2010-12-20 18:26:13 +00:00
SampleAnimator.cpp updates 2010-05-17 14:50:04 +00:00
SampleApp.cpp Rev the GrContext interface. Context has draw* functions that take a new GrPaint object. Removed many of the lower-level GrGpu function call-throughs on context. 2011-01-21 21:03:59 +00:00
SampleArc.cpp updates 2010-04-22 16:07:49 +00:00
SampleAvoid.cpp update dox for SkAvoidXfermode (as best I could) 2009-11-09 16:01:36 +00:00
SampleBigGradient.cpp add dithering to 32bit linear gradients 2011-01-13 16:22:35 +00:00
SampleBitmapRect.cpp merge with changes for GPU backend 2010-12-20 18:26:13 +00:00
SampleBlur.cpp update with tests for blur 2009-09-18 20:57:05 +00:00
SampleCamera.cpp merge with changes for GPU backend 2010-12-20 18:26:13 +00:00
SampleCircle.cpp merge with changes for GPU backend 2010-12-20 18:26:13 +00:00
SampleCode.h merge with changes for GPU backend 2010-12-20 18:26:13 +00:00
SampleCull.cpp grab from latest android 2008-12-17 15:59:43 +00:00
SampleDecode.cpp respect preferred config when png is index-based 2009-07-08 20:09:23 +00:00
SampleDither.cpp add CG imagedecoder (still needs encoding) 2008-12-23 16:06:51 +00:00
SampleDitherBitmap.cpp expand SkShader's flag kConstInY to 16 and 32 variants, allowing a shader 2009-08-27 19:28:37 +00:00
SampleDrawLooper.cpp remove SkRefCnt safeRef() and safeUnref(), and replace the call-sites with 2011-02-07 15:30:46 +00:00
SampleEffects.cpp updates 2010-04-22 16:07:49 +00:00
SampleEmboss.cpp add CG imagedecoder (still needs encoding) 2008-12-23 16:06:51 +00:00
SampleEncode.cpp check if the encoder factory returned null 2009-07-07 21:18:10 +00:00
SampleExtractAlpha.cpp update 2009-09-02 21:11:44 +00:00
SampleFillType.cpp tweaks to 16bit shaders 2009-07-10 15:58:53 +00:00
SampleFilter2.cpp remove remaining references to porterduff 2009-06-23 12:19:41 +00:00
SampleFilter.cpp add CG imagedecoder (still needs encoding) 2008-12-23 16:06:51 +00:00
SampleFontCache.cpp updates 2010-04-22 16:07:49 +00:00
SampleFontScalerTest.cpp remove SkRefCnt safeRef() and safeUnref(), and replace the call-sites with 2011-02-07 15:30:46 +00:00
SampleFuzz.cpp fix cheap calc of edgelist size 2009-11-05 21:04:00 +00:00
SampleGM.cpp git-svn-id: http://skia.googlecode.com/svn/trunk@685 2bbb7eff-a529-9590-31e7-b0007b416f81 2011-01-11 19:45:38 +00:00
SampleGradients.cpp merge with changes for GPU backend 2010-12-20 18:26:13 +00:00
SampleHairline.cpp add unittest for IntersectLine, used by hairlines 2009-11-30 12:48:33 +00:00
SampleImage.cpp remove remaining references to porterduff 2009-06-23 12:19:41 +00:00
SampleImageDir.cpp remove remaining references to porterduff 2009-06-23 12:19:41 +00:00
SampleLayerMask.cpp detect nearly translate-only matrices when drawing bitmaps (for speed) 2009-06-24 12:41:42 +00:00
SampleLayers.cpp merge with changes for GPU backend 2010-12-20 18:26:13 +00:00
SampleLCD.cpp rename SK_BUILD_SUBPIXEL to SK_SUPPORT_LCDTEXT to better match the name of the 2009-07-22 19:21:01 +00:00
SampleLineClipper.cpp add SampleCode::GetAnimTime() so slides go through a central location for 2009-11-23 21:07:51 +00:00
SampleLines.cpp merge with changes for GPU backend 2010-12-20 18:26:13 +00:00
SampleMeasure.cpp add CG imagedecoder (still needs encoding) 2008-12-23 16:06:51 +00:00
SampleMipMap.cpp merge with changes for GPU backend 2010-12-20 18:26:13 +00:00
SampleMovie.cpp remove SkRefCnt safeRef() and safeUnref(), and replace the call-sites with 2011-02-07 15:30:46 +00:00
SampleNinePatch.cpp updates 2010-04-22 16:07:49 +00:00
SampleOverflow.cpp grab from latest android 2008-12-17 15:59:43 +00:00
SamplePageFlip.cpp remove deprecated use of porterduff enum 2009-06-23 03:01:32 +00:00
SamplePatch.cpp remove SkRefCnt safeRef() and safeUnref(), and replace the call-sites with 2011-02-07 15:30:46 +00:00
SamplePath.cpp merge with changes for GPU backend 2010-12-20 18:26:13 +00:00
SamplePathClip.cpp add onSendClickToChildren to views, so a view can capture all clicks. 2009-11-16 14:52:01 +00:00
SamplePathEffects.cpp merge with changes for GPU backend 2010-12-20 18:26:13 +00:00
SamplePicture.cpp updates 2010-04-22 16:07:49 +00:00
SamplePoints.cpp merge with changes for GPU backend 2010-12-20 18:26:13 +00:00
SamplePolyToPoly.cpp grab from latest android 2008-12-17 15:59:43 +00:00
SampleRegion.cpp merge with changes for GPU backend 2010-12-20 18:26:13 +00:00
SampleRepeatTile.cpp test for non-scaled bitmap tiles 2009-08-13 19:33:44 +00:00
SampleShaders.cpp remove SkRefCnt safeRef() and safeUnref(), and replace the call-sites with 2011-02-07 15:30:46 +00:00
SampleShaderText.cpp Add shaded text sample and gm test. 2011-01-25 18:35:26 +00:00
SampleShapes.cpp merge with changes for GPU backend 2010-12-20 18:26:13 +00:00
SampleSkLayer.cpp updates 2010-04-22 16:07:49 +00:00
SampleSlides.cpp merge with changes for GPU backend 2010-12-20 18:26:13 +00:00
SampleStrokePath.cpp update to try out programmable shaders 2010-01-25 22:02:44 +00:00
SampleStrokeText.cpp detect nearly translate-only matrices when drawing bitmaps (for speed) 2009-06-24 12:41:42 +00:00
SampleSVG.cpp updates 2010-05-17 14:50:04 +00:00
SampleTestGL.cpp merge with changes for GPU backend 2010-12-20 18:26:13 +00:00
SampleTests.cpp remove remaining references to porterduff 2009-06-23 12:19:41 +00:00
SampleText.cpp remove SkRefCnt safeRef() and safeUnref(), and replace the call-sites with 2011-02-07 15:30:46 +00:00
SampleTextAlpha.cpp remove remaining references to porterduff 2009-06-23 12:19:41 +00:00
SampleTextBox.cpp updates 2010-05-17 14:50:04 +00:00
SampleTextEffects.cpp remove SkRefCnt safeRef() and safeUnref(), and replace the call-sites with 2011-02-07 15:30:46 +00:00
SampleTextOnPath.cpp merge with changes for GPU backend 2010-12-20 18:26:13 +00:00
SampleTiling.cpp merge with changes for GPU backend 2010-12-20 18:26:13 +00:00
SampleTinyBitmap.cpp merge with changes for GPU backend 2010-12-20 18:26:13 +00:00
SampleTriangles.cpp fix dumpcanvas to recurse on pictures and shapes 2009-06-05 12:24:41 +00:00
SampleTypeface.cpp remove SkRefCnt safeRef() and safeUnref(), and replace the call-sites with 2011-02-07 15:30:46 +00:00
SampleUnitMapper.cpp use statictextviews to display coordinates in unitmapper 2010-02-08 21:45:03 +00:00
SampleVertices.cpp remove SkRefCnt safeRef() and safeUnref(), and replace the call-sites with 2011-02-07 15:30:46 +00:00
SampleWarp.cpp updates 2010-04-22 16:07:49 +00:00
SampleXfermodes.cpp merge with changes for GPU backend 2010-12-20 18:26:13 +00:00
vertexdump.cpp grab from latest android 2008-12-17 15:59:43 +00:00