| 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 #if SK_SUPPORT_GPU | 8 #if SK_SUPPORT_GPU |
| 9 | 9 |
| 10 #include "GrContext.h" | 10 #include "GrContext.h" |
| 11 #include "GrContextFactory.h" | 11 #include "GrContextFactory.h" |
| 12 #include "GrRenderTarget.h" | 12 #include "GrRenderTarget.h" |
| 13 #include "GrTexture.h" | 13 #include "GrTexture.h" |
| 14 #include "GrSurfacePriv.h" | 14 #include "GrSurfacePriv.h" |
| 15 #include "SkTypes.h" | 15 #include "SkTypes.h" |
| 16 #include "Test.h" | 16 #include "Test.h" |
| 17 | 17 |
| 18 DEF_GPUTEST(GrSurface, reporter, factory) { | 18 DEF_GPUTEST(GrSurface, reporter, factory) { |
| 19 GrContext* context = factory->get(GrContextFactory::kNull_GLContextType); | 19 GrContext* context = factory->get(GrContextFactory::kNull_GLContextType); |
| 20 if (context) { | 20 if (context) { |
| 21 GrTextureDesc desc; | 21 GrSurfaceDesc desc; |
| 22 desc.fConfig = kSkia8888_GrPixelConfig; | 22 desc.fConfig = kSkia8888_GrPixelConfig; |
| 23 desc.fFlags = kRenderTarget_GrTextureFlagBit; | 23 desc.fFlags = kRenderTarget_GrSurfaceFlag; |
| 24 desc.fWidth = 256; | 24 desc.fWidth = 256; |
| 25 desc.fHeight = 256; | 25 desc.fHeight = 256; |
| 26 desc.fSampleCnt = 0; | 26 desc.fSampleCnt = 0; |
| 27 GrSurface* texRT1 = context->createUncachedTexture(desc, NULL, 0); | 27 GrSurface* texRT1 = context->createUncachedTexture(desc, NULL, 0); |
| 28 GrSurface* texRT2 = context->createUncachedTexture(desc, NULL, 0); | 28 GrSurface* texRT2 = context->createUncachedTexture(desc, NULL, 0); |
| 29 desc.fFlags = kNone_GrTextureFlags; | 29 desc.fFlags = kNone_GrSurfaceFlags; |
| 30 GrSurface* tex1 = context->createUncachedTexture(desc, NULL, 0); | 30 GrSurface* tex1 = context->createUncachedTexture(desc, NULL, 0); |
| 31 | 31 |
| 32 REPORTER_ASSERT(reporter, texRT1->surfacePriv().isSameAs(texRT1)); | 32 REPORTER_ASSERT(reporter, texRT1->surfacePriv().isSameAs(texRT1)); |
| 33 REPORTER_ASSERT(reporter, texRT1->surfacePriv().isSameAs(texRT1->asRende
rTarget())); | 33 REPORTER_ASSERT(reporter, texRT1->surfacePriv().isSameAs(texRT1->asRende
rTarget())); |
| 34 REPORTER_ASSERT(reporter, texRT1->asRenderTarget()->surfacePriv().isSame
As(texRT1)); | 34 REPORTER_ASSERT(reporter, texRT1->asRenderTarget()->surfacePriv().isSame
As(texRT1)); |
| 35 REPORTER_ASSERT(reporter, !texRT2->surfacePriv().isSameAs(texRT1)); | 35 REPORTER_ASSERT(reporter, !texRT2->surfacePriv().isSameAs(texRT1)); |
| 36 REPORTER_ASSERT(reporter, !texRT2->asRenderTarget()->surfacePriv().isSam
eAs(texRT1)); | 36 REPORTER_ASSERT(reporter, !texRT2->asRenderTarget()->surfacePriv().isSam
eAs(texRT1)); |
| 37 REPORTER_ASSERT(reporter, !texRT2->surfacePriv().isSameAs(texRT1->asRend
erTarget())); | 37 REPORTER_ASSERT(reporter, !texRT2->surfacePriv().isSameAs(texRT1->asRend
erTarget())); |
| 38 REPORTER_ASSERT(reporter, !texRT2->surfacePriv().isSameAs(tex1)); | 38 REPORTER_ASSERT(reporter, !texRT2->surfacePriv().isSameAs(tex1)); |
| 39 REPORTER_ASSERT(reporter, !texRT2->asRenderTarget()->surfacePriv().isSam
eAs(tex1)); | 39 REPORTER_ASSERT(reporter, !texRT2->asRenderTarget()->surfacePriv().isSam
eAs(tex1)); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 55 REPORTER_ASSERT(reporter, !externalTexRT->asRenderTarget()->surfacePriv(
).isSameAs(texRT1)); | 55 REPORTER_ASSERT(reporter, !externalTexRT->asRenderTarget()->surfacePriv(
).isSameAs(texRT1)); |
| 56 | 56 |
| 57 texRT1->unref(); | 57 texRT1->unref(); |
| 58 texRT2->unref(); | 58 texRT2->unref(); |
| 59 tex1->unref(); | 59 tex1->unref(); |
| 60 externalTexRT->unref(); | 60 externalTexRT->unref(); |
| 61 } | 61 } |
| 62 } | 62 } |
| 63 | 63 |
| 64 #endif | 64 #endif |
| OLD | NEW |