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 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 GrBackendObject backendTex = context->getGpu()->createTestingOnlyBackendText
ure( | 47 GrBackendObject backendTex = context->getGpu()->createTestingOnlyBackendText
ure( |
48 nullptr, 256, 256, kRGBA_8888_GrPixelConfig); | 48 nullptr, 256, 256, kRGBA_8888_GrPixelConfig); |
49 | 49 |
50 GrBackendTextureDesc backendDesc; | 50 GrBackendTextureDesc backendDesc; |
51 backendDesc.fConfig = kRGBA_8888_GrPixelConfig; | 51 backendDesc.fConfig = kRGBA_8888_GrPixelConfig; |
52 backendDesc.fFlags = kRenderTarget_GrBackendTextureFlag; | 52 backendDesc.fFlags = kRenderTarget_GrBackendTextureFlag; |
53 backendDesc.fWidth = 256; | 53 backendDesc.fWidth = 256; |
54 backendDesc.fHeight = 256; | 54 backendDesc.fHeight = 256; |
55 backendDesc.fSampleCnt = 0; | 55 backendDesc.fSampleCnt = 0; |
56 backendDesc.fTextureHandle = backendTex; | 56 backendDesc.fTextureHandle = backendTex; |
57 GrSurface* texRT2 = context->textureProvider()->wrapBackendTexture( | 57 sk_sp<GrSurface> texRT2 = context->textureProvider()->wrapBackendTexture( |
58 backendDesc, kBorrow_GrWrapOwnership); | 58 backendDesc, kBorrow_GrWrapOwnership); |
59 REPORTER_ASSERT(reporter, texRT2 == texRT2->asRenderTarget()); | 59 REPORTER_ASSERT(reporter, texRT2.get() == texRT2->asRenderTarget()); |
60 REPORTER_ASSERT(reporter, texRT2 == texRT2->asTexture()); | 60 REPORTER_ASSERT(reporter, texRT2.get() == texRT2->asTexture()); |
61 REPORTER_ASSERT(reporter, static_cast<GrSurface*>(texRT2->asRenderTarget())
== | 61 REPORTER_ASSERT(reporter, static_cast<GrSurface*>(texRT2->asRenderTarget())
== |
62 texRT2->asTexture()); | 62 texRT2->asTexture()); |
63 REPORTER_ASSERT(reporter, texRT2->asRenderTarget() == | 63 REPORTER_ASSERT(reporter, texRT2->asRenderTarget() == |
64 static_cast<GrSurface*>(texRT2->asTexture())); | 64 static_cast<GrSurface*>(texRT2->asTexture())); |
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(); | |
70 tex1->unref(); | 69 tex1->unref(); |
71 context->getGpu()->deleteTestingOnlyBackendTexture(backendTex); | 70 context->getGpu()->deleteTestingOnlyBackendTexture(backendTex); |
72 } | 71 } |
73 | 72 |
74 #endif | 73 #endif |
OLD | NEW |