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

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

Issue 27192003: Start cleaning up 64bit Win warnings (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: revertedGrBytesPerPixel to returning a size_t Created 7 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « src/core/SkRTree.cpp ('k') | src/gpu/GrDefaultPathRenderer.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 /* 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 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 VALIDATE(); 196 VALIDATE();
197 return fBufferPtr; 197 return fBufferPtr;
198 } 198 }
199 199
200 int GrBufferAllocPool::currentBufferItems(size_t itemSize) const { 200 int GrBufferAllocPool::currentBufferItems(size_t itemSize) const {
201 VALIDATE(); 201 VALIDATE();
202 if (NULL != fBufferPtr) { 202 if (NULL != fBufferPtr) {
203 const BufferBlock& back = fBlocks.back(); 203 const BufferBlock& back = fBlocks.back();
204 size_t usedBytes = back.fBuffer->sizeInBytes() - back.fBytesFree; 204 size_t usedBytes = back.fBuffer->sizeInBytes() - back.fBytesFree;
205 size_t pad = GrSizeAlignUpPad(usedBytes, itemSize); 205 size_t pad = GrSizeAlignUpPad(usedBytes, itemSize);
206 return (back.fBytesFree - pad) / itemSize; 206 return static_cast<int>((back.fBytesFree - pad) / itemSize);
207 } else if (fPreallocBuffersInUse < fPreallocBuffers.count()) { 207 } else if (fPreallocBuffersInUse < fPreallocBuffers.count()) {
208 return fMinBlockSize / itemSize; 208 return static_cast<int>(fMinBlockSize / itemSize);
209 } 209 }
210 return 0; 210 return 0;
211 } 211 }
212 212
213 int GrBufferAllocPool::preallocatedBuffersRemaining() const { 213 int GrBufferAllocPool::preallocatedBuffersRemaining() const {
214 return fPreallocBuffers.count() - fPreallocBuffersInUse; 214 return fPreallocBuffers.count() - fPreallocBuffersInUse;
215 } 215 }
216 216
217 int GrBufferAllocPool::preallocatedBufferCount() const { 217 int GrBufferAllocPool::preallocatedBufferCount() const {
218 return fPreallocBuffers.count(); 218 return fPreallocBuffers.count();
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 397
398 size_t offset = 0; // assign to suppress warning 398 size_t offset = 0; // assign to suppress warning
399 const GrGeometryBuffer* geomBuffer = NULL; // assign to suppress warning 399 const GrGeometryBuffer* geomBuffer = NULL; // assign to suppress warning
400 void* ptr = INHERITED::makeSpace(vertexSize * vertexCount, 400 void* ptr = INHERITED::makeSpace(vertexSize * vertexCount,
401 vertexSize, 401 vertexSize,
402 &geomBuffer, 402 &geomBuffer,
403 &offset); 403 &offset);
404 404
405 *buffer = (const GrVertexBuffer*) geomBuffer; 405 *buffer = (const GrVertexBuffer*) geomBuffer;
406 SkASSERT(0 == offset % vertexSize); 406 SkASSERT(0 == offset % vertexSize);
407 *startVertex = offset / vertexSize; 407 *startVertex = static_cast<int>(offset / vertexSize);
408 return ptr; 408 return ptr;
409 } 409 }
410 410
411 bool GrVertexBufferAllocPool::appendVertices(size_t vertexSize, 411 bool GrVertexBufferAllocPool::appendVertices(size_t vertexSize,
412 int vertexCount, 412 int vertexCount,
413 const void* vertices, 413 const void* vertices,
414 const GrVertexBuffer** buffer, 414 const GrVertexBuffer** buffer,
415 int* startVertex) { 415 int* startVertex) {
416 void* space = makeSpace(vertexSize, vertexCount, buffer, startVertex); 416 void* space = makeSpace(vertexSize, vertexCount, buffer, startVertex);
417 if (NULL != space) { 417 if (NULL != space) {
418 memcpy(space, 418 memcpy(space,
419 vertices, 419 vertices,
420 vertexSize * vertexCount); 420 vertexSize * vertexCount);
421 return true; 421 return true;
422 } else { 422 } else {
423 return false; 423 return false;
424 } 424 }
425 } 425 }
426 426
427 int GrVertexBufferAllocPool::preallocatedBufferVertices(size_t vertexSize) const { 427 int GrVertexBufferAllocPool::preallocatedBufferVertices(size_t vertexSize) const {
428 return INHERITED::preallocatedBufferSize() / vertexSize; 428 return static_cast<int>(INHERITED::preallocatedBufferSize() / vertexSize);
429 } 429 }
430 430
431 int GrVertexBufferAllocPool::currentBufferVertices(size_t vertexSize) const { 431 int GrVertexBufferAllocPool::currentBufferVertices(size_t vertexSize) const {
432 return currentBufferItems(vertexSize); 432 return currentBufferItems(vertexSize);
433 } 433 }
434 434
435 //////////////////////////////////////////////////////////////////////////////// 435 ////////////////////////////////////////////////////////////////////////////////
436 436
437 GrIndexBufferAllocPool::GrIndexBufferAllocPool(GrGpu* gpu, 437 GrIndexBufferAllocPool::GrIndexBufferAllocPool(GrGpu* gpu,
438 bool frequentResetHint, 438 bool frequentResetHint,
(...skipping 16 matching lines...) Expand all
455 455
456 size_t offset = 0; // assign to suppress warning 456 size_t offset = 0; // assign to suppress warning
457 const GrGeometryBuffer* geomBuffer = NULL; // assign to suppress warning 457 const GrGeometryBuffer* geomBuffer = NULL; // assign to suppress warning
458 void* ptr = INHERITED::makeSpace(indexCount * sizeof(uint16_t), 458 void* ptr = INHERITED::makeSpace(indexCount * sizeof(uint16_t),
459 sizeof(uint16_t), 459 sizeof(uint16_t),
460 &geomBuffer, 460 &geomBuffer,
461 &offset); 461 &offset);
462 462
463 *buffer = (const GrIndexBuffer*) geomBuffer; 463 *buffer = (const GrIndexBuffer*) geomBuffer;
464 SkASSERT(0 == offset % sizeof(uint16_t)); 464 SkASSERT(0 == offset % sizeof(uint16_t));
465 *startIndex = offset / sizeof(uint16_t); 465 *startIndex = static_cast<int>(offset / sizeof(uint16_t));
466 return ptr; 466 return ptr;
467 } 467 }
468 468
469 bool GrIndexBufferAllocPool::appendIndices(int indexCount, 469 bool GrIndexBufferAllocPool::appendIndices(int indexCount,
470 const void* indices, 470 const void* indices,
471 const GrIndexBuffer** buffer, 471 const GrIndexBuffer** buffer,
472 int* startIndex) { 472 int* startIndex) {
473 void* space = makeSpace(indexCount, buffer, startIndex); 473 void* space = makeSpace(indexCount, buffer, startIndex);
474 if (NULL != space) { 474 if (NULL != space) {
475 memcpy(space, indices, sizeof(uint16_t) * indexCount); 475 memcpy(space, indices, sizeof(uint16_t) * indexCount);
476 return true; 476 return true;
477 } else { 477 } else {
478 return false; 478 return false;
479 } 479 }
480 } 480 }
481 481
482 int GrIndexBufferAllocPool::preallocatedBufferIndices() const { 482 int GrIndexBufferAllocPool::preallocatedBufferIndices() const {
483 return INHERITED::preallocatedBufferSize() / sizeof(uint16_t); 483 return static_cast<int>(INHERITED::preallocatedBufferSize() / sizeof(uint16_ t));
484 } 484 }
485 485
486 int GrIndexBufferAllocPool::currentBufferIndices() const { 486 int GrIndexBufferAllocPool::currentBufferIndices() const {
487 return currentBufferItems(sizeof(uint16_t)); 487 return currentBufferItems(sizeof(uint16_t));
488 } 488 }
OLDNEW
« no previous file with comments | « src/core/SkRTree.cpp ('k') | src/gpu/GrDefaultPathRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698