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

Unified Diff: src/gpu/GrTextureProvider.cpp

Issue 1139753002: Refactor GrBufferAllocPools to use resource cache (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Clean up Created 5 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: src/gpu/GrTextureProvider.cpp
diff --git a/src/gpu/GrTextureProvider.cpp b/src/gpu/GrTextureProvider.cpp
index c195398917dc828f14c75a7eaa803a94d836db32..90151b0ba7da60cae178a440741d732c3d75b309 100644
--- a/src/gpu/GrTextureProvider.cpp
+++ b/src/gpu/GrTextureProvider.cpp
@@ -11,12 +11,6 @@
#include "GrResourceCache.h"
#include "GrGpu.h"
-enum ScratchTextureFlags {
- kExact_ScratchTextureFlag = 0x1,
- kNoPendingIO_ScratchTextureFlag = 0x2,
- kNoCreate_ScratchTextureFlag = 0x4,
-};
-
GrTexture* GrTextureProvider::createTexture(const GrSurfaceDesc& desc, bool budgeted,
const void* srcData, size_t rowBytes) {
if (this->isAbandoned()) {
@@ -27,8 +21,7 @@ GrTexture* GrTextureProvider::createTexture(const GrSurfaceDesc& desc, bool budg
return NULL;
}
if (!GrPixelConfigIsCompressed(desc.fConfig)) {
- static const uint32_t kFlags = kExact_ScratchTextureFlag |
- kNoCreate_ScratchTextureFlag;
+ static const uint32_t kFlags = kExact_ScratchFlag | kNoCreate_ScratchFlag;
if (GrTexture* texture = this->internalRefScratchTexture(desc, kFlags)) {
if (!srcData || texture->writePixels(0, 0, desc.fWidth, desc.fHeight, desc.fConfig,
srcData, rowBytes)) {
@@ -43,7 +36,7 @@ GrTexture* GrTextureProvider::createTexture(const GrSurfaceDesc& desc, bool budg
return fGpu->createTexture(desc, budgeted, srcData, rowBytes);
}
-GrTexture* GrTextureProvider::refScratchTexture(const GrSurfaceDesc& desc, ScratchTexMatch match,
+GrTexture* GrTextureProvider::refScratchTexture(const GrSurfaceDesc& desc, ScratchMatch match,
bool calledDuringFlush) {
if (this->isAbandoned()) {
return NULL;
@@ -53,11 +46,11 @@ GrTexture* GrTextureProvider::refScratchTexture(const GrSurfaceDesc& desc, Scrat
return NULL;
} else {
uint32_t flags = 0;
- if (kExact_ScratchTexMatch == match) {
- flags |= kExact_ScratchTextureFlag;
+ if (kExact_ScratchMatch == match) {
+ flags |= kExact_ScratchFlag;
}
if (calledDuringFlush) {
- flags |= kNoPendingIO_ScratchTextureFlag;
+ flags |= kNoPendingIO_ScratchFlag;
}
return this->internalRefScratchTexture(desc, flags);
}
@@ -71,7 +64,7 @@ GrTexture* GrTextureProvider::internalRefScratchTexture(const GrSurfaceDesc& inD
SkTCopyOnFirstWrite<GrSurfaceDesc> desc(inDesc);
if (fGpu->caps()->reuseScratchTextures() || (desc->fFlags & kRenderTarget_GrSurfaceFlag)) {
- if (!(kExact_ScratchTextureFlag & flags)) {
+ if (!(kExact_ScratchFlag & flags)) {
// bin by pow2 with a reasonable min
static const int MIN_SIZE = 16;
GrSurfaceDesc* wdesc = desc.writable();
@@ -82,7 +75,7 @@ GrTexture* GrTextureProvider::internalRefScratchTexture(const GrSurfaceDesc& inD
GrScratchKey key;
GrTexturePriv::ComputeScratchKey(*desc, &key);
uint32_t scratchFlags = 0;
- if (kNoPendingIO_ScratchTextureFlag & flags) {
+ if (kNoPendingIO_ScratchFlag & flags) {
scratchFlags = GrResourceCache::kRequireNoPendingIO_ScratchFlag;
} else if (!(desc->fFlags & kRenderTarget_GrSurfaceFlag)) {
// If it is not a render target then it will most likely be populated by
@@ -100,7 +93,7 @@ GrTexture* GrTextureProvider::internalRefScratchTexture(const GrSurfaceDesc& inD
}
}
- if (!(kNoCreate_ScratchTextureFlag & flags)) {
+ if (!(kNoCreate_ScratchFlag & flags)) {
return fGpu->createTexture(*desc, true, NULL, 0);
}

Powered by Google App Engine
This is Rietveld 408576698