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

Side by Side Diff: src/gpu/GrBufferAllocPool.cpp

Issue 865913002: Initialize the pad memory in GrBufferAllocPool. (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Created 5 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
« no previous file with comments | « no previous file | no next file » | 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 /* 2 /*
3 * Copyright 2010 Google Inc. 3 * Copyright 2010 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #include "GrBufferAllocPool.h" 10 #include "GrBufferAllocPool.h"
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 177
178 SkASSERT(buffer); 178 SkASSERT(buffer);
179 SkASSERT(offset); 179 SkASSERT(offset);
180 180
181 if (fBufferPtr) { 181 if (fBufferPtr) {
182 BufferBlock& back = fBlocks.back(); 182 BufferBlock& back = fBlocks.back();
183 size_t usedBytes = back.fBuffer->gpuMemorySize() - back.fBytesFree; 183 size_t usedBytes = back.fBuffer->gpuMemorySize() - back.fBytesFree;
184 size_t pad = GrSizeAlignUpPad(usedBytes, 184 size_t pad = GrSizeAlignUpPad(usedBytes,
185 alignment); 185 alignment);
186 if ((size + pad) <= back.fBytesFree) { 186 if ((size + pad) <= back.fBytesFree) {
187 memset((void*)(reinterpret_cast<intptr_t>(fBufferPtr) + usedBytes), 0, pad);
187 usedBytes += pad; 188 usedBytes += pad;
188 *offset = usedBytes; 189 *offset = usedBytes;
189 *buffer = back.fBuffer; 190 *buffer = back.fBuffer;
190 back.fBytesFree -= size + pad; 191 back.fBytesFree -= size + pad;
191 fBytesInUse += size + pad; 192 fBytesInUse += size + pad;
192 VALIDATE(); 193 VALIDATE();
193 return (void*)(reinterpret_cast<intptr_t>(fBufferPtr) + usedBytes); 194 return (void*)(reinterpret_cast<intptr_t>(fBufferPtr) + usedBytes);
194 } 195 }
195 } 196 }
196 197
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 return ptr; 469 return ptr;
469 } 470 }
470 471
471 int GrIndexBufferAllocPool::preallocatedBufferIndices() const { 472 int GrIndexBufferAllocPool::preallocatedBufferIndices() const {
472 return static_cast<int>(INHERITED::preallocatedBufferSize() / sizeof(uint16_ t)); 473 return static_cast<int>(INHERITED::preallocatedBufferSize() / sizeof(uint16_ t));
473 } 474 }
474 475
475 int GrIndexBufferAllocPool::currentBufferIndices() const { 476 int GrIndexBufferAllocPool::currentBufferIndices() const {
476 return currentBufferItems(sizeof(uint16_t)); 477 return currentBufferItems(sizeof(uint16_t));
477 } 478 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698