OLD | NEW |
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 Loading... |
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 SkImageInfo info = { | 181 SkImageInfo info = SkImageInfo::MakeN32Premul(W, H); |
182 W, H, kPMColor_SkColorType, kPremul_SkAlphaType | |
183 }; | |
184 SkAutoTUnref<SkSurface> surf0(SkSurface::NewRasterDirect(info, fBuffer,
RB)); | 182 SkAutoTUnref<SkSurface> surf0(SkSurface::NewRasterDirect(info, fBuffer,
RB)); |
185 SkAutoTUnref<SkSurface> surf1(SkSurface::NewRaster(info)); | 183 SkAutoTUnref<SkSurface> surf1(SkSurface::NewRaster(info)); |
186 SkAutoTUnref<SkSurface> surf2(SkSurface::NewPicture(info.fWidth, info.fH
eight)); | 184 SkAutoTUnref<SkSurface> surf2(SkSurface::NewPicture(info.fWidth, info.fH
eight)); |
187 SkAutoTUnref<SkSurface> surf3(SkSurface::NewPicture(info.fWidth, info.fH
eight)); | 185 SkAutoTUnref<SkSurface> surf3(SkSurface::NewPicture(info.fWidth, info.fH
eight)); |
188 #if SK_SUPPORT_GPU | 186 #if SK_SUPPORT_GPU |
189 GrContext* ctx = canvas->getGrContext(); | 187 GrContext* ctx = canvas->getGrContext(); |
190 | 188 |
191 SkAutoTUnref<SkSurface> surf4(SkSurface::NewRenderTarget(ctx, info, 0)); | 189 SkAutoTUnref<SkSurface> surf4(SkSurface::NewRenderTarget(ctx, info, 0)); |
192 #endif | 190 #endif |
193 | 191 |
(...skipping 17 matching lines...) Expand all Loading... |
211 } | 209 } |
212 | 210 |
213 private: | 211 private: |
214 typedef skiagm::GM INHERITED; | 212 typedef skiagm::GM INHERITED; |
215 }; | 213 }; |
216 | 214 |
217 ////////////////////////////////////////////////////////////////////////////// | 215 ////////////////////////////////////////////////////////////////////////////// |
218 | 216 |
219 static skiagm::GM* MyFactory(void*) { return new ImageGM; } | 217 static skiagm::GM* MyFactory(void*) { return new ImageGM; } |
220 static skiagm::GMRegistry reg(MyFactory); | 218 static skiagm::GMRegistry reg(MyFactory); |
OLD | NEW |