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