Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Side by Side Diff: tests/GrTextureMipMapInvalidationTest.cpp

Issue 1728093005: Move Budgeted enum out of SkSurface, use in GrTextureProvider (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add aliases for Chrome Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tests/GrSurfaceTest.cpp ('k') | tests/ImageFilterCacheTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_NULL_CONTEXT(GrTextureMipMapInvalidationTest, reporter, context) { 22 DEF_GPUTEST_FOR_NULL_CONTEXT(GrTextureMipMapInvalidationTest, reporter, context) {
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(desc, false, n ullptr, 0); 29 GrSurface* texRT1 = context->textureProvider()->createTexture(
30 GrSurface* texRT2 = context->textureProvider()->createTexture(desc, false, n ullptr, 0); 30 desc, SkBudgeted::kNo, nullptr, 0);
31 GrSurface* texRT2 = context->textureProvider()->createTexture(
32 desc, SkBudgeted::kNo, nullptr, 0);
31 REPORTER_ASSERT(reporter, nullptr != texRT1); 33 REPORTER_ASSERT(reporter, nullptr != texRT1);
32 REPORTER_ASSERT(reporter, nullptr != texRT2); 34 REPORTER_ASSERT(reporter, nullptr != texRT2);
33 GrTexture* tex = texRT1->asTexture(); 35 GrTexture* tex = texRT1->asTexture();
34 REPORTER_ASSERT(reporter, nullptr != tex); 36 REPORTER_ASSERT(reporter, nullptr != tex);
35 SkBitmap bitmap; 37 SkBitmap bitmap;
36 GrWrapTextureInBitmap(tex, 256, 256, false, &bitmap); 38 GrWrapTextureInBitmap(tex, 256, 256, false, &bitmap);
37 39
38 // No mipmaps initially 40 // No mipmaps initially
39 REPORTER_ASSERT(reporter, false == tex->texturePriv().hasMipMaps()); 41 REPORTER_ASSERT(reporter, false == tex->texturePriv().hasMipMaps());
40 42
(...skipping 12 matching lines...) Expand all
53 bitmap.notifyPixelsChanged(); 55 bitmap.notifyPixelsChanged();
54 REPORTER_ASSERT(reporter, true == tex->texturePriv().hasMipMaps()); 56 REPORTER_ASSERT(reporter, true == tex->texturePriv().hasMipMaps());
55 REPORTER_ASSERT(reporter, true == tex->texturePriv().mipMapsAreDirty()); 57 REPORTER_ASSERT(reporter, true == tex->texturePriv().mipMapsAreDirty());
56 58
57 surface->unref(); 59 surface->unref();
58 texRT1->unref(); 60 texRT1->unref();
59 texRT2->unref(); 61 texRT2->unref();
60 } 62 }
61 63
62 #endif 64 #endif
OLDNEW
« no previous file with comments | « tests/GrSurfaceTest.cpp ('k') | tests/ImageFilterCacheTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698