| OLD | NEW |
| 1 | |
| 2 /* | 1 /* |
| 3 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
| 4 * | 3 * |
| 5 * 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 |
| 6 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 7 */ | 6 */ |
| 8 | 7 |
| 8 #include "GrInOrderDrawBuffer.h" |
| 9 | 9 |
| 10 #include "GrInOrderDrawBuffer.h" | |
| 11 #include "GrBufferAllocPool.h" | 10 #include "GrBufferAllocPool.h" |
| 12 #include "GrDrawTargetCaps.h" | 11 #include "GrDrawTargetCaps.h" |
| 13 #include "GrGpu.h" | 12 #include "GrGpu.h" |
| 14 #include "GrIndexBuffer.h" | 13 #include "GrIndexBuffer.h" |
| 15 #include "GrPath.h" | 14 #include "GrPath.h" |
| 15 #include "GrPoint.h" |
| 16 #include "GrRenderTarget.h" | 16 #include "GrRenderTarget.h" |
| 17 #include "GrTemplates.h" | 17 #include "GrTemplates.h" |
| 18 #include "GrTexture.h" | 18 #include "GrTexture.h" |
| 19 #include "GrVertexBuffer.h" | 19 #include "GrVertexBuffer.h" |
| 20 | 20 |
| 21 GrInOrderDrawBuffer::GrInOrderDrawBuffer(GrGpu* gpu, | 21 GrInOrderDrawBuffer::GrInOrderDrawBuffer(GrGpu* gpu, |
| 22 GrVertexBufferAllocPool* vertexPool, | 22 GrVertexBufferAllocPool* vertexPool, |
| 23 GrIndexBufferAllocPool* indexPool) | 23 GrIndexBufferAllocPool* indexPool) |
| 24 : GrDrawTarget(gpu->getContext()) | 24 : GrDrawTarget(gpu->getContext()) |
| 25 , fDstGpu(gpu) | 25 , fDstGpu(gpu) |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 } else if (hasUVs) { | 110 } else if (hasUVs) { |
| 111 *localOffset = sizeof(GrPoint); | 111 *localOffset = sizeof(GrPoint); |
| 112 drawState->setVertexAttribs<kRectPosUVAttribs>(2); | 112 drawState->setVertexAttribs<kRectPosUVAttribs>(2); |
| 113 } else { | 113 } else { |
| 114 drawState->setVertexAttribs<kRectPosUVAttribs>(1); | 114 drawState->setVertexAttribs<kRectPosUVAttribs>(1); |
| 115 } | 115 } |
| 116 } | 116 } |
| 117 | 117 |
| 118 }; | 118 }; |
| 119 | 119 |
| 120 void GrInOrderDrawBuffer::onDrawRect(const GrRect& rect, | 120 void GrInOrderDrawBuffer::onDrawRect(const SkRect& rect, |
| 121 const SkMatrix* matrix, | 121 const SkMatrix* matrix, |
| 122 const GrRect* localRect, | 122 const SkRect* localRect, |
| 123 const SkMatrix* localMatrix) { | 123 const SkMatrix* localMatrix) { |
| 124 GrDrawState::AutoColorRestore acr; | 124 GrDrawState::AutoColorRestore acr; |
| 125 | 125 |
| 126 GrDrawState* drawState = this->drawState(); | 126 GrDrawState* drawState = this->drawState(); |
| 127 | 127 |
| 128 GrColor color = drawState->getColor(); | 128 GrColor color = drawState->getColor(); |
| 129 | 129 |
| 130 int colorOffset, localOffset; | 130 int colorOffset, localOffset; |
| 131 set_vertex_attributes(drawState, | 131 set_vertex_attributes(drawState, |
| 132 this->caps()->dualSourceBlendingSupport() || drawState->hasSo
lidCoverage(), | 132 this->caps()->dualSourceBlendingSupport() || drawState->hasSo
lidCoverage(), |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 if (this->needsNewState()) { | 394 if (this->needsNewState()) { |
| 395 this->recordState(); | 395 this->recordState(); |
| 396 } | 396 } |
| 397 StencilPath* sp = this->recordStencilPath(); | 397 StencilPath* sp = this->recordStencilPath(); |
| 398 sp->fPath.reset(path); | 398 sp->fPath.reset(path); |
| 399 path->ref(); | 399 path->ref(); |
| 400 sp->fFill = fill; | 400 sp->fFill = fill; |
| 401 sp->fStroke = stroke; | 401 sp->fStroke = stroke; |
| 402 } | 402 } |
| 403 | 403 |
| 404 void GrInOrderDrawBuffer::clear(const GrIRect* rect, GrColor color, GrRenderTarg
et* renderTarget) { | 404 void GrInOrderDrawBuffer::clear(const SkIRect* rect, GrColor color, GrRenderTarg
et* renderTarget) { |
| 405 GrIRect r; | 405 SkIRect r; |
| 406 if (NULL == renderTarget) { | 406 if (NULL == renderTarget) { |
| 407 renderTarget = this->drawState()->getRenderTarget(); | 407 renderTarget = this->drawState()->getRenderTarget(); |
| 408 GrAssert(NULL != renderTarget); | 408 GrAssert(NULL != renderTarget); |
| 409 } | 409 } |
| 410 if (NULL == rect) { | 410 if (NULL == rect) { |
| 411 // We could do something smart and remove previous draws and clears to | 411 // We could do something smart and remove previous draws and clears to |
| 412 // the current render target. If we get that smart we have to make sure | 412 // the current render target. If we get that smart we have to make sure |
| 413 // those draws aren't read before this clear (render-to-texture). | 413 // those draws aren't read before this clear (render-to-texture). |
| 414 r.setLTRB(0, 0, renderTarget->width(), renderTarget->height()); | 414 r.setLTRB(0, 0, renderTarget->width(), renderTarget->height()); |
| 415 rect = &r; | 415 rect = &r; |
| (...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 818 fCmds.push_back(kCopySurface_Cmd); | 818 fCmds.push_back(kCopySurface_Cmd); |
| 819 return &fCopySurfaces.push_back(); | 819 return &fCopySurfaces.push_back(); |
| 820 } | 820 } |
| 821 | 821 |
| 822 | 822 |
| 823 void GrInOrderDrawBuffer::clipWillBeSet(const GrClipData* newClipData) { | 823 void GrInOrderDrawBuffer::clipWillBeSet(const GrClipData* newClipData) { |
| 824 INHERITED::clipWillBeSet(newClipData); | 824 INHERITED::clipWillBeSet(newClipData); |
| 825 fClipSet = true; | 825 fClipSet = true; |
| 826 fClipProxyState = kUnknown_ClipProxyState; | 826 fClipProxyState = kUnknown_ClipProxyState; |
| 827 } | 827 } |
| OLD | NEW |