OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "SkCanvas.h" | 8 #include "SkCanvas.h" |
9 #include "SkData.h" | 9 #include "SkData.h" |
10 #include "SkImageEncoder.h" | 10 #include "SkImageEncoder.h" |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 { kGpu_ImageType, false, "Gpu" }, | 244 { kGpu_ImageType, false, "Gpu" }, |
245 { kCodec_ImageType, false, "Codec" }, | 245 { kCodec_ImageType, false, "Codec" }, |
246 }; | 246 }; |
247 | 247 |
248 const SkColor color = SK_ColorRED; | 248 const SkColor color = SK_ColorRED; |
249 const SkPMColor pmcolor = SkPreMultiplyColor(color); | 249 const SkPMColor pmcolor = SkPreMultiplyColor(color); |
250 | 250 |
251 GrContext* ctx = NULL; | 251 GrContext* ctx = NULL; |
252 #if SK_SUPPORT_GPU | 252 #if SK_SUPPORT_GPU |
253 ctx = factory->get(GrContextFactory::kNative_GLContextType); | 253 ctx = factory->get(GrContextFactory::kNative_GLContextType); |
| 254 if (!ctx) { |
| 255 return; |
| 256 } |
254 #endif | 257 #endif |
255 | 258 |
256 for (size_t i = 0; i < SK_ARRAY_COUNT(gRec); ++i) { | 259 for (size_t i = 0; i < SK_ARRAY_COUNT(gRec); ++i) { |
257 SkImageInfo info; | 260 SkImageInfo info; |
258 size_t rowBytes; | 261 size_t rowBytes; |
259 | 262 |
260 SkAutoTUnref<SkImage> image(createImage(gRec[i].fType, ctx, color)); | 263 SkAutoTUnref<SkImage> image(createImage(gRec[i].fType, ctx, color)); |
261 if (!image.get()) { | 264 if (!image.get()) { |
262 SkDebugf("failed to createImage[%d] %s\n", i, gRec[i].fName); | 265 SkDebugf("failed to createImage[%d] %s\n", i, gRec[i].fName); |
263 continue; // gpu may not be enabled | 266 continue; // gpu may not be enabled |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
607 TestGetTexture(reporter, kGpu_SurfaceType, context); | 610 TestGetTexture(reporter, kGpu_SurfaceType, context); |
608 TestGetTexture(reporter, kGpuScratch_SurfaceType, context); | 611 TestGetTexture(reporter, kGpuScratch_SurfaceType, context); |
609 test_empty_surface(reporter, context); | 612 test_empty_surface(reporter, context); |
610 test_surface_budget(reporter, context); | 613 test_surface_budget(reporter, context); |
611 test_wrapped_texture_surface(reporter, context); | 614 test_wrapped_texture_surface(reporter, context); |
612 } | 615 } |
613 } | 616 } |
614 } | 617 } |
615 #endif | 618 #endif |
616 } | 619 } |
OLD | NEW |