| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 #include "SampleCode.h" | 8 #include "SampleCode.h" |
| 9 #include "SkView.h" | 9 #include "SkView.h" |
| 10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 path.lineTo(x + radius + thickness, y); | 63 path.lineTo(x + radius + thickness, y); |
| 64 // outer arc | 64 // outer arc |
| 65 path.arcTo(bounds, 0, sweep, false); | 65 path.arcTo(bounds, 0, sweep, false); |
| 66 // inner arc | 66 // inner arc |
| 67 path.arcTo(innerBounds, sweep, -sweep, false); | 67 path.arcTo(innerBounds, sweep, -sweep, false); |
| 68 path.close(); | 68 path.close(); |
| 69 } | 69 } |
| 70 } | 70 } |
| 71 | 71 |
| 72 static void make_bm(SkBitmap* bm) { | 72 static void make_bm(SkBitmap* bm) { |
| 73 bm->setConfig(SkBitmap::kARGB_8888_Config, 100, 100); | 73 bm->allocN32Pixels(100, 100); |
| 74 bm->allocPixels(); | |
| 75 #if 0 | |
| 76 bm->eraseColor(SK_ColorBLUE); | |
| 77 return; | |
| 78 #else | |
| 79 bm->eraseColor(SK_ColorTRANSPARENT); | 74 bm->eraseColor(SK_ColorTRANSPARENT); |
| 80 #endif | |
| 81 | 75 |
| 82 SkCanvas c(*bm); | 76 SkCanvas c(*bm); |
| 83 draw_sweep(&c, bm->width(), bm->height(), 0); | 77 draw_sweep(&c, bm->width(), bm->height(), 0); |
| 84 } | 78 } |
| 85 | 79 |
| 86 static void pre_dither(const SkBitmap& bm) { | 80 static void pre_dither(const SkBitmap& bm) { |
| 87 SkAutoLockPixels alp(bm); | 81 SkAutoLockPixels alp(bm); |
| 88 | 82 |
| 89 for (int y = 0; y < bm.height(); y++) { | 83 for (int y = 0; y < bm.height(); y++) { |
| 90 DITHER_4444_SCAN(y); | 84 DITHER_4444_SCAN(y); |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 } | 169 } |
| 176 | 170 |
| 177 private: | 171 private: |
| 178 typedef SampleView INHERITED; | 172 typedef SampleView INHERITED; |
| 179 }; | 173 }; |
| 180 | 174 |
| 181 ////////////////////////////////////////////////////////////////////////////// | 175 ////////////////////////////////////////////////////////////////////////////// |
| 182 | 176 |
| 183 static SkView* MyFactory() { return new DitherView; } | 177 static SkView* MyFactory() { return new DitherView; } |
| 184 static SkViewRegister reg(MyFactory); | 178 static SkViewRegister reg(MyFactory); |
| OLD | NEW |