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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « include/gpu/GrTextureProvider.h ('k') | src/gpu/GrGpu.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 2011 Google Inc. 2 * Copyright 2011 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 #ifndef GrGpu_DEFINED 8 #ifndef GrGpu_DEFINED
9 #define GrGpu_DEFINED 9 #define GrGpu_DEFINED
10 10
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 * For compressed formats the level contains the compress ed pixel data. 90 * For compressed formats the level contains the compress ed pixel data.
91 * Otherwise, it contains width*height texels. If there i s only one 91 * Otherwise, it contains width*height texels. If there i s only one
92 * element and it contains nullptr fPixels, texture data is 92 * element and it contains nullptr fPixels, texture data is
93 * uninitialized. 93 * uninitialized.
94 * @return The texture object if successful, otherwise nullptr. 94 * @return The texture object if successful, otherwise nullptr.
95 */ 95 */
96 GrTexture* createTexture(const GrSurfaceDesc& desc, SkBudgeted budgeted, 96 GrTexture* createTexture(const GrSurfaceDesc& desc, SkBudgeted budgeted,
97 const SkTArray<GrMipLevel>& texels); 97 const SkTArray<GrMipLevel>& texels);
98 98
99 /** 99 /**
100 * This function is a shim which creates a SkTArGrMipLevell> of size 1. 100 * Simplified createTexture() interface for when there is no initial texel d ata to upload.
101 * It then calls createTexture with that SkTArray.
102 *
103 * @param srcData texel data to load texture. Begins with full-size
104 * palette data for paletted texture. For compressed
105 * formats it contains the compressed pixel data. Otherwise,
106 * it contains width*height texels. If nullptr texture data
107 * is uninitialized.
108 * @param rowBytes the number of bytes between consecutive rows. Zero
109 * means rows are tightly packed. This field is ignored
110 * for compressed pixel formats.
111 * @return The texture object if successful, otherwise, nullptr.
112 */ 101 */
113 GrTexture* createTexture(const GrSurfaceDesc& desc, SkBudgeted budgeted, 102 GrTexture* createTexture(const GrSurfaceDesc& desc, SkBudgeted budgeted) {
114 const void* srcData, size_t rowBytes); 103 return this->createTexture(desc, budgeted, SkTArray<GrMipLevel>());
104 }
105
106 /** Simplified createTexture() interface for when there is only a base level */
107 GrTexture* createTexture(const GrSurfaceDesc& desc, SkBudgeted budgeted, con st void* level0Data,
108 size_t rowBytes) {
109 SkASSERT(level0Data);
110 GrMipLevel level = { level0Data, rowBytes };
111 SkSTArray<1, GrMipLevel> array;
112 array.push_back() = level;
113 return this->createTexture(desc, budgeted, array);
114 }
115 115
116 /** 116 /**
117 * Implements GrTextureProvider::wrapBackendTexture 117 * Implements GrTextureProvider::wrapBackendTexture
118 */ 118 */
119 GrTexture* wrapBackendTexture(const GrBackendTextureDesc&, GrWrapOwnership); 119 GrTexture* wrapBackendTexture(const GrBackendTextureDesc&, GrWrapOwnership);
120 120
121 /** 121 /**
122 * Implements GrTextureProvider::wrapBackendRenderTarget 122 * Implements GrTextureProvider::wrapBackendRenderTarget
123 */ 123 */
124 GrRenderTarget* wrapBackendRenderTarget(const GrBackendRenderTargetDesc&, Gr WrapOwnership); 124 GrRenderTarget* wrapBackendRenderTarget(const GrBackendRenderTargetDesc&, Gr WrapOwnership);
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after
635 SkTArray<const MultisampleSpecs*, true> fMultisa mpleSpecsMap; 635 SkTArray<const MultisampleSpecs*, true> fMultisa mpleSpecsMap;
636 GrTAllocator<MultisampleSpecs> fMultisa mpleSpecsAllocator; 636 GrTAllocator<MultisampleSpecs> fMultisa mpleSpecsAllocator;
637 // The context owns us, not vice-versa, so this ptr is not ref'ed by Gpu. 637 // The context owns us, not vice-versa, so this ptr is not ref'ed by Gpu.
638 GrContext* fContext ; 638 GrContext* fContext ;
639 639
640 friend class GrPathRendering; 640 friend class GrPathRendering;
641 typedef SkRefCnt INHERITED; 641 typedef SkRefCnt INHERITED;
642 }; 642 };
643 643
644 #endif 644 #endif
OLDNEW
« 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