Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Side by Side Diff: samplecode/SampleDither.cpp

Issue 169063002: use SkColorType instead of SkBitmap::Config in samplecode (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « samplecode/SampleDash.cpp ('k') | samplecode/SampleDitherBitmap.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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);
OLDNEW
« no previous file with comments | « samplecode/SampleDash.cpp ('k') | samplecode/SampleDitherBitmap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698