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" |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 SkPoint fPtsRot[2]; | 252 SkPoint fPtsRot[2]; |
253 SkScalar fSrcStrokeWidth; | 253 SkScalar fSrcStrokeWidth; |
254 SkScalar fPhase; | 254 SkScalar fPhase; |
255 SkScalar fIntervals[2]; | 255 SkScalar fIntervals[2]; |
256 SkScalar fParallelScale; | 256 SkScalar fParallelScale; |
257 SkScalar fPerpendicularScale; | 257 SkScalar fPerpendicularScale; |
258 }; | 258 }; |
259 | 259 |
260 static GrDrawBatch* Create(const Geometry& geometry, SkPaint::Cap cap, DashA
AMode aaMode, | 260 static GrDrawBatch* Create(const Geometry& geometry, SkPaint::Cap cap, DashA
AMode aaMode, |
261 bool fullDash) { | 261 bool fullDash) { |
262 return SkNEW_ARGS(DashBatch, (geometry, cap, aaMode, fullDash)); | 262 return new DashBatch(geometry, cap, aaMode, fullDash); |
263 } | 263 } |
264 | 264 |
265 const char* name() const override { return "DashBatch"; } | 265 const char* name() const override { return "DashBatch"; } |
266 | 266 |
267 void getInvariantOutputColor(GrInitInvariantOutput* out) const override { | 267 void getInvariantOutputColor(GrInitInvariantOutput* out) const override { |
268 // When this is called on a batch, there is only one geometry bundle | 268 // When this is called on a batch, there is only one geometry bundle |
269 out->setKnownFourComponents(fGeoData[0].fColor); | 269 out->setKnownFourComponents(fGeoData[0].fColor); |
270 } | 270 } |
271 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override { | 271 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override { |
272 out->setUnknownSingleComponent(); | 272 out->setUnknownSingleComponent(); |
(...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
922 key |= dce.aaMode() << 8; | 922 key |= dce.aaMode() << 8; |
923 b->add32(key); | 923 b->add32(key); |
924 } | 924 } |
925 | 925 |
926 ////////////////////////////////////////////////////////////////////////////// | 926 ////////////////////////////////////////////////////////////////////////////// |
927 | 927 |
928 GrGeometryProcessor* DashingCircleEffect::Create(GrColor color, | 928 GrGeometryProcessor* DashingCircleEffect::Create(GrColor color, |
929 DashAAMode aaMode, | 929 DashAAMode aaMode, |
930 const SkMatrix& localMatrix, | 930 const SkMatrix& localMatrix, |
931 bool usesLocalCoords) { | 931 bool usesLocalCoords) { |
932 return SkNEW_ARGS(DashingCircleEffect, (color, aaMode, localMatrix, usesLoca
lCoords)); | 932 return new DashingCircleEffect(color, aaMode, localMatrix, usesLocalCoords); |
933 } | 933 } |
934 | 934 |
935 void DashingCircleEffect::getGLProcessorKey(const GrBatchTracker& bt, | 935 void DashingCircleEffect::getGLProcessorKey(const GrBatchTracker& bt, |
936 const GrGLSLCaps& caps, | 936 const GrGLSLCaps& caps, |
937 GrProcessorKeyBuilder* b) const { | 937 GrProcessorKeyBuilder* b) const { |
938 GLDashingCircleEffect::GenKey(*this, bt, caps, b); | 938 GLDashingCircleEffect::GenKey(*this, bt, caps, b); |
939 } | 939 } |
940 | 940 |
941 GrGLPrimitiveProcessor* DashingCircleEffect::createGLInstance(const GrBatchTrack
er& bt, | 941 GrGLPrimitiveProcessor* DashingCircleEffect::createGLInstance(const GrBatchTrack
er& bt, |
942 const GrGLSLCaps&)
const { | 942 const GrGLSLCaps&)
const { |
943 return SkNEW_ARGS(GLDashingCircleEffect, (*this, bt)); | 943 return new GLDashingCircleEffect(*this, bt); |
944 } | 944 } |
945 | 945 |
946 DashingCircleEffect::DashingCircleEffect(GrColor color, | 946 DashingCircleEffect::DashingCircleEffect(GrColor color, |
947 DashAAMode aaMode, | 947 DashAAMode aaMode, |
948 const SkMatrix& localMatrix, | 948 const SkMatrix& localMatrix, |
949 bool usesLocalCoords) | 949 bool usesLocalCoords) |
950 : fColor(color) | 950 : fColor(color) |
951 , fLocalMatrix(localMatrix) | 951 , fLocalMatrix(localMatrix) |
952 , fUsesLocalCoords(usesLocalCoords) | 952 , fUsesLocalCoords(usesLocalCoords) |
953 , fAAMode(aaMode) { | 953 , fAAMode(aaMode) { |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1158 key |= de.aaMode() << 8; | 1158 key |= de.aaMode() << 8; |
1159 b->add32(key); | 1159 b->add32(key); |
1160 } | 1160 } |
1161 | 1161 |
1162 ////////////////////////////////////////////////////////////////////////////// | 1162 ////////////////////////////////////////////////////////////////////////////// |
1163 | 1163 |
1164 GrGeometryProcessor* DashingLineEffect::Create(GrColor color, | 1164 GrGeometryProcessor* DashingLineEffect::Create(GrColor color, |
1165 DashAAMode aaMode, | 1165 DashAAMode aaMode, |
1166 const SkMatrix& localMatrix, | 1166 const SkMatrix& localMatrix, |
1167 bool usesLocalCoords) { | 1167 bool usesLocalCoords) { |
1168 return SkNEW_ARGS(DashingLineEffect, (color, aaMode, localMatrix, usesLocalC
oords)); | 1168 return new DashingLineEffect(color, aaMode, localMatrix, usesLocalCoords); |
1169 } | 1169 } |
1170 | 1170 |
1171 void DashingLineEffect::getGLProcessorKey(const GrBatchTracker& bt, | 1171 void DashingLineEffect::getGLProcessorKey(const GrBatchTracker& bt, |
1172 const GrGLSLCaps& caps, | 1172 const GrGLSLCaps& caps, |
1173 GrProcessorKeyBuilder* b) const { | 1173 GrProcessorKeyBuilder* b) const { |
1174 GLDashingLineEffect::GenKey(*this, bt, caps, b); | 1174 GLDashingLineEffect::GenKey(*this, bt, caps, b); |
1175 } | 1175 } |
1176 | 1176 |
1177 GrGLPrimitiveProcessor* DashingLineEffect::createGLInstance(const GrBatchTracker
& bt, | 1177 GrGLPrimitiveProcessor* DashingLineEffect::createGLInstance(const GrBatchTracker
& bt, |
1178 const GrGLSLCaps&) c
onst { | 1178 const GrGLSLCaps&) c
onst { |
1179 return SkNEW_ARGS(GLDashingLineEffect, (*this, bt)); | 1179 return new GLDashingLineEffect(*this, bt); |
1180 } | 1180 } |
1181 | 1181 |
1182 DashingLineEffect::DashingLineEffect(GrColor color, | 1182 DashingLineEffect::DashingLineEffect(GrColor color, |
1183 DashAAMode aaMode, | 1183 DashAAMode aaMode, |
1184 const SkMatrix& localMatrix, | 1184 const SkMatrix& localMatrix, |
1185 bool usesLocalCoords) | 1185 bool usesLocalCoords) |
1186 : fColor(color) | 1186 : fColor(color) |
1187 , fLocalMatrix(localMatrix) | 1187 , fLocalMatrix(localMatrix) |
1188 , fUsesLocalCoords(usesLocalCoords) | 1188 , fUsesLocalCoords(usesLocalCoords) |
1189 , fAAMode(aaMode) { | 1189 , fAAMode(aaMode) { |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1297 info.fIntervals = intervals; | 1297 info.fIntervals = intervals; |
1298 info.fCount = 2; | 1298 info.fCount = 2; |
1299 info.fPhase = phase; | 1299 info.fPhase = phase; |
1300 SkDEBUGCODE(bool success = ) strokeInfo.setDashInfo(info); | 1300 SkDEBUGCODE(bool success = ) strokeInfo.setDashInfo(info); |
1301 SkASSERT(success); | 1301 SkASSERT(success); |
1302 | 1302 |
1303 return create_batch(color, viewMatrix, pts, useAA, strokeInfo, msaaRT); | 1303 return create_batch(color, viewMatrix, pts, useAA, strokeInfo, msaaRT); |
1304 } | 1304 } |
1305 | 1305 |
1306 #endif | 1306 #endif |
OLD | NEW |