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

Side by Side Diff: gm/verylargebitmap.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/tilemodes_scaled.cpp ('k') | gm/xfermodeimagefilter.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 2012 Google Inc. 2 * Copyright 2012 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 "SkGradientShader.h" 10 #include "SkGradientShader.h"
11 #include "SkPath.h" 11 #include "SkPath.h"
12 12
13 static void make_bm(SkBitmap* bm, int width, int height, SkColor colors[2]) { 13 static void make_bm(SkBitmap* bm, int width, int height, SkColor colors[2]) {
14 bm->setConfig(SkBitmap::kARGB_8888_Config, width, height); 14 bm->allocN32Pixels(width, height);
15 bm->allocPixels();
16 SkCanvas canvas(*bm); 15 SkCanvas canvas(*bm);
17 SkPoint center = {SkIntToScalar(width)/2, SkIntToScalar(height)/2}; 16 SkPoint center = {SkIntToScalar(width)/2, SkIntToScalar(height)/2};
18 SkScalar radius = 40; 17 SkScalar radius = 40;
19 SkShader* shader = SkGradientShader::CreateRadial(center, radius, colors, NU LL, 2, 18 SkShader* shader = SkGradientShader::CreateRadial(center, radius, colors, NU LL, 2,
20 SkShader::kMirror_TileMode ); 19 SkShader::kMirror_TileMode );
21 SkPaint paint; 20 SkPaint paint;
22 paint.setShader(shader)->unref(); 21 paint.setShader(shader)->unref();
23 paint.setXfermodeMode(SkXfermode::kSrc_Mode); 22 paint.setXfermodeMode(SkXfermode::kSrc_Mode);
24 canvas.drawPaint(paint); 23 canvas.drawPaint(paint);
25 bm->setImmutable(); 24 bm->setImmutable();
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 typedef skiagm::GM INHERITED; 117 typedef skiagm::GM INHERITED;
119 }; 118 };
120 119
121 ////////////////////////////////////////////////////////////////////////////// 120 //////////////////////////////////////////////////////////////////////////////
122 121
123 // This GM allocates more memory than Android devices are capable of fulfilling. 122 // This GM allocates more memory than Android devices are capable of fulfilling.
124 #ifndef SK_BUILD_FOR_ANDROID 123 #ifndef SK_BUILD_FOR_ANDROID
125 static skiagm::GM* MyFactory(void*) { return new VeryLargeBitmapGM; } 124 static skiagm::GM* MyFactory(void*) { return new VeryLargeBitmapGM; }
126 static skiagm::GMRegistry reg(MyFactory); 125 static skiagm::GMRegistry reg(MyFactory);
127 #endif 126 #endif
OLDNEW
« no previous file with comments | « gm/tilemodes_scaled.cpp ('k') | gm/xfermodeimagefilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698