| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 "GrDashingEffect.h" | 8 #include "GrDashingEffect.h" |
| 9 | 9 |
| 10 #include "GrBatchFlushState.h" | 10 #include "GrBatchFlushState.h" |
| 11 #include "GrBatchTest.h" | 11 #include "GrBatchTest.h" |
| 12 #include "GrCaps.h" | 12 #include "GrCaps.h" |
| 13 #include "GrGeometryProcessor.h" | 13 #include "GrGeometryProcessor.h" |
| 14 #include "GrContext.h" | 14 #include "GrContext.h" |
| 15 #include "GrCoordTransform.h" | 15 #include "GrCoordTransform.h" |
| 16 #include "GrDefaultGeoProcFactory.h" | 16 #include "GrDefaultGeoProcFactory.h" |
| 17 #include "GrDrawTarget.h" | |
| 18 #include "GrInvariantOutput.h" | 17 #include "GrInvariantOutput.h" |
| 19 #include "GrProcessor.h" | 18 #include "GrProcessor.h" |
| 20 #include "GrStrokeInfo.h" | 19 #include "GrStrokeInfo.h" |
| 21 #include "GrVertexBuffer.h" | 20 #include "GrVertexBuffer.h" |
| 22 #include "SkGr.h" | 21 #include "SkGr.h" |
| 23 #include "batches/GrVertexBatch.h" | 22 #include "batches/GrVertexBatch.h" |
| 24 #include "glsl/GrGLSLFragmentShaderBuilder.h" | 23 #include "glsl/GrGLSLFragmentShaderBuilder.h" |
| 25 #include "glsl/GrGLSLGeometryProcessor.h" | 24 #include "glsl/GrGLSLGeometryProcessor.h" |
| 26 #include "glsl/GrGLSLProgramDataManager.h" | 25 #include "glsl/GrGLSLProgramDataManager.h" |
| 27 #include "glsl/GrGLSLUniformHandler.h" | 26 #include "glsl/GrGLSLUniformHandler.h" |
| (...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 739 | 738 |
| 740 geometry.fColor = color; | 739 geometry.fColor = color; |
| 741 geometry.fViewMatrix = viewMatrix; | 740 geometry.fViewMatrix = viewMatrix; |
| 742 geometry.fPhase = phase; | 741 geometry.fPhase = phase; |
| 743 geometry.fIntervals[0] = intervals[0]; | 742 geometry.fIntervals[0] = intervals[0]; |
| 744 geometry.fIntervals[1] = intervals[1]; | 743 geometry.fIntervals[1] = intervals[1]; |
| 745 | 744 |
| 746 return DashBatch::Create(geometry, cap, aaMode, fullDash); | 745 return DashBatch::Create(geometry, cap, aaMode, fullDash); |
| 747 } | 746 } |
| 748 | 747 |
| 749 bool GrDashingEffect::DrawDashLine(GrDrawTarget* target, | 748 GrDrawBatch* GrDashingEffect::CreateDashLineBatch(GrColor color, |
| 750 const GrPipelineBuilder& pipelineBuilder, GrC
olor color, | 749 const SkMatrix& viewMatrix, |
| 751 const SkMatrix& viewMatrix, const SkPoint pts
[2], | 750 const SkPoint pts[2], |
| 752 bool useAA, const GrStrokeInfo& strokeInfo) { | 751 bool useAA, |
| 753 SkAutoTUnref<GrDrawBatch> batch( | 752 bool msaaIsEnabled, |
| 754 create_batch(color, viewMatrix, pts, useAA, strokeInfo, | 753 const GrStrokeInfo& strokeInfo
) { |
| 755 pipelineBuilder.getRenderTarget()->isUnifiedMultisample
d())); | 754 return create_batch(color, viewMatrix, pts, useAA, strokeInfo, msaaIsEnabled
); |
| 756 if (!batch) { | |
| 757 return false; | |
| 758 } | |
| 759 | |
| 760 target->drawBatch(pipelineBuilder, batch); | |
| 761 return true; | |
| 762 } | 755 } |
| 763 | 756 |
| 764 ////////////////////////////////////////////////////////////////////////////// | 757 ////////////////////////////////////////////////////////////////////////////// |
| 765 | 758 |
| 766 class GLDashingCircleEffect; | 759 class GLDashingCircleEffect; |
| 767 | 760 |
| 768 /* | 761 /* |
| 769 * This effect will draw a dotted line (defined as a dashed lined with round cap
s and no on | 762 * This effect will draw a dotted line (defined as a dashed lined with round cap
s and no on |
| 770 * interval). The radius of the dots is given by the strokeWidth and the spacing
by the DashInfo. | 763 * interval). The radius of the dots is given by the strokeWidth and the spacing
by the DashInfo. |
| 771 * Both of the previous two parameters are in device space. This effect also req
uires the setting of | 764 * Both of the previous two parameters are in device space. This effect also req
uires the setting of |
| (...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1306 info.fIntervals = intervals; | 1299 info.fIntervals = intervals; |
| 1307 info.fCount = 2; | 1300 info.fCount = 2; |
| 1308 info.fPhase = phase; | 1301 info.fPhase = phase; |
| 1309 SkDEBUGCODE(bool success = ) strokeInfo.setDashInfo(info); | 1302 SkDEBUGCODE(bool success = ) strokeInfo.setDashInfo(info); |
| 1310 SkASSERT(success); | 1303 SkASSERT(success); |
| 1311 | 1304 |
| 1312 return create_batch(color, viewMatrix, pts, useAA, strokeInfo, msaaRT); | 1305 return create_batch(color, viewMatrix, pts, useAA, strokeInfo, msaaRT); |
| 1313 } | 1306 } |
| 1314 | 1307 |
| 1315 #endif | 1308 #endif |
| OLD | NEW |