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 757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
768 10, // height | 768 10, // height |
769 kPMColor_SkColorType, | 769 kPMColor_SkColorType, |
770 kPremul_SkAlphaType | 770 kPremul_SkAlphaType |
771 }; | 771 }; |
772 SkSurface* surface; | 772 SkSurface* surface; |
773 SkSurface* alternateSurface; | 773 SkSurface* alternateSurface; |
774 bool useGpu = NULL != factory; | 774 bool useGpu = NULL != factory; |
775 #if SK_SUPPORT_GPU | 775 #if SK_SUPPORT_GPU |
776 if (useGpu) { | 776 if (useGpu) { |
777 GrContext* context = factory->get(GrContextFactory::kNative_GLContextTyp
e); | 777 GrContext* context = factory->get(GrContextFactory::kNative_GLContextTyp
e); |
| 778 if (NULL == context) { |
| 779 return; |
| 780 } |
778 surface = SkSurface::NewRenderTarget(context, imageSpec); | 781 surface = SkSurface::NewRenderTarget(context, imageSpec); |
779 alternateSurface = SkSurface::NewRenderTarget(context, imageSpec); | 782 alternateSurface = SkSurface::NewRenderTarget(context, imageSpec); |
780 } else { | 783 } else { |
781 surface = SkSurface::NewRaster(imageSpec); | 784 surface = SkSurface::NewRaster(imageSpec); |
782 alternateSurface = SkSurface::NewRaster(imageSpec); | 785 alternateSurface = SkSurface::NewRaster(imageSpec); |
783 } | 786 } |
784 #else | 787 #else |
785 SkASSERT(!useGpu); | 788 SkASSERT(!useGpu); |
786 surface = SkSurface::NewRaster(imageSpec); | 789 surface = SkSurface::NewRaster(imageSpec); |
787 alternateSurface = SkSurface::NewRaster(imageSpec); | 790 alternateSurface = SkSurface::NewRaster(imageSpec); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
843 TestDeferredCanvasSurface(reporter, NULL); | 846 TestDeferredCanvasSurface(reporter, NULL); |
844 TestDeferredCanvasSetSurface(reporter, NULL); | 847 TestDeferredCanvasSetSurface(reporter, NULL); |
845 if (NULL != factory) { | 848 if (NULL != factory) { |
846 TestDeferredCanvasSurface(reporter, factory); | 849 TestDeferredCanvasSurface(reporter, factory); |
847 TestDeferredCanvasSetSurface(reporter, factory); | 850 TestDeferredCanvasSetSurface(reporter, factory); |
848 } | 851 } |
849 } | 852 } |
850 | 853 |
851 #include "TestClassDef.h" | 854 #include "TestClassDef.h" |
852 DEFINE_GPUTESTCLASS("DeferredCanvas", TestDeferredCanvasClass, TestDeferredCanva
s) | 855 DEFINE_GPUTESTCLASS("DeferredCanvas", TestDeferredCanvasClass, TestDeferredCanva
s) |
OLD | NEW |