| 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 "SkTypes.h" | 8 #include "SkTypes.h" |
| 9 | 9 |
| 10 #if SK_SUPPORT_GPU | 10 #if SK_SUPPORT_GPU |
| 11 | 11 |
| 12 #include "GrContext.h" | 12 #include "GrContext.h" |
| 13 #include "GrGpu.h" | 13 #include "GrGpu.h" |
| 14 #include "GrRenderTarget.h" | 14 #include "GrRenderTarget.h" |
| 15 #include "GrTexture.h" | 15 #include "GrTexture.h" |
| 16 #include "GrSurfacePriv.h" | 16 #include "GrSurfacePriv.h" |
| 17 #include "Test.h" | 17 #include "Test.h" |
| 18 | 18 |
| 19 // Tests that GrSurface::asTexture(), GrSurface::asRenderTarget(), and static up
casting of texture | 19 // Tests that GrSurface::asTexture(), GrSurface::asRenderTarget(), and static up
casting of texture |
| 20 // and render targets to GrSurface all work as expected. | 20 // and render targets to GrSurface all work as expected. |
| 21 DEF_GPUTEST_FOR_NULLGL_CONTEXT(GrSurface, reporter, ctxInfo) { | 21 DEF_GPUTEST_FOR_NULLGL_CONTEXT(GrSurface, reporter, ctxInfo) { |
| 22 GrContext* context = ctxInfo.fGrContext; | 22 GrContext* context = ctxInfo.grContext(); |
| 23 GrSurfaceDesc desc; | 23 GrSurfaceDesc desc; |
| 24 desc.fConfig = kSkia8888_GrPixelConfig; | 24 desc.fConfig = kSkia8888_GrPixelConfig; |
| 25 desc.fFlags = kRenderTarget_GrSurfaceFlag; | 25 desc.fFlags = kRenderTarget_GrSurfaceFlag; |
| 26 desc.fWidth = 256; | 26 desc.fWidth = 256; |
| 27 desc.fHeight = 256; | 27 desc.fHeight = 256; |
| 28 desc.fSampleCnt = 0; | 28 desc.fSampleCnt = 0; |
| 29 GrSurface* texRT1 = context->textureProvider()->createTexture( | 29 GrSurface* texRT1 = context->textureProvider()->createTexture( |
| 30 desc, SkBudgeted::kNo, nullptr, 0); | 30 desc, SkBudgeted::kNo, nullptr, 0); |
| 31 | 31 |
| 32 REPORTER_ASSERT(reporter, texRT1 == texRT1->asRenderTarget()); | 32 REPORTER_ASSERT(reporter, texRT1 == texRT1->asRenderTarget()); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 REPORTER_ASSERT(reporter, static_cast<GrSurface*>(texRT2->asRenderTarget())
== | 65 REPORTER_ASSERT(reporter, static_cast<GrSurface*>(texRT2->asRenderTarget())
== |
| 66 static_cast<GrSurface*>(texRT2->asTexture())); | 66 static_cast<GrSurface*>(texRT2->asTexture())); |
| 67 | 67 |
| 68 texRT1->unref(); | 68 texRT1->unref(); |
| 69 texRT2->unref(); | 69 texRT2->unref(); |
| 70 tex1->unref(); | 70 tex1->unref(); |
| 71 context->getGpu()->deleteTestingOnlyBackendTexture(backendTex); | 71 context->getGpu()->deleteTestingOnlyBackendTexture(backendTex); |
| 72 } | 72 } |
| 73 | 73 |
| 74 #endif | 74 #endif |
| OLD | NEW |