OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "GrInOrderDrawBuffer.h" | 8 #include "GrInOrderDrawBuffer.h" |
9 | 9 |
10 #include "GrBufferAllocPool.h" | 10 #include "GrBufferAllocPool.h" |
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 } | 412 } |
413 } | 413 } |
414 | 414 |
415 GrInOrderDrawBuffer::StencilPath::StencilPath() {} | 415 GrInOrderDrawBuffer::StencilPath::StencilPath() {} |
416 GrInOrderDrawBuffer::DrawPath::DrawPath() {} | 416 GrInOrderDrawBuffer::DrawPath::DrawPath() {} |
417 GrInOrderDrawBuffer::DrawPaths::DrawPaths() {} | 417 GrInOrderDrawBuffer::DrawPaths::DrawPaths() {} |
418 GrInOrderDrawBuffer::DrawPaths::~DrawPaths() { | 418 GrInOrderDrawBuffer::DrawPaths::~DrawPaths() { |
419 if (fTransforms) { | 419 if (fTransforms) { |
420 SkDELETE_ARRAY(fTransforms); | 420 SkDELETE_ARRAY(fTransforms); |
421 } | 421 } |
422 for (size_t i = 0; i < fPathCount; ++i) { | 422 for (int i = 0; i < fPathCount; ++i) { |
423 fPaths[i]->unref(); | 423 fPaths[i]->unref(); |
424 } | 424 } |
425 SkDELETE_ARRAY(fPaths); | 425 SkDELETE_ARRAY(fPaths); |
426 } | 426 } |
427 | 427 |
428 void GrInOrderDrawBuffer::onStencilPath(const GrPath* path, SkPath::FillType fil
l) { | 428 void GrInOrderDrawBuffer::onStencilPath(const GrPath* path, SkPath::FillType fil
l) { |
429 if (this->needsNewClip()) { | 429 if (this->needsNewClip()) { |
430 this->recordClip(); | 430 this->recordClip(); |
431 } | 431 } |
432 // Only compare the subset of GrDrawState relevant to path stenciling? | 432 // Only compare the subset of GrDrawState relevant to path stenciling? |
(...skipping 17 matching lines...) Expand all Loading... |
450 } | 450 } |
451 DrawPath* cp = this->recordDrawPath(); | 451 DrawPath* cp = this->recordDrawPath(); |
452 cp->fPath.reset(path); | 452 cp->fPath.reset(path); |
453 path->ref(); | 453 path->ref(); |
454 cp->fFill = fill; | 454 cp->fFill = fill; |
455 if (NULL != dstCopy) { | 455 if (NULL != dstCopy) { |
456 cp->fDstCopy = *dstCopy; | 456 cp->fDstCopy = *dstCopy; |
457 } | 457 } |
458 } | 458 } |
459 | 459 |
460 void GrInOrderDrawBuffer::onDrawPaths(size_t pathCount, const GrPath** paths, | 460 void GrInOrderDrawBuffer::onDrawPaths(int pathCount, const GrPath** paths, |
461 const SkMatrix* transforms, | 461 const SkMatrix* transforms, |
462 SkPath::FillType fill, | 462 SkPath::FillType fill, |
463 SkStrokeRec::Style stroke, | 463 SkStrokeRec::Style stroke, |
464 const GrDeviceCoordTexture* dstCopy) { | 464 const GrDeviceCoordTexture* dstCopy) { |
465 SkASSERT(pathCount); | 465 SkASSERT(pathCount); |
466 | 466 |
467 if (this->needsNewClip()) { | 467 if (this->needsNewClip()) { |
468 this->recordClip(); | 468 this->recordClip(); |
469 } | 469 } |
470 if (this->needsNewState()) { | 470 if (this->needsNewState()) { |
471 this->recordState(); | 471 this->recordState(); |
472 } | 472 } |
473 DrawPaths* dp = this->recordDrawPaths(); | 473 DrawPaths* dp = this->recordDrawPaths(); |
474 dp->fPathCount = pathCount; | 474 dp->fPathCount = pathCount; |
475 dp->fPaths = SkNEW_ARRAY(const GrPath*, pathCount); | 475 dp->fPaths = SkNEW_ARRAY(const GrPath*, pathCount); |
476 memcpy(dp->fPaths, paths, sizeof(GrPath*) * pathCount); | 476 memcpy(dp->fPaths, paths, sizeof(GrPath*) * pathCount); |
477 for (size_t i = 0; i < pathCount; ++i) { | 477 for (int i = 0; i < pathCount; ++i) { |
478 dp->fPaths[i]->ref(); | 478 dp->fPaths[i]->ref(); |
479 } | 479 } |
480 | 480 |
481 dp->fTransforms = SkNEW_ARRAY(SkMatrix, pathCount); | 481 dp->fTransforms = SkNEW_ARRAY(SkMatrix, pathCount); |
482 memcpy(dp->fTransforms, transforms, sizeof(SkMatrix) * pathCount); | 482 memcpy(dp->fTransforms, transforms, sizeof(SkMatrix) * pathCount); |
483 | 483 |
484 dp->fFill = fill; | 484 dp->fFill = fill; |
485 dp->fStroke = stroke; | 485 dp->fStroke = stroke; |
486 | 486 |
487 if (NULL != dstCopy) { | 487 if (NULL != dstCopy) { |
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
963 this->addToCmdBuffer(kCopySurface_Cmd); | 963 this->addToCmdBuffer(kCopySurface_Cmd); |
964 return &fCopySurfaces.push_back(); | 964 return &fCopySurfaces.push_back(); |
965 } | 965 } |
966 | 966 |
967 | 967 |
968 void GrInOrderDrawBuffer::clipWillBeSet(const GrClipData* newClipData) { | 968 void GrInOrderDrawBuffer::clipWillBeSet(const GrClipData* newClipData) { |
969 INHERITED::clipWillBeSet(newClipData); | 969 INHERITED::clipWillBeSet(newClipData); |
970 fClipSet = true; | 970 fClipSet = true; |
971 fClipProxyState = kUnknown_ClipProxyState; | 971 fClipProxyState = kUnknown_ClipProxyState; |
972 } | 972 } |
OLD | NEW |