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

Side by Side Diff: samplecode/SampleEncode.cpp

Issue 235523003: Revert of Revert of Rename kPMColor_SkColorType to kN32_SkColorType. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 8 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
« no previous file with comments | « samplecode/SampleDitherBitmap.cpp ('k') | samplecode/SampleFilter.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 25 matching lines...) Expand all
36 SkCanvas canvas(device); 36 SkCanvas canvas(device);
37 SkPaint paint; 37 SkPaint paint;
38 38
39 paint.setAntiAlias(true); 39 paint.setAntiAlias(true);
40 canvas.drawColor(SK_ColorRED); 40 canvas.drawColor(SK_ColorRED);
41 paint.setColor(SK_ColorBLUE); 41 paint.setColor(SK_ColorBLUE);
42 canvas.drawCircle(SkIntToScalar(width)/2, SkIntToScalar(height)/2, 42 canvas.drawCircle(SkIntToScalar(width)/2, SkIntToScalar(height)/2,
43 SkIntToScalar(width)/2, paint); 43 SkIntToScalar(width)/2, paint);
44 44
45 switch (ct) { 45 switch (ct) {
46 case kPMColor_SkColorType: 46 case kN32_SkColorType:
47 bm->swap(device); 47 bm->swap(device);
48 break; 48 break;
49 case kRGB_565_SkColorType: { 49 case kRGB_565_SkColorType: {
50 bm->allocPixels(info); 50 bm->allocPixels(info);
51 for (int y = 0; y < height; y++) { 51 for (int y = 0; y < height; y++) {
52 for (int x = 0; x < width; x++) { 52 for (int x = 0; x < width; x++) {
53 *bm->getAddr16(x, y) = SkPixel32ToPixel16(*device.getAddr32( x, y)); 53 *bm->getAddr16(x, y) = SkPixel32ToPixel16(*device.getAddr32( x, y));
54 } 54 }
55 } 55 }
56 break; 56 break;
(...skipping 17 matching lines...) Expand all
74 } 74 }
75 break; 75 break;
76 } 76 }
77 default: 77 default:
78 SkASSERT(0); 78 SkASSERT(0);
79 } 79 }
80 } 80 }
81 81
82 // configs to build the original bitmap in. Can be at most these 3 82 // configs to build the original bitmap in. Can be at most these 3
83 static const SkColorType gColorTypes[] = { 83 static const SkColorType gColorTypes[] = {
84 kPMColor_SkColorType, 84 kN32_SkColorType,
85 kRGB_565_SkColorType, 85 kRGB_565_SkColorType,
86 kIndex_8_SkColorType, // opaque 86 kIndex_8_SkColorType, // opaque
87 kIndex_8_SkColorType // alpha 87 kIndex_8_SkColorType // alpha
88 }; 88 };
89 89
90 static const char* const gConfigLabels[] = { 90 static const char* const gConfigLabels[] = {
91 "8888", "565", "Index8", "Index8 alpha" 91 "8888", "565", "Index8", "Index8 alpha"
92 }; 92 };
93 93
94 // types to encode into. Can be at most these 3. Must match up with gExt[] 94 // types to encode into. Can be at most these 3. Must match up with gExt[]
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 } 227 }
228 228
229 private: 229 private:
230 typedef SampleView INHERITED; 230 typedef SampleView INHERITED;
231 }; 231 };
232 232
233 ////////////////////////////////////////////////////////////////////////////// 233 //////////////////////////////////////////////////////////////////////////////
234 234
235 static SkView* MyFactory() { return new EncodeView; } 235 static SkView* MyFactory() { return new EncodeView; }
236 static SkViewRegister reg(MyFactory); 236 static SkViewRegister reg(MyFactory);
OLDNEW
« no previous file with comments | « samplecode/SampleDitherBitmap.cpp ('k') | samplecode/SampleFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698