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

Side by Side Diff: src/gpu/effects/GrTextureStripAtlas.cpp

Issue 1249543003: Creating functions for uploading a mipmapped texture. (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Refactoring the mipmap level count out. Cleaning includes. Created 4 years, 11 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
OLDNEW
1
2 /* 1 /*
3 * Copyright 2012 Google Inc. 2 * Copyright 2012 Google Inc.
4 * 3 *
5 * 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
6 * found in the LICENSE file. 5 * found in the LICENSE file.
7 */ 6 */
8 7
9 #include "GrTextureStripAtlas.h" 8 #include "GrTextureStripAtlas.h"
10 #include "GrContext.h" 9 #include "GrContext.h"
11 #include "GrTexture.h" 10 #include "GrTexture.h"
12 #include "SkGr.h" 11 #include "SkGr.h"
13 #include "SkPixelRef.h" 12 #include "SkPixelRef.h"
14 #include "SkTSearch.h" 13 #include "SkTSearch.h"
15 14
16 #ifdef SK_DEBUG 15 #ifdef SK_DEBUG
17 #define VALIDATE this->validate() 16 #define VALIDATE this->validate()
18 #else 17 #else
19 #define VALIDATE 18 #define VALIDATE
20 #endif 19 #endif
21 20
22 class GrTextureStripAtlas::Hash : public SkTDynamicHash<GrTextureStripAtlas::Atl asEntry, 21 class GrTextureStripAtlas::Hash : public SkTDynamicHash<GrTextureStripAtlas::Atl asEntry,
23 GrTextureStripAtlas::Des c> {}; 22 GrTextureStripAtlas::Des c> {};
24 23
25 int32_t GrTextureStripAtlas::gCacheCount = 0; 24 int32_t GrTextureStripAtlas::gCacheCount = 0;
26 25
27 GrTextureStripAtlas::Hash* GrTextureStripAtlas::gAtlasCache = nullptr; 26 GrTextureStripAtlas::Hash* GrTextureStripAtlas::gAtlasCache = nullptr;
28 27
29 GrTextureStripAtlas::Hash* GrTextureStripAtlas::GetCache() { 28 GrTextureStripAtlas::Hash* GrTextureStripAtlas::GetCache() {
30 29
31 if (nullptr == gAtlasCache) { 30 if (nullptr == gAtlasCache) {
32 gAtlasCache = new Hash; 31 gAtlasCache = new Hash;
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 // Front is least-recently-used 187 // Front is least-recently-used
189 AtlasRow* row = fLRUFront; 188 AtlasRow* row = fLRUFront;
190 return row; 189 return row;
191 } 190 }
192 191
193 void GrTextureStripAtlas::lockTexture() { 192 void GrTextureStripAtlas::lockTexture() {
194 GrSurfaceDesc texDesc; 193 GrSurfaceDesc texDesc;
195 texDesc.fWidth = fDesc.fWidth; 194 texDesc.fWidth = fDesc.fWidth;
196 texDesc.fHeight = fDesc.fHeight; 195 texDesc.fHeight = fDesc.fHeight;
197 texDesc.fConfig = fDesc.fConfig; 196 texDesc.fConfig = fDesc.fConfig;
197 texDesc.fIsMipMapped = false;
198 198
199 static const GrUniqueKey::Domain kDomain = GrUniqueKey::GenerateDomain(); 199 static const GrUniqueKey::Domain kDomain = GrUniqueKey::GenerateDomain();
200 GrUniqueKey key; 200 GrUniqueKey key;
201 GrUniqueKey::Builder builder(&key, kDomain, 1); 201 GrUniqueKey::Builder builder(&key, kDomain, 1);
202 builder[0] = static_cast<uint32_t>(fCacheKey); 202 builder[0] = static_cast<uint32_t>(fCacheKey);
203 builder.finish(); 203 builder.finish();
204 204
205 fTexture = fDesc.fContext->textureProvider()->findAndRefTextureByUniqueKey(k ey); 205 fTexture = fDesc.fContext->textureProvider()->findAndRefTextureByUniqueKey(k ey);
206 if (nullptr == fTexture) { 206 if (nullptr == fTexture) {
207 fTexture = fDesc.fContext->textureProvider()->createTexture(texDesc, tru e, nullptr, 0); 207 fTexture = fDesc.fContext->textureProvider()->createTexture(texDesc, tru e, nullptr, 0);
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 342
343 // If we have locked rows, we should have a locked texture, otherwise 343 // If we have locked rows, we should have a locked texture, otherwise
344 // it should be unlocked 344 // it should be unlocked
345 if (fLockedRows == 0) { 345 if (fLockedRows == 0) {
346 SkASSERT(nullptr == fTexture); 346 SkASSERT(nullptr == fTexture);
347 } else { 347 } else {
348 SkASSERT(fTexture); 348 SkASSERT(fTexture);
349 } 349 }
350 } 350 }
351 #endif 351 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698