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

Unified Diff: src/gpu/GrTextureProvider.cpp

Issue 1225923010: Refugee from Dead Machine 4: MDB Monster Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Last update from dead machine Created 4 years, 8 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
« no previous file with comments | « src/gpu/GrTextureParamsAdjuster.cpp ('k') | src/gpu/GrVertices.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrTextureProvider.cpp
diff --git a/src/gpu/GrTextureProvider.cpp b/src/gpu/GrTextureProvider.cpp
index cb652f7a7fd8c2e27b46fb7a4c802a4031b900e1..774d6052ce46241b8e99558fbbae2915e542fcb5 100644
--- a/src/gpu/GrTextureProvider.cpp
+++ b/src/gpu/GrTextureProvider.cpp
@@ -30,21 +30,32 @@ GrTexture* GrTextureProvider::createTexture(const GrSurfaceDesc& desc, bool budg
static const uint32_t kFlags = kExact_ScratchTextureFlag |
kNoCreate_ScratchTextureFlag;
if (GrTexture* texture = this->refScratchTexture(desc, kFlags)) {
- if (!srcData || texture->writePixels(0, 0, desc.fWidth, desc.fHeight, desc.fConfig,
+ if (!srcData || texture->writePixels(NULL, 0, 0, desc.fWidth, desc.fHeight, desc.fConfig,
srcData, rowBytes)) {
if (!budgeted) {
texture->resourcePriv().makeUnbudgeted();
}
+ if (srcData) {
+ texture->setFromRawPixels(true);
+ }
return texture;
}
texture->unref();
}
}
- return fGpu->createTexture(desc, budgeted, srcData, rowBytes);
+ GrTexture* tmp = fGpu->createTexture(desc, budgeted, srcData, rowBytes);
+ if (tmp && srcData) {
+ tmp->setFromRawPixels(true);
+ }
+ return tmp;
}
GrTexture* GrTextureProvider::createApproxTexture(const GrSurfaceDesc& desc) {
- return this->internalCreateApproxTexture(desc, 0);
+ GrTexture* texture = this->internalCreateApproxTexture(desc, 0);
+ if (texture) {
+ SkASSERT(!texture->fromRawPixels2());
+ }
+ return texture;
}
GrTexture* GrTextureProvider::internalCreateApproxTexture(const GrSurfaceDesc& desc,
@@ -93,6 +104,7 @@ GrTexture* GrTextureProvider::refScratchTexture(const GrSurfaceDesc& inDesc,
GrSurface* surface = static_cast<GrSurface*>(resource);
GrRenderTarget* rt = surface->asRenderTarget();
if (rt && fGpu->caps()->discardRenderTargetSupport()) {
+ // trash the existing DC in this case
rt->discard();
}
return surface->asTexture();
« no previous file with comments | « src/gpu/GrTextureParamsAdjuster.cpp ('k') | src/gpu/GrVertices.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698