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

Side by Side Diff: tests/TextureStorageAllocator.cpp

Issue 1817383002: switch surface to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 9 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/TextBlobCacheTest.cpp ('k') | tests/WritePixelsTest.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 2016 Google Inc. 2 * Copyright 2016 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 "Test.h" 8 #include "Test.h"
9 #if SK_SUPPORT_GPU 9 #if SK_SUPPORT_GPU
10 #include "gl/GrGLGpu.h" 10 #include "gl/GrGLGpu.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 59
60 const GrGLInterface* gl = glContext->gl(); 60 const GrGLInterface* gl = glContext->gl();
61 TestStorageAllocator allocator; 61 TestStorageAllocator allocator;
62 allocator.m_allowAllocation = true; 62 allocator.m_allowAllocation = true;
63 allocator.m_gl = gl; 63 allocator.m_gl = gl;
64 GrTextureStorageAllocator grAllocator; 64 GrTextureStorageAllocator grAllocator;
65 grAllocator.fAllocateTextureStorage = &TestStorageAllocator::allocateTexture Storage; 65 grAllocator.fAllocateTextureStorage = &TestStorageAllocator::allocateTexture Storage;
66 grAllocator.fDeallocateTextureStorage= &TestStorageAllocator::deallocateText ureStorage; 66 grAllocator.fDeallocateTextureStorage= &TestStorageAllocator::deallocateText ureStorage;
67 grAllocator.fCtx = &allocator; 67 grAllocator.fCtx = &allocator;
68 68
69 SkAutoTUnref<SkSurface> surface(SkSurface_Gpu::NewRenderTarget( 69 auto surface(SkSurface_Gpu::MakeRenderTarget(
70 context, SkBudgeted::kNo, SkImageInfo::MakeN32Premul(kWidth, kHeight ), 0, 70 context, SkBudgeted::kNo, SkImageInfo::MakeN32Premul(kWidth, kHeight ), 0,
71 NULL, grAllocator)); 71 NULL, grAllocator));
72 REPORTER_ASSERT(reporter, surface); 72 REPORTER_ASSERT(reporter, surface);
73 GrGLuint id = allocator.m_mostRecentlyAllocatedStorage; 73 GrGLuint id = allocator.m_mostRecentlyAllocatedStorage;
74 74
75 sk_sp<SkImage> image(surface->makeImageSnapshot()); 75 sk_sp<SkImage> image(surface->makeImageSnapshot());
76 REPORTER_ASSERT(reporter, image->isTextureBacked()); 76 REPORTER_ASSERT(reporter, image->isTextureBacked());
77 SkImageInfo imageInfo = SkImageInfo::MakeN32Premul(1,1); 77 SkImageInfo imageInfo = SkImageInfo::MakeN32Premul(1,1);
78 GrColor dest = 0x11223344; 78 GrColor dest = 0x11223344;
79 REPORTER_ASSERT(reporter, image->readPixels(imageInfo, &dest, 4 * kWidth, 0, 0)); 79 REPORTER_ASSERT(reporter, image->readPixels(imageInfo, &dest, 4 * kWidth, 0, 0));
(...skipping 13 matching lines...) Expand all
93 static const int kHeight = 13; 93 static const int kHeight = 13;
94 94
95 const GrGLInterface* gl = glContext->gl(); 95 const GrGLInterface* gl = glContext->gl();
96 TestStorageAllocator allocator; 96 TestStorageAllocator allocator;
97 allocator.m_allowAllocation = false; 97 allocator.m_allowAllocation = false;
98 allocator.m_gl = gl; 98 allocator.m_gl = gl;
99 GrTextureStorageAllocator grAllocator; 99 GrTextureStorageAllocator grAllocator;
100 grAllocator.fAllocateTextureStorage = &TestStorageAllocator::allocateTexture Storage; 100 grAllocator.fAllocateTextureStorage = &TestStorageAllocator::allocateTexture Storage;
101 grAllocator.fDeallocateTextureStorage= &TestStorageAllocator::deallocateText ureStorage; 101 grAllocator.fDeallocateTextureStorage= &TestStorageAllocator::deallocateText ureStorage;
102 grAllocator.fCtx = &allocator; 102 grAllocator.fCtx = &allocator;
103 SkAutoTUnref<SkSurface> surface(SkSurface_Gpu::NewRenderTarget( 103 auto surface(SkSurface_Gpu::MakeRenderTarget(
104 context, SkBudgeted::kNo, SkImageInfo::MakeN32Premul(kWidth, kHeight ), 0, 104 context, SkBudgeted::kNo, SkImageInfo::MakeN32Premul(kWidth, kHeight ), 0,
105 NULL, grAllocator)); 105 NULL, grAllocator));
106 REPORTER_ASSERT(reporter, !surface); 106 REPORTER_ASSERT(reporter, !surface);
107 } 107 }
108 108
109 #endif 109 #endif
OLDNEW
« no previous file with comments | « tests/TextBlobCacheTest.cpp ('k') | tests/WritePixelsTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698