OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 #include "Test.h" | 8 #include "Test.h" |
9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
10 #include "SkBitmapDevice.h" | 10 #include "SkBitmapDevice.h" |
(...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
696 10, // width | 696 10, // width |
697 10, // height | 697 10, // height |
698 kPMColor_SkColorType, | 698 kPMColor_SkColorType, |
699 kPremul_SkAlphaType | 699 kPremul_SkAlphaType |
700 }; | 700 }; |
701 SkSurface* surface; | 701 SkSurface* surface; |
702 bool useGpu = NULL != factory; | 702 bool useGpu = NULL != factory; |
703 #if SK_SUPPORT_GPU | 703 #if SK_SUPPORT_GPU |
704 if (useGpu) { | 704 if (useGpu) { |
705 GrContext* context = factory->get(GrContextFactory::kNative_GLContextTyp
e); | 705 GrContext* context = factory->get(GrContextFactory::kNative_GLContextTyp
e); |
| 706 if (NULL == context) { |
| 707 return; |
| 708 } |
| 709 |
706 surface = SkSurface::NewRenderTarget(context, imageSpec); | 710 surface = SkSurface::NewRenderTarget(context, imageSpec); |
707 } else { | 711 } else { |
708 surface = SkSurface::NewRaster(imageSpec); | 712 surface = SkSurface::NewRaster(imageSpec); |
709 } | 713 } |
710 #else | 714 #else |
711 SkASSERT(!useGpu); | 715 SkASSERT(!useGpu); |
712 surface = SkSurface::NewRaster(imageSpec); | 716 surface = SkSurface::NewRaster(imageSpec); |
713 #endif | 717 #endif |
714 SkASSERT(NULL != surface); | 718 SkASSERT(NULL != surface); |
715 SkAutoTUnref<SkSurface> aur(surface); | 719 SkAutoTUnref<SkSurface> aur(surface); |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
839 TestDeferredCanvasSurface(reporter, NULL); | 843 TestDeferredCanvasSurface(reporter, NULL); |
840 TestDeferredCanvasSetSurface(reporter, NULL); | 844 TestDeferredCanvasSetSurface(reporter, NULL); |
841 if (NULL != factory) { | 845 if (NULL != factory) { |
842 TestDeferredCanvasSurface(reporter, factory); | 846 TestDeferredCanvasSurface(reporter, factory); |
843 TestDeferredCanvasSetSurface(reporter, factory); | 847 TestDeferredCanvasSetSurface(reporter, factory); |
844 } | 848 } |
845 } | 849 } |
846 | 850 |
847 #include "TestClassDef.h" | 851 #include "TestClassDef.h" |
848 DEFINE_GPUTESTCLASS("DeferredCanvas", TestDeferredCanvasClass, TestDeferredCanva
s) | 852 DEFINE_GPUTESTCLASS("DeferredCanvas", TestDeferredCanvasClass, TestDeferredCanva
s) |
OLD | NEW |