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

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

Issue 1133123009: rename GrDrawTargetCaps to GrCaps (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix gypi filename Created 5 years, 7 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 | « src/gpu/GrBatchTarget.h ('k') | src/gpu/GrCommandBuilder.h » ('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 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 } 280 }
281 fBufferPtr = NULL; 281 fBufferPtr = NULL;
282 } 282 }
283 283
284 SkASSERT(NULL == fBufferPtr); 284 SkASSERT(NULL == fBufferPtr);
285 285
286 // If the buffer is CPU-backed we map it because it is free to do so and sav es a copy. 286 // If the buffer is CPU-backed we map it because it is free to do so and sav es a copy.
287 // Otherwise when buffer mapping is supported we map if the buffer size is g reater than the 287 // Otherwise when buffer mapping is supported we map if the buffer size is g reater than the
288 // threshold. 288 // threshold.
289 bool attemptMap = block.fBuffer->isCPUBacked(); 289 bool attemptMap = block.fBuffer->isCPUBacked();
290 if (!attemptMap && GrDrawTargetCaps::kNone_MapFlags != fGpu->caps()->mapBuff erFlags()) { 290 if (!attemptMap && GrCaps::kNone_MapFlags != fGpu->caps()->mapBufferFlags()) {
291 attemptMap = size > GR_GEOM_BUFFER_MAP_THRESHOLD; 291 attemptMap = size > GR_GEOM_BUFFER_MAP_THRESHOLD;
292 } 292 }
293 293
294 if (attemptMap) { 294 if (attemptMap) {
295 fBufferPtr = block.fBuffer->map(); 295 fBufferPtr = block.fBuffer->map();
296 } 296 }
297 297
298 if (NULL == fBufferPtr) { 298 if (NULL == fBufferPtr) {
299 fBufferPtr = fCpuData.reset(size); 299 fBufferPtr = fCpuData.reset(size);
300 } 300 }
(...skipping 23 matching lines...) Expand all
324 } 324 }
325 325
326 void GrBufferAllocPool::flushCpuData(const BufferBlock& block, size_t flushSize) { 326 void GrBufferAllocPool::flushCpuData(const BufferBlock& block, size_t flushSize) {
327 GrGeometryBuffer* buffer = block.fBuffer; 327 GrGeometryBuffer* buffer = block.fBuffer;
328 SkASSERT(buffer); 328 SkASSERT(buffer);
329 SkASSERT(!buffer->isMapped()); 329 SkASSERT(!buffer->isMapped());
330 SkASSERT(fCpuData.get() == fBufferPtr); 330 SkASSERT(fCpuData.get() == fBufferPtr);
331 SkASSERT(flushSize <= buffer->gpuMemorySize()); 331 SkASSERT(flushSize <= buffer->gpuMemorySize());
332 VALIDATE(true); 332 VALIDATE(true);
333 333
334 if (GrDrawTargetCaps::kNone_MapFlags != fGpu->caps()->mapBufferFlags() && 334 if (GrCaps::kNone_MapFlags != fGpu->caps()->mapBufferFlags() &&
335 flushSize > GR_GEOM_BUFFER_MAP_THRESHOLD) { 335 flushSize > GR_GEOM_BUFFER_MAP_THRESHOLD) {
336 void* data = buffer->map(); 336 void* data = buffer->map();
337 if (data) { 337 if (data) {
338 memcpy(data, fBufferPtr, flushSize); 338 memcpy(data, fBufferPtr, flushSize);
339 UNMAP_BUFFER(block); 339 UNMAP_BUFFER(block);
340 return; 340 return;
341 } 341 }
342 } 342 }
343 buffer->updateData(fBufferPtr, flushSize); 343 buffer->updateData(fBufferPtr, flushSize);
344 VALIDATE(true); 344 VALIDATE(true);
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 &geomBuffer, 412 &geomBuffer,
413 &offset); 413 &offset);
414 414
415 *buffer = (const GrIndexBuffer*) geomBuffer; 415 *buffer = (const GrIndexBuffer*) geomBuffer;
416 SkASSERT(0 == offset % sizeof(uint16_t)); 416 SkASSERT(0 == offset % sizeof(uint16_t));
417 *startIndex = static_cast<int>(offset / sizeof(uint16_t)); 417 *startIndex = static_cast<int>(offset / sizeof(uint16_t));
418 return ptr; 418 return ptr;
419 } 419 }
420 420
421 421
OLDNEW
« no previous file with comments | « src/gpu/GrBatchTarget.h ('k') | src/gpu/GrCommandBuilder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698