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

Side by Side Diff: gm/aaclip.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 | « no previous file | gm/aarectmodes.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 2011 Google Inc. 2 * Copyright 2011 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 "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkPath.h" 10 #include "SkPath.h"
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 SkColor colors[] = { SK_ColorBLACK, SK_ColorBLACK, SK_ColorRED, SK_ColorRED }; 117 SkColor colors[] = { SK_ColorBLACK, SK_ColorBLACK, SK_ColorRED, SK_ColorRED };
118 SkScalar pos[] = { 0, 0.3f, 0.3f, 1.0f }; 118 SkScalar pos[] = { 0, 0.3f, 0.3f, 1.0f };
119 SkShader* s = SkGradientShader::CreateLinear(pts, colors, pos, 4, SkShader:: kClamp_TileMode); 119 SkShader* s = SkGradientShader::CreateLinear(pts, colors, pos, 4, SkShader:: kClamp_TileMode);
120 SkPaint p; 120 SkPaint p;
121 p.setShader(s)->unref(); 121 p.setShader(s)->unref();
122 canvas->drawPaint(p); 122 canvas->drawPaint(p);
123 } 123 }
124 124
125 static SkCanvas* MakeCanvas(const SkIRect& bounds) { 125 static SkCanvas* MakeCanvas(const SkIRect& bounds) {
126 SkBitmap bm; 126 SkBitmap bm;
127 bm.setConfig(SkBitmap::kARGB_8888_Config, bounds.width(), bounds.height()); 127 bm.allocN32Pixels(bounds.width(), bounds.height());
128 bm.allocPixels();
129 bm.eraseColor(SK_ColorTRANSPARENT); 128 bm.eraseColor(SK_ColorTRANSPARENT);
130 129
131 SkCanvas* canvas = new SkCanvas(bm); 130 SkCanvas* canvas = new SkCanvas(bm);
132 canvas->translate(-SkIntToScalar(bounds.fLeft), -SkIntToScalar(bounds.fTop)) ; 131 canvas->translate(-SkIntToScalar(bounds.fLeft), -SkIntToScalar(bounds.fTop)) ;
133 return canvas; 132 return canvas;
134 } 133 }
135 134
136 #ifdef SK_DEBUG 135 #ifdef SK_DEBUG
137 static void GetBitmap(const SkCanvas* canvas, SkBitmap* bm) { 136 static void GetBitmap(const SkCanvas* canvas, SkBitmap* bm) {
138 *bm = canvas->getDevice()->accessBitmap(false); 137 *bm = canvas->getDevice()->accessBitmap(false);
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 draw_rect_tests(canvas); 310 draw_rect_tests(canvas);
312 } 311 }
313 312
314 virtual uint32_t onGetFlags() const { return kSkipPipe_Flag; } 313 virtual uint32_t onGetFlags() const { return kSkipPipe_Flag; }
315 314
316 private: 315 private:
317 typedef skiagm::GM INHERITED; 316 typedef skiagm::GM INHERITED;
318 }; 317 };
319 318
320 DEF_GM( return SkNEW(AAClipGM); ) 319 DEF_GM( return SkNEW(AAClipGM); )
OLDNEW
« no previous file with comments | « no previous file | gm/aarectmodes.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698