diff options
| author | halcanary@google.com <halcanary@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2014-01-10 14:53:49 +0000 |
|---|---|---|
| committer | halcanary@google.com <halcanary@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2014-01-10 14:53:49 +0000 |
| commit | 9acb8cdf20423e80d5687ba3c8e11545e3bc8020 (patch) | |
| tree | 4f40494195f6c4d41ab3925c6e4f0ff376eeaec4 /samplecode/SampleDitherBitmap.cpp | |
| parent | 6791138dc0a2dc4bb77eebfd56da408104c18eab (diff) | |
SampleApp Cleanup:
- Set resoursePath to sensible default.
- Remove verbosity of DitherBitmap.
- SampleEncode no longer tries to mkdir('/encoded'), now stores
encoded data in memory and uses the SkDecodingImageGenerator
to decode.
BUG=
R=reed@google.com
Review URL: https://codereview.chromium.org/132513003
git-svn-id: http://skia.googlecode.com/svn/trunk@13015 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'samplecode/SampleDitherBitmap.cpp')
| -rw-r--r-- | samplecode/SampleDitherBitmap.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/samplecode/SampleDitherBitmap.cpp b/samplecode/SampleDitherBitmap.cpp index 9132ceb195..dc439002d0 100644 --- a/samplecode/SampleDitherBitmap.cpp +++ b/samplecode/SampleDitherBitmap.cpp @@ -37,7 +37,7 @@ static void draw_gradient(SkCanvas* canvas) { draw_rect(canvas, r, p); } -static void test_pathregion() { +static bool test_pathregion() { SkPath path; SkRegion region; path.moveTo(25071800.f, -141823808.f); @@ -49,8 +49,7 @@ static void test_pathregion() { SkIRect bounds; path.getBounds().round(&bounds); SkRegion clip(bounds); - bool result = region.setPath(path, clip); // <-- !! DOWN !! - SkDebugf("----- result %d\n", result); + return region.setPath(path, clip); // <-- !! DOWN !! } static SkBitmap make_bitmap() { @@ -79,9 +78,10 @@ static SkBitmap make_bitmap() { class DitherBitmapView : public SampleView { SkBitmap fBM8; SkBitmap fBM32; + bool fResult; public: DitherBitmapView() { - test_pathregion(); + fResult = test_pathregion(); fBM8 = make_bitmap(); fBM8.copyTo(&fBM32, SkBitmap::kARGB_8888_Config); @@ -138,6 +138,14 @@ protected: canvas->translate(0, SkIntToScalar(fBM8.height() *3)); draw_gradient(canvas); + + char resultTrue[] = "SkRegion::setPath returned true"; + char resultFalse[] = "SkRegion::setPath returned false"; + SkPaint p; + if (fResult) + canvas->drawText(resultTrue, sizeof(resultTrue) - 1, 0, 50, p); + else + canvas->drawText(resultFalse, sizeof(resultFalse) - 1, 0, 50, p); } private: |
