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 11 matching lines...) Expand all Loading... |
22 // and render targets to GrSurface all work as expected. | 22 // and render targets to GrSurface all work as expected. |
23 DEF_GPUTEST(GrTextureMipMapInvalidationTest, reporter, factory) { | 23 DEF_GPUTEST(GrTextureMipMapInvalidationTest, reporter, factory) { |
24 GrContext* context = factory->get(GrContextFactory::kNull_GLContextType); | 24 GrContext* context = factory->get(GrContextFactory::kNull_GLContextType); |
25 if (context) { | 25 if (context) { |
26 GrSurfaceDesc desc; | 26 GrSurfaceDesc desc; |
27 desc.fConfig = kSkia8888_GrPixelConfig; | 27 desc.fConfig = kSkia8888_GrPixelConfig; |
28 desc.fFlags = kRenderTarget_GrSurfaceFlag; | 28 desc.fFlags = kRenderTarget_GrSurfaceFlag; |
29 desc.fWidth = 256; | 29 desc.fWidth = 256; |
30 desc.fHeight = 256; | 30 desc.fHeight = 256; |
31 desc.fSampleCnt = 0; | 31 desc.fSampleCnt = 0; |
| 32 |
32 GrSurface* texRT1 = context->textureProvider()->createTexture(desc, fals
e, nullptr, 0); | 33 GrSurface* texRT1 = context->textureProvider()->createTexture(desc, fals
e, nullptr, 0); |
| 34 texRT1->setFromRawPixels(true); |
| 35 texRT1->setException(true); |
33 GrSurface* texRT2 = context->textureProvider()->createTexture(desc, fals
e, nullptr, 0); | 36 GrSurface* texRT2 = context->textureProvider()->createTexture(desc, fals
e, nullptr, 0); |
34 REPORTER_ASSERT(reporter, nullptr != texRT1); | 37 REPORTER_ASSERT(reporter, nullptr != texRT1); |
35 REPORTER_ASSERT(reporter, nullptr != texRT2); | 38 REPORTER_ASSERT(reporter, nullptr != texRT2); |
36 GrTexture* tex = texRT1->asTexture(); | 39 GrTexture* tex = texRT1->asTexture(); |
37 REPORTER_ASSERT(reporter, nullptr != tex); | 40 REPORTER_ASSERT(reporter, nullptr != tex); |
38 SkBitmap bitmap; | 41 SkBitmap bitmap; |
39 GrWrapTextureInBitmap(tex, 256, 256, false, &bitmap); | 42 GrWrapTextureInBitmap(tex, 256, 256, false, &bitmap); |
40 | 43 |
41 // No mipmaps initially | 44 // No mipmaps initially |
42 REPORTER_ASSERT(reporter, false == tex->texturePriv().hasMipMaps()); | 45 REPORTER_ASSERT(reporter, false == tex->texturePriv().hasMipMaps()); |
(...skipping 14 matching lines...) Expand all Loading... |
57 REPORTER_ASSERT(reporter, true == tex->texturePriv().hasMipMaps()); | 60 REPORTER_ASSERT(reporter, true == tex->texturePriv().hasMipMaps()); |
58 REPORTER_ASSERT(reporter, true == tex->texturePriv().mipMapsAreDirty()); | 61 REPORTER_ASSERT(reporter, true == tex->texturePriv().mipMapsAreDirty()); |
59 | 62 |
60 surface->unref(); | 63 surface->unref(); |
61 texRT1->unref(); | 64 texRT1->unref(); |
62 texRT2->unref(); | 65 texRT2->unref(); |
63 } | 66 } |
64 } | 67 } |
65 | 68 |
66 #endif | 69 #endif |
OLD | NEW |