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

Side by Side Diff: gm/image.cpp

Issue 24130009: promote SkImage::AlphaType to SkAlphaType (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 3 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/fatpathfill.cpp ('k') | gm/srcmode.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 "SkSurface.h" 9 #include "SkSurface.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 canvas->drawText(kLabel9, strlen(kLabel9), 160, 10, textPaint); 171 canvas->drawText(kLabel9, strlen(kLabel9), 160, 10, textPaint);
172 canvas->drawText(kLabel10, strlen(kLabel10), 250, 10, textPaint); 172 canvas->drawText(kLabel10, strlen(kLabel10), 250, 10, textPaint);
173 canvas->drawText(kLabel11, strlen(kLabel11), 320, 10, textPaint); 173 canvas->drawText(kLabel11, strlen(kLabel11), 320, 10, textPaint);
174 canvas->drawText(kLabel12, strlen(kLabel12), 410, 10, textPaint); 174 canvas->drawText(kLabel12, strlen(kLabel12), 410, 10, textPaint);
175 175
176 canvas->translate(80, 20); 176 canvas->translate(80, 20);
177 177
178 // since we draw into this directly, we need to start fresh 178 // since we draw into this directly, we need to start fresh
179 sk_bzero(fBuffer, fBufferSize); 179 sk_bzero(fBuffer, fBufferSize);
180 180
181 SkImage::Info info; 181 SkImage::Info info = {
182 182 W, H, SkImage::kPMColor_ColorType, kPremul_SkAlphaType
183 info.fWidth = W; 183 };
184 info.fHeight = H;
185 info.fColorType = SkImage::kPMColor_ColorType;
186 info.fAlphaType = SkImage::kPremul_AlphaType;
187 SkAutoTUnref<SkSurface> surf0(SkSurface::NewRasterDirect(info, fBuffer, RB)); 184 SkAutoTUnref<SkSurface> surf0(SkSurface::NewRasterDirect(info, fBuffer, RB));
188 SkAutoTUnref<SkSurface> surf1(SkSurface::NewRaster(info)); 185 SkAutoTUnref<SkSurface> surf1(SkSurface::NewRaster(info));
189 SkAutoTUnref<SkSurface> surf2(SkSurface::NewPicture(info.fWidth, info.fH eight)); 186 SkAutoTUnref<SkSurface> surf2(SkSurface::NewPicture(info.fWidth, info.fH eight));
190 SkAutoTUnref<SkSurface> surf3(SkSurface::NewPicture(info.fWidth, info.fH eight)); 187 SkAutoTUnref<SkSurface> surf3(SkSurface::NewPicture(info.fWidth, info.fH eight));
191 #if SK_SUPPORT_GPU 188 #if SK_SUPPORT_GPU
192 GrContext* ctx = GM::GetGr(canvas); 189 GrContext* ctx = GM::GetGr(canvas);
193 190
194 SkAutoTUnref<SkSurface> surf4(SkSurface::NewRenderTarget(ctx, info, 0)); 191 SkAutoTUnref<SkSurface> surf4(SkSurface::NewRenderTarget(ctx, info, 0));
195 #endif 192 #endif
196 193
(...skipping 17 matching lines...) Expand all
214 } 211 }
215 212
216 private: 213 private:
217 typedef skiagm::GM INHERITED; 214 typedef skiagm::GM INHERITED;
218 }; 215 };
219 216
220 ////////////////////////////////////////////////////////////////////////////// 217 //////////////////////////////////////////////////////////////////////////////
221 218
222 static skiagm::GM* MyFactory(void*) { return new ImageGM; } 219 static skiagm::GM* MyFactory(void*) { return new ImageGM; }
223 static skiagm::GMRegistry reg(MyFactory); 220 static skiagm::GMRegistry reg(MyFactory);
OLDNEW
« no previous file with comments | « gm/fatpathfill.cpp ('k') | gm/srcmode.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698