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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 | 180 |
181 // since we draw into this directly, we need to start fresh | 181 // since we draw into this directly, we need to start fresh |
182 sk_bzero(fBuffer, fBufferSize); | 182 sk_bzero(fBuffer, fBufferSize); |
183 | 183 |
184 SkImageInfo info = SkImageInfo::MakeN32Premul(W, H); | 184 SkImageInfo info = SkImageInfo::MakeN32Premul(W, H); |
185 SkAutoTUnref<SkSurface> surf0(SkSurface::NewRasterDirect(info, fBuffer,
RB)); | 185 SkAutoTUnref<SkSurface> surf0(SkSurface::NewRasterDirect(info, fBuffer,
RB)); |
186 SkAutoTUnref<SkSurface> surf1(SkSurface::NewRaster(info)); | 186 SkAutoTUnref<SkSurface> surf1(SkSurface::NewRaster(info)); |
187 #if SK_SUPPORT_GPU | 187 #if SK_SUPPORT_GPU |
188 GrContext* ctx = canvas->getGrContext(); | 188 GrContext* ctx = canvas->getGrContext(); |
189 | 189 |
190 SkAutoTUnref<SkSurface> surf4(SkSurface::NewRenderTarget(ctx, info, 0)); | 190 SkAutoTUnref<SkSurface> surf4(SkSurface::NewRenderTarget(ctx, info)); |
191 #endif | 191 #endif |
192 | 192 |
193 test_surface(canvas, surf0, true); | 193 test_surface(canvas, surf0, true); |
194 canvas->translate(80, 0); | 194 canvas->translate(80, 0); |
195 test_surface(canvas, surf1, true); | 195 test_surface(canvas, surf1, true); |
196 #if SK_SUPPORT_GPU | 196 #if SK_SUPPORT_GPU |
197 if (ctx) { | 197 if (ctx) { |
198 canvas->translate(80, 0); | 198 canvas->translate(80, 0); |
199 test_surface(canvas, surf4, true); | 199 test_surface(canvas, surf4, true); |
200 } | 200 } |
201 #endif | 201 #endif |
202 } | 202 } |
203 | 203 |
204 virtual uint32_t onGetFlags() const SK_OVERRIDE { | 204 virtual uint32_t onGetFlags() const SK_OVERRIDE { |
205 return GM::kSkipPicture_Flag | GM::kSkipPipe_Flag; | 205 return GM::kSkipPicture_Flag | GM::kSkipPipe_Flag; |
206 } | 206 } |
207 | 207 |
208 private: | 208 private: |
209 typedef skiagm::GM INHERITED; | 209 typedef skiagm::GM INHERITED; |
210 }; | 210 }; |
211 | 211 |
212 ////////////////////////////////////////////////////////////////////////////// | 212 ////////////////////////////////////////////////////////////////////////////// |
213 | 213 |
214 static skiagm::GM* MyFactory(void*) { return new ImageGM; } | 214 static skiagm::GM* MyFactory(void*) { return new ImageGM; } |
215 static skiagm::GMRegistry reg(MyFactory); | 215 static skiagm::GMRegistry reg(MyFactory); |
OLD | NEW |