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

Side by Side Diff: samplecode/SampleMipMap.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/SampleLayerMask.cpp ('k') | samplecode/SampleOvalTest.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"
11 #include "SkDevice.h" 11 #include "SkDevice.h"
12 #include "SkPaint.h" 12 #include "SkPaint.h"
13 #include "SkShader.h" 13 #include "SkShader.h"
14 14
15 static SkBitmap createBitmap(int n) { 15 static SkBitmap createBitmap(int n) {
16 SkBitmap bitmap; 16 SkBitmap bitmap;
17 bitmap.setConfig(SkBitmap::kARGB_8888_Config, n, n); 17 bitmap.allocN32Pixels(n, n);
18 bitmap.allocPixels();
19 bitmap.eraseColor(SK_ColorTRANSPARENT); 18 bitmap.eraseColor(SK_ColorTRANSPARENT);
20 19
21 SkCanvas canvas(bitmap); 20 SkCanvas canvas(bitmap);
22 SkRect r; 21 SkRect r;
23 r.set(0, 0, SkIntToScalar(n), SkIntToScalar(n)); 22 r.set(0, 0, SkIntToScalar(n), SkIntToScalar(n));
24 SkPaint paint; 23 SkPaint paint;
25 paint.setAntiAlias(true); 24 paint.setAntiAlias(true);
26 25
27 paint.setColor(SK_ColorRED); 26 paint.setColor(SK_ColorRED);
28 canvas.drawOval(r, paint); 27 canvas.drawOval(r, paint);
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 private: 92 private:
94 int fWidth; 93 int fWidth;
95 94
96 typedef SampleView INHERITED; 95 typedef SampleView INHERITED;
97 }; 96 };
98 97
99 ////////////////////////////////////////////////////////////////////////////// 98 //////////////////////////////////////////////////////////////////////////////
100 99
101 static SkView* MyFactory() { return new MipMapView; } 100 static SkView* MyFactory() { return new MipMapView; }
102 static SkViewRegister reg(MyFactory); 101 static SkViewRegister reg(MyFactory);
OLDNEW
« no previous file with comments | « samplecode/SampleLayerMask.cpp ('k') | samplecode/SampleOvalTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698