OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2013 Google Inc. | 3 * Copyright 2013 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 "SkCanvas.h" | 8 #include "SkCanvas.h" |
9 #include "SkRRect.h" | 9 #include "SkRRect.h" |
10 #include "SkSurface.h" | 10 #include "SkSurface.h" |
11 #include "Test.h" | 11 #include "Test.h" |
12 | 12 |
13 #if SK_SUPPORT_GPU | 13 #if SK_SUPPORT_GPU |
14 #include "GrContextFactory.h" | 14 #include "GrContextFactory.h" |
15 #else | 15 #else |
16 class GrContextFactory; | 16 class GrContextFactory; |
17 class GrContext; | 17 class GrContext; |
18 #endif | 18 #endif |
19 | 19 |
20 enum SurfaceType { | 20 enum SurfaceType { |
21 kRaster_SurfaceType, | 21 kRaster_SurfaceType, |
22 kGpu_SurfaceType, | 22 kGpu_SurfaceType, |
23 kPicture_SurfaceType | 23 kPicture_SurfaceType |
24 }; | 24 }; |
25 | 25 |
26 static SkSurface* createSurface(SurfaceType surfaceType, GrContext* context) { | 26 static SkSurface* createSurface(SurfaceType surfaceType, GrContext* context) { |
27 static const SkImage::Info imageSpec = { | 27 static const SkImageInfo imageSpec = { |
28 10, // width | 28 10, // width |
29 10, // height | 29 10, // height |
30 SkImage::kPMColor_ColorType, | 30 kPMColor_SkColorType, |
31 kPremul_SkAlphaType | 31 kPremul_SkAlphaType |
32 }; | 32 }; |
33 | 33 |
34 switch (surfaceType) { | 34 switch (surfaceType) { |
35 case kRaster_SurfaceType: | 35 case kRaster_SurfaceType: |
36 return SkSurface::NewRaster(imageSpec); | 36 return SkSurface::NewRaster(imageSpec); |
37 case kGpu_SurfaceType: | 37 case kGpu_SurfaceType: |
38 #if SK_SUPPORT_GPU | 38 #if SK_SUPPORT_GPU |
39 SkASSERT(NULL != context); | 39 SkASSERT(NULL != context); |
40 return SkSurface::NewRenderTarget(context, imageSpec); | 40 return SkSurface::NewRenderTarget(context, imageSpec); |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 TestSurfaceWritableAfterSnapshotRelease(reporter, kGpu_SurfaceType, cont
ext); | 248 TestSurfaceWritableAfterSnapshotRelease(reporter, kGpu_SurfaceType, cont
ext); |
249 TestSurfaceNoCanvas(reporter, kGpu_SurfaceType, context, SkSurface::kDis
card_ContentChangeMode); | 249 TestSurfaceNoCanvas(reporter, kGpu_SurfaceType, context, SkSurface::kDis
card_ContentChangeMode); |
250 TestSurfaceNoCanvas(reporter, kGpu_SurfaceType, context, SkSurface::kRet
ain_ContentChangeMode); | 250 TestSurfaceNoCanvas(reporter, kGpu_SurfaceType, context, SkSurface::kRet
ain_ContentChangeMode); |
251 TestGetTexture(reporter, kGpu_SurfaceType, context); | 251 TestGetTexture(reporter, kGpu_SurfaceType, context); |
252 } | 252 } |
253 #endif | 253 #endif |
254 } | 254 } |
255 | 255 |
256 #include "TestClassDef.h" | 256 #include "TestClassDef.h" |
257 DEFINE_GPUTESTCLASS("Surface", SurfaceTestClass, TestSurface) | 257 DEFINE_GPUTESTCLASS("Surface", SurfaceTestClass, TestSurface) |
OLD | NEW |