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

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

Issue 699733002: removing setVertexArraySource from drawtarget (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: a bit more cleanup Created 6 years, 1 month 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 | « src/gpu/GrBufferAllocPool.h ('k') | src/gpu/GrContext.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 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 vertexSize, 412 vertexSize,
413 &geomBuffer, 413 &geomBuffer,
414 &offset); 414 &offset);
415 415
416 *buffer = (const GrVertexBuffer*) geomBuffer; 416 *buffer = (const GrVertexBuffer*) geomBuffer;
417 SkASSERT(0 == offset % vertexSize); 417 SkASSERT(0 == offset % vertexSize);
418 *startVertex = static_cast<int>(offset / vertexSize); 418 *startVertex = static_cast<int>(offset / vertexSize);
419 return ptr; 419 return ptr;
420 } 420 }
421 421
422 bool GrVertexBufferAllocPool::appendVertices(size_t vertexSize,
423 int vertexCount,
424 const void* vertices,
425 const GrVertexBuffer** buffer,
426 int* startVertex) {
427 void* space = makeSpace(vertexSize, vertexCount, buffer, startVertex);
428 if (space) {
429 memcpy(space,
430 vertices,
431 vertexSize * vertexCount);
432 return true;
433 } else {
434 return false;
435 }
436 }
437
438 int GrVertexBufferAllocPool::preallocatedBufferVertices(size_t vertexSize) const { 422 int GrVertexBufferAllocPool::preallocatedBufferVertices(size_t vertexSize) const {
439 return static_cast<int>(INHERITED::preallocatedBufferSize() / vertexSize); 423 return static_cast<int>(INHERITED::preallocatedBufferSize() / vertexSize);
440 } 424 }
441 425
442 int GrVertexBufferAllocPool::currentBufferVertices(size_t vertexSize) const { 426 int GrVertexBufferAllocPool::currentBufferVertices(size_t vertexSize) const {
443 return currentBufferItems(vertexSize); 427 return currentBufferItems(vertexSize);
444 } 428 }
445 429
446 //////////////////////////////////////////////////////////////////////////////// 430 ////////////////////////////////////////////////////////////////////////////////
447 431
(...skipping 22 matching lines...) Expand all
470 sizeof(uint16_t), 454 sizeof(uint16_t),
471 &geomBuffer, 455 &geomBuffer,
472 &offset); 456 &offset);
473 457
474 *buffer = (const GrIndexBuffer*) geomBuffer; 458 *buffer = (const GrIndexBuffer*) geomBuffer;
475 SkASSERT(0 == offset % sizeof(uint16_t)); 459 SkASSERT(0 == offset % sizeof(uint16_t));
476 *startIndex = static_cast<int>(offset / sizeof(uint16_t)); 460 *startIndex = static_cast<int>(offset / sizeof(uint16_t));
477 return ptr; 461 return ptr;
478 } 462 }
479 463
480 bool GrIndexBufferAllocPool::appendIndices(int indexCount,
481 const void* indices,
482 const GrIndexBuffer** buffer,
483 int* startIndex) {
484 void* space = makeSpace(indexCount, buffer, startIndex);
485 if (space) {
486 memcpy(space, indices, sizeof(uint16_t) * indexCount);
487 return true;
488 } else {
489 return false;
490 }
491 }
492
493 int GrIndexBufferAllocPool::preallocatedBufferIndices() const { 464 int GrIndexBufferAllocPool::preallocatedBufferIndices() const {
494 return static_cast<int>(INHERITED::preallocatedBufferSize() / sizeof(uint16_ t)); 465 return static_cast<int>(INHERITED::preallocatedBufferSize() / sizeof(uint16_ t));
495 } 466 }
496 467
497 int GrIndexBufferAllocPool::currentBufferIndices() const { 468 int GrIndexBufferAllocPool::currentBufferIndices() const {
498 return currentBufferItems(sizeof(uint16_t)); 469 return currentBufferItems(sizeof(uint16_t));
499 } 470 }
OLDNEW
« no previous file with comments | « src/gpu/GrBufferAllocPool.h ('k') | src/gpu/GrContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698