OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 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 #include "GrContext.h" | 9 #include "GrContext.h" |
10 | 10 |
(...skipping 1093 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1104 GrPrimitiveType primitiveType, | 1104 GrPrimitiveType primitiveType, |
1105 int vertexCount, | 1105 int vertexCount, |
1106 const SkPoint positions[], | 1106 const SkPoint positions[], |
1107 const SkPoint texCoords[], | 1107 const SkPoint texCoords[], |
1108 const GrColor colors[], | 1108 const GrColor colors[], |
1109 const uint16_t indices[], | 1109 const uint16_t indices[], |
1110 int indexCount) { | 1110 int indexCount) { |
1111 RETURN_IF_ABANDONED | 1111 RETURN_IF_ABANDONED |
1112 AutoCheckFlush acf(this); | 1112 AutoCheckFlush acf(this); |
1113 GrPipelineBuilder pipelineBuilder; | 1113 GrPipelineBuilder pipelineBuilder; |
1114 GrDrawTarget::AutoReleaseGeometry geo; // must be inside AutoCheckFlush scop
e | |
1115 | 1114 |
1116 GrDrawTarget* target = this->prepareToDraw(&pipelineBuilder, rt, clip, &pain
t, &acf); | 1115 GrDrawTarget* target = this->prepareToDraw(&pipelineBuilder, rt, clip, &pain
t, &acf); |
1117 if (NULL == target) { | 1116 if (NULL == target) { |
1118 return; | 1117 return; |
1119 } | 1118 } |
1120 | 1119 |
1121 GR_CREATE_TRACE_MARKER("GrContext::drawVertices", target); | 1120 GR_CREATE_TRACE_MARKER("GrContext::drawVertices", target); |
1122 | 1121 |
1123 DrawVerticesBatch::Geometry geometry; | 1122 DrawVerticesBatch::Geometry geometry; |
1124 geometry.fColor = paint.getColor(); | 1123 geometry.fColor = paint.getColor(); |
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1589 | 1588 |
1590 // This function can be called in the midst of drawing another object (e.g.,
when uploading a | 1589 // This function can be called in the midst of drawing another object (e.g.,
when uploading a |
1591 // SW-rasterized clip while issuing a draw). So we push the current geometry
state before | 1590 // SW-rasterized clip while issuing a draw). So we push the current geometry
state before |
1592 // drawing a rect to the render target. | 1591 // drawing a rect to the render target. |
1593 // The bracket ensures we pop the stack if we wind up flushing below. | 1592 // The bracket ensures we pop the stack if we wind up flushing below. |
1594 { | 1593 { |
1595 GrDrawTarget* drawTarget = this->prepareToDraw(); | 1594 GrDrawTarget* drawTarget = this->prepareToDraw(); |
1596 if (!drawTarget) { | 1595 if (!drawTarget) { |
1597 return false; | 1596 return false; |
1598 } | 1597 } |
1599 GrDrawTarget::AutoGeometryPush agp(drawTarget); | |
1600 | 1598 |
1601 GrPipelineBuilder pipelineBuilder; | 1599 GrPipelineBuilder pipelineBuilder; |
1602 pipelineBuilder.addColorProcessor(fp); | 1600 pipelineBuilder.addColorProcessor(fp); |
1603 pipelineBuilder.setRenderTarget(renderTarget); | 1601 pipelineBuilder.setRenderTarget(renderTarget); |
1604 drawTarget->drawSimpleRect(&pipelineBuilder, | 1602 drawTarget->drawSimpleRect(&pipelineBuilder, |
1605 GrColor_WHITE, | 1603 GrColor_WHITE, |
1606 matrix, | 1604 matrix, |
1607 SkRect::MakeWH(SkIntToScalar(width), SkIntToS
calar(height))); | 1605 SkRect::MakeWH(SkIntToScalar(width), SkIntToS
calar(height))); |
1608 } | 1606 } |
1609 | 1607 |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1712 fp.reset(GrConfigConversionEffect::Create( | 1710 fp.reset(GrConfigConversionEffect::Create( |
1713 src, swapRAndB, GrConfigConversionEffect::kNone_PMCo
nversion, | 1711 src, swapRAndB, GrConfigConversionEffect::kNone_PMCo
nversion, |
1714 textureMatrix)); | 1712 textureMatrix)); |
1715 } | 1713 } |
1716 swapRAndB = false; // we will handle the swap in the draw. | 1714 swapRAndB = false; // we will handle the swap in the draw. |
1717 | 1715 |
1718 // We protect the existing geometry here since it may not be | 1716 // We protect the existing geometry here since it may not be |
1719 // clear to the caller that a draw operation (i.e., drawSimpleRe
ct) | 1717 // clear to the caller that a draw operation (i.e., drawSimpleRe
ct) |
1720 // can be invoked in this method | 1718 // can be invoked in this method |
1721 { | 1719 { |
1722 GrDrawTarget::AutoGeometryPush agp(fDrawBuffer); | |
1723 GrPipelineBuilder pipelineBuilder; | 1720 GrPipelineBuilder pipelineBuilder; |
1724 SkASSERT(fp); | 1721 SkASSERT(fp); |
1725 pipelineBuilder.addColorProcessor(fp); | 1722 pipelineBuilder.addColorProcessor(fp); |
1726 | 1723 |
1727 pipelineBuilder.setRenderTarget(tempTexture->asRenderTarget(
)); | 1724 pipelineBuilder.setRenderTarget(tempTexture->asRenderTarget(
)); |
1728 SkRect rect = SkRect::MakeWH(SkIntToScalar(width), SkIntToSc
alar(height)); | 1725 SkRect rect = SkRect::MakeWH(SkIntToScalar(width), SkIntToSc
alar(height)); |
1729 fDrawBuffer->drawSimpleRect(&pipelineBuilder, | 1726 fDrawBuffer->drawSimpleRect(&pipelineBuilder, |
1730 GrColor_WHITE, | 1727 GrColor_WHITE, |
1731 SkMatrix::I(), | 1728 SkMatrix::I(), |
1732 rect); | 1729 rect); |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2011 } | 2008 } |
2012 } | 2009 } |
2013 | 2010 |
2014 void GrContext::removeGpuTraceMarker(const GrGpuTraceMarker* marker) { | 2011 void GrContext::removeGpuTraceMarker(const GrGpuTraceMarker* marker) { |
2015 fGpu->removeGpuTraceMarker(marker); | 2012 fGpu->removeGpuTraceMarker(marker); |
2016 if (fDrawBuffer) { | 2013 if (fDrawBuffer) { |
2017 fDrawBuffer->removeGpuTraceMarker(marker); | 2014 fDrawBuffer->removeGpuTraceMarker(marker); |
2018 } | 2015 } |
2019 } | 2016 } |
2020 | 2017 |
OLD | NEW |