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

Unified Diff: src/gpu/GrGpu.h

Issue 1765633002: Don't allow nullptr in texels array params (unless using a transfer buffer). (Closed) Base URL: https://skia.googlesource.com/skia@usesdk
Patch Set: Upload again in case prev didn't work 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/gpu/GrTextureProvider.h ('k') | src/gpu/GrGpu.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrGpu.h
diff --git a/src/gpu/GrGpu.h b/src/gpu/GrGpu.h
index ebe4116ebed388ee8277554baa1692a0cacbb607..9725590544fbc599bf91df5317462e764108c623 100644
--- a/src/gpu/GrGpu.h
+++ b/src/gpu/GrGpu.h
@@ -97,21 +97,21 @@ public:
const SkTArray<GrMipLevel>& texels);
/**
- * This function is a shim which creates a SkTArGrMipLevell> of size 1.
- * It then calls createTexture with that SkTArray.
- *
- * @param srcData texel data to load texture. Begins with full-size
- * palette data for paletted texture. For compressed
- * formats it contains the compressed pixel data. Otherwise,
- * it contains width*height texels. If nullptr texture data
- * is uninitialized.
- * @param rowBytes the number of bytes between consecutive rows. Zero
- * means rows are tightly packed. This field is ignored
- * for compressed pixel formats.
- * @return The texture object if successful, otherwise, nullptr.
+ * Simplified createTexture() interface for when there is no initial texel data to upload.
*/
- GrTexture* createTexture(const GrSurfaceDesc& desc, SkBudgeted budgeted,
- const void* srcData, size_t rowBytes);
+ GrTexture* createTexture(const GrSurfaceDesc& desc, SkBudgeted budgeted) {
+ return this->createTexture(desc, budgeted, SkTArray<GrMipLevel>());
+ }
+
+ /** Simplified createTexture() interface for when there is only a base level */
+ GrTexture* createTexture(const GrSurfaceDesc& desc, SkBudgeted budgeted, const void* level0Data,
+ size_t rowBytes) {
+ SkASSERT(level0Data);
+ GrMipLevel level = { level0Data, rowBytes };
+ SkSTArray<1, GrMipLevel> array;
+ array.push_back() = level;
+ return this->createTexture(desc, budgeted, array);
+ }
/**
* Implements GrTextureProvider::wrapBackendTexture
« no previous file with comments | « include/gpu/GrTextureProvider.h ('k') | src/gpu/GrGpu.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698