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 "GrTexture.h" | 13 #include "GrTexture.h" |
14 #include "GrTexturePriv.h" | 14 #include "GrTexturePriv.h" |
15 #include "SkCanvas.h" | 15 #include "SkCanvas.h" |
16 #include "SkGr.h" | 16 #include "SkGr.h" |
17 #include "SkSurface.h" | 17 #include "SkSurface.h" |
18 #include "Test.h" | 18 #include "Test.h" |
19 | 19 |
20 // Tests that GrSurface::asTexture(), GrSurface::asRenderTarget(), and static up
casting of texture | 20 // Tests that GrSurface::asTexture(), GrSurface::asRenderTarget(), and static up
casting of texture |
21 // and render targets to GrSurface all work as expected. | 21 // and render targets to GrSurface all work as expected. |
22 DEF_GPUTEST_FOR_NULLGL_CONTEXT(GrTextureMipMapInvalidationTest, reporter, ctxInf
o) { | 22 DEF_GPUTEST_FOR_NULLGL_CONTEXT(GrTextureMipMapInvalidationTest, reporter, ctxInf
o) { |
23 GrContext* context = ctxInfo.fGrContext; | 23 GrContext* context = ctxInfo.grContext(); |
24 GrSurfaceDesc desc; | 24 GrSurfaceDesc desc; |
25 desc.fConfig = kSkia8888_GrPixelConfig; | 25 desc.fConfig = kSkia8888_GrPixelConfig; |
26 desc.fFlags = kRenderTarget_GrSurfaceFlag; | 26 desc.fFlags = kRenderTarget_GrSurfaceFlag; |
27 desc.fWidth = 256; | 27 desc.fWidth = 256; |
28 desc.fHeight = 256; | 28 desc.fHeight = 256; |
29 desc.fSampleCnt = 0; | 29 desc.fSampleCnt = 0; |
30 GrSurface* texRT1 = context->textureProvider()->createTexture( | 30 GrSurface* texRT1 = context->textureProvider()->createTexture( |
31 desc, SkBudgeted::kNo, nullptr, 0); | 31 desc, SkBudgeted::kNo, nullptr, 0); |
32 GrSurface* texRT2 = context->textureProvider()->createTexture( | 32 GrSurface* texRT2 = context->textureProvider()->createTexture( |
33 desc, SkBudgeted::kNo, nullptr, 0); | 33 desc, SkBudgeted::kNo, nullptr, 0); |
(...skipping 21 matching lines...) Expand all Loading... |
55 // Invalidating the contents of the bitmap should invalidate the mipmap, but
not de-allocate | 55 // Invalidating the contents of the bitmap should invalidate the mipmap, but
not de-allocate |
56 bitmap.notifyPixelsChanged(); | 56 bitmap.notifyPixelsChanged(); |
57 REPORTER_ASSERT(reporter, true == tex->texturePriv().hasMipMaps()); | 57 REPORTER_ASSERT(reporter, true == tex->texturePriv().hasMipMaps()); |
58 REPORTER_ASSERT(reporter, true == tex->texturePriv().mipMapsAreDirty()); | 58 REPORTER_ASSERT(reporter, true == tex->texturePriv().mipMapsAreDirty()); |
59 | 59 |
60 texRT1->unref(); | 60 texRT1->unref(); |
61 texRT2->unref(); | 61 texRT2->unref(); |
62 } | 62 } |
63 | 63 |
64 #endif | 64 #endif |
OLD | NEW |