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

Side by Side Diff: gm/mixedxfermodes.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/matrixconvolution.cpp ('k') | gm/modecolorfilters.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 2013 Google Inc. 3 * Copyright 2013 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 "SkRandom.h" 10 #include "SkRandom.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 } 77 }
78 } 78 }
79 79
80 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { 80 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
81 if (NULL == fBG.get()) { 81 if (NULL == fBG.get()) {
82 static uint32_t kCheckerPixelData[] = { 0xFFFFFFFF, 82 static uint32_t kCheckerPixelData[] = { 0xFFFFFFFF,
83 0xFFCCCCCC, 83 0xFFCCCCCC,
84 0xFFCCCCCC, 84 0xFFCCCCCC,
85 0xFFFFFFFF }; 85 0xFFFFFFFF };
86 SkBitmap bitmap; 86 SkBitmap bitmap;
87 bitmap.setConfig(SkBitmap::kARGB_8888_Config, 2, 2, 2 * sizeof(uint3 2_t)); 87 bitmap.allocN32Pixels(2, 2);
88 bitmap.allocPixels();
89 bitmap.lockPixels();
90 memcpy(bitmap.getPixels(), kCheckerPixelData, sizeof(kCheckerPixelDa ta)); 88 memcpy(bitmap.getPixels(), kCheckerPixelData, sizeof(kCheckerPixelDa ta));
91 bitmap.unlockPixels();
92 fBG.reset(SkShader::CreateBitmapShader(bitmap, 89 fBG.reset(SkShader::CreateBitmapShader(bitmap,
93 SkShader::kRepeat_TileMode, 90 SkShader::kRepeat_TileMode,
94 SkShader::kRepeat_TileMode)); 91 SkShader::kRepeat_TileMode));
95 } 92 }
96 SkMatrix lm; 93 SkMatrix lm;
97 lm.setScale(SkIntToScalar(20), SkIntToScalar(20)); 94 lm.setScale(SkIntToScalar(20), SkIntToScalar(20));
98 fBG->setLocalMatrix(lm); 95 fBG->setLocalMatrix(lm);
99 96
100 SkPaint bgPaint; 97 SkPaint bgPaint;
101 bgPaint.setShader(fBG.get()); 98 bgPaint.setShader(fBG.get());
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 SkPath fConvexPath; 136 SkPath fConvexPath;
140 typedef GM INHERITED; 137 typedef GM INHERITED;
141 }; 138 };
142 139
143 ////////////////////////////////////////////////////////////////////////////// 140 //////////////////////////////////////////////////////////////////////////////
144 141
145 static GM* MyFactory(void*) { return new MixedXfermodesGM; } 142 static GM* MyFactory(void*) { return new MixedXfermodesGM; }
146 static GMRegistry reg(MyFactory); 143 static GMRegistry reg(MyFactory);
147 144
148 } 145 }
OLDNEW
« no previous file with comments | « gm/matrixconvolution.cpp ('k') | gm/modecolorfilters.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698