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

Side by Side Diff: gm/bitmapmatrix.cpp

Issue 140593005: add legacy/helper allocN32Pixels, and convert gm to use it (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 11 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 | « gm/bigmatrix.cpp ('k') | gm/bitmappremul.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 2012 Google Inc. 3 * Copyright 2012 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 "gm.h" 8 #include "gm.h"
9 #include "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkBlurMask.h" 10 #include "SkBlurMask.h"
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 canvas->translate(0, SkIntToScalar(20)); 100 canvas->translate(0, SkIntToScalar(20));
101 canvas->drawBitmapMatrix(bm, matrix, &paint); 101 canvas->drawBitmapMatrix(bm, matrix, &paint);
102 canvas->restore(); 102 canvas->restore();
103 } 103 }
104 104
105 } 105 }
106 private: 106 private:
107 void setupBitmap(SkBitmap* bm) { 107 void setupBitmap(SkBitmap* bm) {
108 SkASSERT(bm); 108 SkASSERT(bm);
109 static const int SIZE = 64; 109 static const int SIZE = 64;
110 bm->setConfig(SkBitmap::kARGB_8888_Config, SIZE, SIZE); 110 bm->allocN32Pixels(SIZE, SIZE);
111 bm->allocPixels();
112 SkCanvas canvas(*bm); 111 SkCanvas canvas(*bm);
113 112
114 SkPaint paint; 113 SkPaint paint;
115 paint.setColor(SK_ColorGREEN); 114 paint.setColor(SK_ColorGREEN);
116 canvas.drawPaint(paint); 115 canvas.drawPaint(paint);
117 116
118 paint.setColor(SK_ColorBLUE); 117 paint.setColor(SK_ColorBLUE);
119 paint.setAntiAlias(true); 118 paint.setAntiAlias(true);
120 SkRect rect = SkRect::MakeWH(SkIntToScalar(SIZE), SkIntToScalar(SIZE)); 119 SkRect rect = SkRect::MakeWH(SkIntToScalar(SIZE), SkIntToScalar(SIZE));
121 SkPath path; 120 SkPath path;
122 path.addOval(rect); 121 path.addOval(rect);
123 canvas.drawPath(path, paint); 122 canvas.drawPath(path, paint);
124 } 123 }
125 }; 124 };
126 125
127 //////////////////////////////////////////////////////////////////////////////// 126 ////////////////////////////////////////////////////////////////////////////////
128 127
129 static GM* MyFactory(void*) { return new DrawBitmapMatrixGM; } 128 static GM* MyFactory(void*) { return new DrawBitmapMatrixGM; }
130 static GMRegistry reg(MyFactory); 129 static GMRegistry reg(MyFactory);
131 130
132 } 131 }
OLDNEW
« no previous file with comments | « gm/bigmatrix.cpp ('k') | gm/bitmappremul.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698