OLD | NEW |
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 "GrGpu.h" | 10 #include "GrGpu.h" |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 GrCrash("Can't get vertices into buffer!"); | 323 GrCrash("Can't get vertices into buffer!"); |
324 } | 324 } |
325 } | 325 } |
326 } | 326 } |
327 | 327 |
328 return fUnitSquareVertexBuffer; | 328 return fUnitSquareVertexBuffer; |
329 } | 329 } |
330 | 330 |
331 //////////////////////////////////////////////////////////////////////////////// | 331 //////////////////////////////////////////////////////////////////////////////// |
332 | 332 |
333 bool GrGpu::setupClipAndFlushState(DrawType type) { | 333 bool GrGpu::setupClipAndFlushState(DrawType type, const GrDeviceCoordTexture* ds
tCopy) { |
334 | 334 |
335 if (!fClipMaskManager.setupClipping(this->getClip())) { | 335 if (!fClipMaskManager.setupClipping(this->getClip())) { |
336 return false; | 336 return false; |
337 } | 337 } |
338 | 338 |
339 if (!this->flushGraphicsState(type)) { | 339 if (!this->flushGraphicsState(type, dstCopy)) { |
340 return false; | 340 return false; |
341 } | 341 } |
342 | 342 |
343 return true; | 343 return true; |
344 } | 344 } |
345 | 345 |
346 //////////////////////////////////////////////////////////////////////////////// | 346 //////////////////////////////////////////////////////////////////////////////// |
347 | 347 |
348 void GrGpu::geometrySourceWillPush() { | 348 void GrGpu::geometrySourceWillPush() { |
349 const GeometrySrcState& geoSrc = this->getGeomSrc(); | 349 const GeometrySrcState& geoSrc = this->getGeomSrc(); |
(...skipping 17 matching lines...) Expand all Loading... |
367 } | 367 } |
368 | 368 |
369 void GrGpu::geometrySourceWillPop(const GeometrySrcState& restoredState) { | 369 void GrGpu::geometrySourceWillPop(const GeometrySrcState& restoredState) { |
370 // if popping last entry then pops are unbalanced with pushes | 370 // if popping last entry then pops are unbalanced with pushes |
371 GrAssert(fGeomPoolStateStack.count() > 1); | 371 GrAssert(fGeomPoolStateStack.count() > 1); |
372 fGeomPoolStateStack.pop_back(); | 372 fGeomPoolStateStack.pop_back(); |
373 } | 373 } |
374 | 374 |
375 void GrGpu::onDraw(const DrawInfo& info) { | 375 void GrGpu::onDraw(const DrawInfo& info) { |
376 this->handleDirtyContext(); | 376 this->handleDirtyContext(); |
377 if (!this->setupClipAndFlushState(PrimTypeToDrawType(info.primitiveType())))
{ | 377 if (!this->setupClipAndFlushState(PrimTypeToDrawType(info.primitiveType()), |
| 378 info.getDstCopy())) { |
378 return; | 379 return; |
379 } | 380 } |
380 this->onGpuDraw(info); | 381 this->onGpuDraw(info); |
381 } | 382 } |
382 | 383 |
383 void GrGpu::onStencilPath(const GrPath* path, const SkStrokeRec&, SkPath::FillTy
pe fill) { | 384 void GrGpu::onStencilPath(const GrPath* path, const SkStrokeRec&, SkPath::FillTy
pe fill) { |
384 this->handleDirtyContext(); | 385 this->handleDirtyContext(); |
385 | 386 |
386 // TODO: make this more efficient (don't copy and copy back) | 387 // TODO: make this more efficient (don't copy and copy back) |
387 GrAutoTRestore<GrStencilSettings> asr(this->drawState()->stencil()); | 388 GrAutoTRestore<GrStencilSettings> asr(this->drawState()->stencil()); |
388 | 389 |
389 this->setStencilPathSettings(*path, fill, this->drawState()->stencil()); | 390 this->setStencilPathSettings(*path, fill, this->drawState()->stencil()); |
390 if (!this->setupClipAndFlushState(kStencilPath_DrawType)) { | 391 if (!this->setupClipAndFlushState(kStencilPath_DrawType, NULL)) { |
391 return; | 392 return; |
392 } | 393 } |
393 | 394 |
394 this->onGpuStencilPath(path, fill); | 395 this->onGpuStencilPath(path, fill); |
395 } | 396 } |
396 | 397 |
397 void GrGpu::finalizeReservedVertices() { | 398 void GrGpu::finalizeReservedVertices() { |
398 GrAssert(NULL != fVertexPool); | 399 GrAssert(NULL != fVertexPool); |
399 fVertexPool->unlock(); | 400 fVertexPool->unlock(); |
400 } | 401 } |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
524 } | 525 } |
525 | 526 |
526 void GrGpu::releaseIndexArray() { | 527 void GrGpu::releaseIndexArray() { |
527 // if index source was array, we stowed data in the pool | 528 // if index source was array, we stowed data in the pool |
528 const GeometrySrcState& geoSrc = this->getGeomSrc(); | 529 const GeometrySrcState& geoSrc = this->getGeomSrc(); |
529 GrAssert(kArray_GeometrySrcType == geoSrc.fIndexSrc); | 530 GrAssert(kArray_GeometrySrcType == geoSrc.fIndexSrc); |
530 size_t bytes = geoSrc.fIndexCount * sizeof(uint16_t); | 531 size_t bytes = geoSrc.fIndexCount * sizeof(uint16_t); |
531 fIndexPool->putBack(bytes); | 532 fIndexPool->putBack(bytes); |
532 --fIndexPoolUseCnt; | 533 --fIndexPoolUseCnt; |
533 } | 534 } |
OLD | NEW |