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

Side by Side Diff: gm/bitmappremul.cpp

Issue 227433009: Rename kPMColor_SkColorType to kN32_SkColorType. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase 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 | « gm/bitmapfilters.cpp ('k') | gm/gammatext.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 * Copyright 2013 Google Inc. 2 * Copyright 2013 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "gm.h" 8 #include "gm.h"
9 #include "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 12 matching lines...) Expand all
23 static const int PIXEL_SIZE_4444 = SLIDE_SIZE / 16; 23 static const int PIXEL_SIZE_4444 = SLIDE_SIZE / 16;
24 24
25 static void init_bitmap(SkColorType ct, SkBitmap* bitmap) { 25 static void init_bitmap(SkColorType ct, SkBitmap* bitmap) {
26 bitmap->allocPixels(SkImageInfo::Make(SLIDE_SIZE, SLIDE_SIZE, ct, 26 bitmap->allocPixels(SkImageInfo::Make(SLIDE_SIZE, SLIDE_SIZE, ct,
27 kPremul_SkAlphaType)); 27 kPremul_SkAlphaType));
28 bitmap->eraseColor(SK_ColorWHITE); 28 bitmap->eraseColor(SK_ColorWHITE);
29 } 29 }
30 30
31 static SkBitmap make_argb8888_gradient() { 31 static SkBitmap make_argb8888_gradient() {
32 SkBitmap bitmap; 32 SkBitmap bitmap;
33 init_bitmap(kPMColor_SkColorType, &bitmap); 33 init_bitmap(kN32_SkColorType, &bitmap);
34 uint8_t rowColor = 0; 34 uint8_t rowColor = 0;
35 for (int y = 0; y < SLIDE_SIZE; y++) { 35 for (int y = 0; y < SLIDE_SIZE; y++) {
36 uint32_t* dst = bitmap.getAddr32(0, y); 36 uint32_t* dst = bitmap.getAddr32(0, y);
37 for (int x = 0; x < SLIDE_SIZE; x++) { 37 for (int x = 0; x < SLIDE_SIZE; x++) {
38 dst[x] = SkPackARGB32(rowColor, rowColor, 38 dst[x] = SkPackARGB32(rowColor, rowColor,
39 rowColor, rowColor); 39 rowColor, rowColor);
40 } 40 }
41 if (y % PIXEL_SIZE_8888 == PIXEL_SIZE_8888 - 1) { 41 if (y % PIXEL_SIZE_8888 == PIXEL_SIZE_8888 - 1) {
42 rowColor++; 42 rowColor++;
43 } 43 }
(...skipping 13 matching lines...) Expand all
57 } 57 }
58 if (y % PIXEL_SIZE_4444 == PIXEL_SIZE_4444 - 1) { 58 if (y % PIXEL_SIZE_4444 == PIXEL_SIZE_4444 - 1) {
59 rowColor++; 59 rowColor++;
60 } 60 }
61 } 61 }
62 return bitmap; 62 return bitmap;
63 } 63 }
64 64
65 static SkBitmap make_argb8888_stripes() { 65 static SkBitmap make_argb8888_stripes() {
66 SkBitmap bitmap; 66 SkBitmap bitmap;
67 init_bitmap(kPMColor_SkColorType, &bitmap); 67 init_bitmap(kN32_SkColorType, &bitmap);
68 uint8_t rowColor = 0; 68 uint8_t rowColor = 0;
69 for (int y = 0; y < SLIDE_SIZE; y++) { 69 for (int y = 0; y < SLIDE_SIZE; y++) {
70 uint32_t* dst = bitmap.getAddr32(0, y); 70 uint32_t* dst = bitmap.getAddr32(0, y);
71 for (int x = 0; x < SLIDE_SIZE; x++) { 71 for (int x = 0; x < SLIDE_SIZE; x++) {
72 dst[x] = SkPackARGB32(rowColor, rowColor, 72 dst[x] = SkPackARGB32(rowColor, rowColor,
73 rowColor, rowColor); 73 rowColor, rowColor);
74 } 74 }
75 if (rowColor == 0) { 75 if (rowColor == 0) {
76 rowColor = 255; 76 rowColor = 255;
77 } else { 77 } else {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 canvas->drawBitmap(make_argb8888_stripes(), 0, slideSize); 124 canvas->drawBitmap(make_argb8888_stripes(), 0, slideSize);
125 canvas->drawBitmap(make_argb4444_stripes(), slideSize, slideSize); 125 canvas->drawBitmap(make_argb4444_stripes(), slideSize, slideSize);
126 } 126 }
127 127
128 private: 128 private:
129 typedef GM INHERITED; 129 typedef GM INHERITED;
130 }; 130 };
131 131
132 DEF_GM( return new BitmapPremulGM; ) 132 DEF_GM( return new BitmapPremulGM; )
133 } 133 }
OLDNEW
« no previous file with comments | « gm/bitmapfilters.cpp ('k') | gm/gammatext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698