| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 "SkTypes.h" | 8 #include "SkTypes.h" |
| 9 #if SK_SUPPORT_GPU | 9 #if SK_SUPPORT_GPU |
| 10 #include "GrContextFactory.h" | 10 #include "GrContextFactory.h" |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 SkAutoTUnref<SkSurface> destinationSurface(SkSurface::NewRaster(info)); | 108 SkAutoTUnref<SkSurface> destinationSurface(SkSurface::NewRaster(info)); |
| 109 | 109 |
| 110 runShaderTest(reporter, sourceSurface.get(), destinationSurface.get(), info)
; | 110 runShaderTest(reporter, sourceSurface.get(), destinationSurface.get(), info)
; |
| 111 } | 111 } |
| 112 | 112 |
| 113 #if SK_SUPPORT_GPU | 113 #if SK_SUPPORT_GPU |
| 114 | 114 |
| 115 void gpuToGpu(skiatest::Reporter* reporter, GrContext* context) { | 115 void gpuToGpu(skiatest::Reporter* reporter, GrContext* context) { |
| 116 SkImageInfo info = SkImageInfo::MakeN32Premul(5, 5); | 116 SkImageInfo info = SkImageInfo::MakeN32Premul(5, 5); |
| 117 | 117 |
| 118 SkAutoTUnref<SkSurface> sourceSurface(SkSurface::NewRenderTarget(context, in
fo)); | 118 SkAutoTUnref<SkSurface> sourceSurface(SkSurface::NewRenderTarget(context, |
| 119 SkAutoTUnref<SkSurface> destinationSurface(SkSurface::NewRenderTarget(contex
t, info)); | 119 SkSurface::kNo_Budgeted, info)); |
| 120 SkAutoTUnref<SkSurface> destinationSurface(SkSurface::NewRenderTarget(contex
t, |
| 121 SkSurface::kNo_Budgeted, info)); |
| 120 | 122 |
| 121 runShaderTest(reporter, sourceSurface.get(), destinationSurface.get(), info)
; | 123 runShaderTest(reporter, sourceSurface.get(), destinationSurface.get(), info)
; |
| 122 } | 124 } |
| 123 | 125 |
| 124 void gpuToRaster(skiatest::Reporter* reporter, GrContext* context) { | 126 void gpuToRaster(skiatest::Reporter* reporter, GrContext* context) { |
| 125 SkImageInfo info = SkImageInfo::MakeN32Premul(5, 5); | 127 SkImageInfo info = SkImageInfo::MakeN32Premul(5, 5); |
| 126 | 128 |
| 127 SkAutoTUnref<SkSurface> sourceSurface(SkSurface::NewRenderTarget(context, in
fo)); | 129 SkAutoTUnref<SkSurface> sourceSurface(SkSurface::NewRenderTarget(context, |
| 128 SkAutoTUnref<SkSurface> destinationSurface(SkSurface::NewRaster(info)); | 130 SkSurface::kNo_Budgeted, info)); |
| 131 SkAutoTUnref<SkSurface> destinationSurface(SkSurface::NewRenderTarget(contex
t, |
| 132 SkSurface::kNo_Budgeted, info)); |
| 129 | 133 |
| 130 runShaderTest(reporter, sourceSurface.get(), destinationSurface.get(), info)
; | 134 runShaderTest(reporter, sourceSurface.get(), destinationSurface.get(), info)
; |
| 131 } | 135 } |
| 132 | 136 |
| 133 void rasterToGpu(skiatest::Reporter* reporter, GrContext* context) { | 137 void rasterToGpu(skiatest::Reporter* reporter, GrContext* context) { |
| 134 SkImageInfo info = SkImageInfo::MakeN32Premul(5, 5); | 138 SkImageInfo info = SkImageInfo::MakeN32Premul(5, 5); |
| 135 | 139 |
| 136 SkAutoTUnref<SkSurface> sourceSurface(SkSurface::NewRaster(info)); | 140 SkAutoTUnref<SkSurface> sourceSurface(SkSurface::NewRaster(info)); |
| 137 SkAutoTUnref<SkSurface> destinationSurface(SkSurface::NewRenderTarget(contex
t, info)); | 141 SkAutoTUnref<SkSurface> destinationSurface(SkSurface::NewRenderTarget(contex
t, |
| 142 SkSurface::kNo_Budgeted, info)); |
| 138 | 143 |
| 139 runShaderTest(reporter, sourceSurface.get(), destinationSurface.get(), info)
; | 144 runShaderTest(reporter, sourceSurface.get(), destinationSurface.get(), info)
; |
| 140 } | 145 } |
| 141 | 146 |
| 142 DEF_GPUTEST(ImageNewShader_GPU, reporter, factory) { | 147 DEF_GPUTEST(ImageNewShader_GPU, reporter, factory) { |
| 143 for (int i = 0; i < GrContextFactory::kGLContextTypeCnt; ++i) { | 148 for (int i = 0; i < GrContextFactory::kGLContextTypeCnt; ++i) { |
| 144 GrContextFactory::GLContextType glCtxType = (GrContextFactory::GLContext
Type) i; | 149 GrContextFactory::GLContextType glCtxType = (GrContextFactory::GLContext
Type) i; |
| 145 | 150 |
| 146 if (!GrContextFactory::IsRenderingGLContext(glCtxType)) { | 151 if (!GrContextFactory::IsRenderingGLContext(glCtxType)) { |
| 147 continue; | 152 continue; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 158 | 163 |
| 159 // GPU -> RASTER | 164 // GPU -> RASTER |
| 160 gpuToRaster(reporter, context); | 165 gpuToRaster(reporter, context); |
| 161 | 166 |
| 162 // RASTER -> GPU | 167 // RASTER -> GPU |
| 163 rasterToGpu(reporter, context); | 168 rasterToGpu(reporter, context); |
| 164 } | 169 } |
| 165 } | 170 } |
| 166 | 171 |
| 167 #endif | 172 #endif |
| OLD | NEW |