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 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 matrix.mapPoints(&verts[idx], 4); | 225 matrix.mapPoints(&verts[idx], 4); |
226 } | 226 } |
227 | 227 |
228 | 228 |
229 /** | 229 /** |
230 * An GrGeometryProcessor that renders a dashed line. | 230 * An GrGeometryProcessor that renders a dashed line. |
231 * This GrGeometryProcessor is meant for dashed lines that only have a single on
/off interval pair. | 231 * This GrGeometryProcessor is meant for dashed lines that only have a single on
/off interval pair. |
232 * Bounding geometry is rendered and the effect computes coverage based on the f
ragment's | 232 * Bounding geometry is rendered and the effect computes coverage based on the f
ragment's |
233 * position relative to the dashed line. | 233 * position relative to the dashed line. |
234 */ | 234 */ |
235 static GrGeometryProcessor* create_dash_gp(GrColor, | 235 static sk_sp<GrGeometryProcessor> make_dash_gp(GrColor, |
236 AAMode aaMode, | 236 AAMode aaMode, |
237 DashCap cap, | 237 DashCap cap, |
238 const SkMatrix& localMatrix, | 238 const SkMatrix& localMatrix, |
239 bool usesLocalCoords); | 239 bool usesLocalCoords); |
240 | 240 |
241 class DashBatch : public GrVertexBatch { | 241 class DashBatch : public GrVertexBatch { |
242 public: | 242 public: |
243 DEFINE_BATCH_CLASS_ID | 243 DEFINE_BATCH_CLASS_ID |
244 struct Geometry { | 244 struct Geometry { |
245 SkMatrix fViewMatrix; | 245 SkMatrix fViewMatrix; |
246 SkMatrix fSrcRotInv; | 246 SkMatrix fSrcRotInv; |
247 SkPoint fPtsRot[2]; | 247 SkPoint fPtsRot[2]; |
248 SkScalar fSrcStrokeWidth; | 248 SkScalar fSrcStrokeWidth; |
249 SkScalar fPhase; | 249 SkScalar fPhase; |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 bool fHasStartRect; | 324 bool fHasStartRect; |
325 bool fHasEndRect; | 325 bool fHasEndRect; |
326 }; | 326 }; |
327 | 327 |
328 void onPrepareDraws(Target* target) const override { | 328 void onPrepareDraws(Target* target) const override { |
329 int instanceCount = fGeoData.count(); | 329 int instanceCount = fGeoData.count(); |
330 SkPaint::Cap cap = this->cap(); | 330 SkPaint::Cap cap = this->cap(); |
331 bool isRoundCap = SkPaint::kRound_Cap == cap; | 331 bool isRoundCap = SkPaint::kRound_Cap == cap; |
332 DashCap capType = isRoundCap ? kRound_DashCap : kNonRound_DashCap; | 332 DashCap capType = isRoundCap ? kRound_DashCap : kNonRound_DashCap; |
333 | 333 |
334 SkAutoTUnref<const GrGeometryProcessor> gp; | 334 sk_sp<GrGeometryProcessor> gp; |
335 if (this->fullDash()) { | 335 if (this->fullDash()) { |
336 gp.reset(create_dash_gp(this->color(), this->aaMode(), capType, this
->viewMatrix(), | 336 gp = make_dash_gp(this->color(), this->aaMode(), capType, this->view
Matrix(), |
337 this->usesLocalCoords())); | 337 this->usesLocalCoords()); |
338 } else { | 338 } else { |
339 // Set up the vertex data for the line and start/end dashes | 339 // Set up the vertex data for the line and start/end dashes |
340 using namespace GrDefaultGeoProcFactory; | 340 using namespace GrDefaultGeoProcFactory; |
341 Color color(this->color()); | 341 Color color(this->color()); |
342 Coverage coverage(this->coverageIgnored() ? Coverage::kNone_Type : | 342 Coverage coverage(this->coverageIgnored() ? Coverage::kNone_Type : |
343 Coverage::kSolid_Type); | 343 Coverage::kSolid_Type); |
344 LocalCoords localCoords(this->usesLocalCoords() ? LocalCoords::kUseP
osition_Type : | 344 LocalCoords localCoords(this->usesLocalCoords() ? LocalCoords::kUseP
osition_Type : |
345 LocalCoords::kUnus
ed_Type); | 345 LocalCoords::kUnus
ed_Type); |
346 gp.reset(CreateForDeviceSpace(color, coverage, localCoords, this->vi
ewMatrix())); | 346 gp = MakeForDeviceSpace(color, coverage, localCoords, this->viewMatr
ix()); |
347 } | 347 } |
348 | 348 |
349 if (!gp) { | 349 if (!gp) { |
350 SkDebugf("Could not create GrGeometryProcessor\n"); | 350 SkDebugf("Could not create GrGeometryProcessor\n"); |
351 return; | 351 return; |
352 } | 352 } |
353 | 353 |
354 // useAA here means Edge AA or MSAA | 354 // useAA here means Edge AA or MSAA |
355 bool useAA = this->aaMode() != AAMode::kNone; | 355 bool useAA = this->aaMode() != AAMode::kNone; |
356 bool fullDash = this->fullDash(); | 356 bool fullDash = this->fullDash(); |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
615 } else { | 615 } else { |
616 SkPoint* verts = reinterpret_cast<SkPoint*>(vertices); | 616 SkPoint* verts = reinterpret_cast<SkPoint*>(vertices); |
617 SkASSERT(gp->getVertexStride() == sizeof(SkPoint)); | 617 SkASSERT(gp->getVertexStride() == sizeof(SkPoint)); |
618 setup_dashed_rect_pos(rects[rectIndex], curVIdx, geom.fSrcRo
tInv, verts); | 618 setup_dashed_rect_pos(rects[rectIndex], curVIdx, geom.fSrcRo
tInv, verts); |
619 } | 619 } |
620 curVIdx += 4; | 620 curVIdx += 4; |
621 } | 621 } |
622 rectIndex++; | 622 rectIndex++; |
623 } | 623 } |
624 SkASSERT(0 == (curVIdx % 4) && (curVIdx / 4) == totalRectCount); | 624 SkASSERT(0 == (curVIdx % 4) && (curVIdx / 4) == totalRectCount); |
625 helper.recordDraw(target, gp); | 625 helper.recordDraw(target, gp.get()); |
626 } | 626 } |
627 | 627 |
628 bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override { | 628 bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override { |
629 DashBatch* that = t->cast<DashBatch>(); | 629 DashBatch* that = t->cast<DashBatch>(); |
630 if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *that->pi
peline(), | 630 if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *that->pi
peline(), |
631 that->bounds(), caps)) { | 631 that->bounds(), caps)) { |
632 return false; | 632 return false; |
633 } | 633 } |
634 | 634 |
635 if (this->aaMode() != that->aaMode()) { | 635 if (this->aaMode() != that->aaMode()) { |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
750 * Both of the previous two parameters are in device space. This effect also req
uires the setting of | 750 * Both of the previous two parameters are in device space. This effect also req
uires the setting of |
751 * a vec2 vertex attribute for the the four corners of the bounding rect. This a
ttribute is the | 751 * a vec2 vertex attribute for the the four corners of the bounding rect. This a
ttribute is the |
752 * "dash position" of each vertex. In other words it is the vertex coords (in de
vice space) if we | 752 * "dash position" of each vertex. In other words it is the vertex coords (in de
vice space) if we |
753 * transform the line to be horizontal, with the start of line at the origin the
n shifted to the | 753 * transform the line to be horizontal, with the start of line at the origin the
n shifted to the |
754 * right by half the off interval. The line then goes in the positive x directio
n. | 754 * right by half the off interval. The line then goes in the positive x directio
n. |
755 */ | 755 */ |
756 class DashingCircleEffect : public GrGeometryProcessor { | 756 class DashingCircleEffect : public GrGeometryProcessor { |
757 public: | 757 public: |
758 typedef SkPathEffect::DashInfo DashInfo; | 758 typedef SkPathEffect::DashInfo DashInfo; |
759 | 759 |
760 static GrGeometryProcessor* Create(GrColor, | 760 static sk_sp<GrGeometryProcessor> Make(GrColor, |
761 AAMode aaMode, | 761 AAMode aaMode, |
762 const SkMatrix& localMatrix, | 762 const SkMatrix& localMatrix, |
763 bool usesLocalCoords); | 763 bool usesLocalCoords); |
764 | 764 |
765 const char* name() const override { return "DashingCircleEffect"; } | 765 const char* name() const override { return "DashingCircleEffect"; } |
766 | 766 |
767 const Attribute* inPosition() const { return fInPosition; } | 767 const Attribute* inPosition() const { return fInPosition; } |
768 | 768 |
769 const Attribute* inDashParams() const { return fInDashParams; } | 769 const Attribute* inDashParams() const { return fInDashParams; } |
770 | 770 |
771 const Attribute* inCircleParams() const { return fInCircleParams; } | 771 const Attribute* inCircleParams() const { return fInCircleParams; } |
772 | 772 |
773 AAMode aaMode() const { return fAAMode; } | 773 AAMode aaMode() const { return fAAMode; } |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
912 const DashingCircleEffect& dce = gp.cast<DashingCircleEffect>(); | 912 const DashingCircleEffect& dce = gp.cast<DashingCircleEffect>(); |
913 uint32_t key = 0; | 913 uint32_t key = 0; |
914 key |= dce.usesLocalCoords() && dce.localMatrix().hasPerspective() ? 0x1 : 0
x0; | 914 key |= dce.usesLocalCoords() && dce.localMatrix().hasPerspective() ? 0x1 : 0
x0; |
915 key |= dce.colorIgnored() ? 0x2 : 0x0; | 915 key |= dce.colorIgnored() ? 0x2 : 0x0; |
916 key |= static_cast<uint32_t>(dce.aaMode()) << 8; | 916 key |= static_cast<uint32_t>(dce.aaMode()) << 8; |
917 b->add32(key); | 917 b->add32(key); |
918 } | 918 } |
919 | 919 |
920 ////////////////////////////////////////////////////////////////////////////// | 920 ////////////////////////////////////////////////////////////////////////////// |
921 | 921 |
922 GrGeometryProcessor* DashingCircleEffect::Create(GrColor color, | 922 sk_sp<GrGeometryProcessor> DashingCircleEffect::Make(GrColor color, |
923 AAMode aaMode, | 923 AAMode aaMode, |
924 const SkMatrix& localMatrix, | 924 const SkMatrix& localMatrix
, |
925 bool usesLocalCoords) { | 925 bool usesLocalCoords) { |
926 return new DashingCircleEffect(color, aaMode, localMatrix, usesLocalCoords); | 926 return sk_sp<GrGeometryProcessor>( |
| 927 new DashingCircleEffect(color, aaMode, localMatrix, usesLocalCoords)); |
927 } | 928 } |
928 | 929 |
929 void DashingCircleEffect::getGLSLProcessorKey(const GrGLSLCaps& caps, | 930 void DashingCircleEffect::getGLSLProcessorKey(const GrGLSLCaps& caps, |
930 GrProcessorKeyBuilder* b) const { | 931 GrProcessorKeyBuilder* b) const { |
931 GLDashingCircleEffect::GenKey(*this, caps, b); | 932 GLDashingCircleEffect::GenKey(*this, caps, b); |
932 } | 933 } |
933 | 934 |
934 GrGLSLPrimitiveProcessor* DashingCircleEffect::createGLSLInstance(const GrGLSLCa
ps&) const { | 935 GrGLSLPrimitiveProcessor* DashingCircleEffect::createGLSLInstance(const GrGLSLCa
ps&) const { |
935 return new GLDashingCircleEffect(); | 936 return new GLDashingCircleEffect(); |
936 } | 937 } |
937 | 938 |
938 DashingCircleEffect::DashingCircleEffect(GrColor color, | 939 DashingCircleEffect::DashingCircleEffect(GrColor color, |
939 AAMode aaMode, | 940 AAMode aaMode, |
940 const SkMatrix& localMatrix, | 941 const SkMatrix& localMatrix, |
941 bool usesLocalCoords) | 942 bool usesLocalCoords) |
942 : fColor(color) | 943 : fColor(color) |
943 , fLocalMatrix(localMatrix) | 944 , fLocalMatrix(localMatrix) |
944 , fUsesLocalCoords(usesLocalCoords) | 945 , fUsesLocalCoords(usesLocalCoords) |
945 , fAAMode(aaMode) { | 946 , fAAMode(aaMode) { |
946 this->initClassID<DashingCircleEffect>(); | 947 this->initClassID<DashingCircleEffect>(); |
947 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertex
AttribType)); | 948 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertex
AttribType)); |
948 fInDashParams = &this->addVertexAttrib(Attribute("inDashParams", kVec3f_GrVe
rtexAttribType)); | 949 fInDashParams = &this->addVertexAttrib(Attribute("inDashParams", kVec3f_GrVe
rtexAttribType)); |
949 fInCircleParams = &this->addVertexAttrib(Attribute("inCircleParams", | 950 fInCircleParams = &this->addVertexAttrib(Attribute("inCircleParams", |
950 kVec2f_GrVertexAttribType
)); | 951 kVec2f_GrVertexAttribType
)); |
951 } | 952 } |
952 | 953 |
953 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(DashingCircleEffect); | 954 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(DashingCircleEffect); |
954 | 955 |
955 const GrGeometryProcessor* DashingCircleEffect::TestCreate(GrProcessorTestData*
d) { | 956 sk_sp<GrGeometryProcessor> DashingCircleEffect::TestCreate(GrProcessorTestData*
d) { |
956 AAMode aaMode = static_cast<AAMode>(d->fRandom->nextULessThan(GrDashingEffec
t::kAAModeCnt)); | 957 AAMode aaMode = static_cast<AAMode>(d->fRandom->nextULessThan(GrDashingEffec
t::kAAModeCnt)); |
957 return DashingCircleEffect::Create(GrRandomColor(d->fRandom), | 958 return DashingCircleEffect::Make(GrRandomColor(d->fRandom), |
958 aaMode, GrTest::TestMatrix(d->fRandom), | 959 aaMode, GrTest::TestMatrix(d->fRandom), |
959 d->fRandom->nextBool()); | 960 d->fRandom->nextBool()); |
960 } | 961 } |
961 | 962 |
962 ////////////////////////////////////////////////////////////////////////////// | 963 ////////////////////////////////////////////////////////////////////////////// |
963 | 964 |
964 class GLDashingLineEffect; | 965 class GLDashingLineEffect; |
965 | 966 |
966 /* | 967 /* |
967 * This effect will draw a dashed line. The width of the dash is given by the st
rokeWidth and the | 968 * This effect will draw a dashed line. The width of the dash is given by the st
rokeWidth and the |
968 * length and spacing by the DashInfo. Both of the previous two parameters are i
n device space. | 969 * length and spacing by the DashInfo. Both of the previous two parameters are i
n device space. |
969 * This effect also requires the setting of a vec2 vertex attribute for the the
four corners of the | 970 * This effect also requires the setting of a vec2 vertex attribute for the the
four corners of the |
970 * bounding rect. This attribute is the "dash position" of each vertex. In other
words it is the | 971 * bounding rect. This attribute is the "dash position" of each vertex. In other
words it is the |
971 * vertex coords (in device space) if we transform the line to be horizontal, wi
th the start of | 972 * vertex coords (in device space) if we transform the line to be horizontal, wi
th the start of |
972 * line at the origin then shifted to the right by half the off interval. The li
ne then goes in the | 973 * line at the origin then shifted to the right by half the off interval. The li
ne then goes in the |
973 * positive x direction. | 974 * positive x direction. |
974 */ | 975 */ |
975 class DashingLineEffect : public GrGeometryProcessor { | 976 class DashingLineEffect : public GrGeometryProcessor { |
976 public: | 977 public: |
977 typedef SkPathEffect::DashInfo DashInfo; | 978 typedef SkPathEffect::DashInfo DashInfo; |
978 | 979 |
979 static GrGeometryProcessor* Create(GrColor, | 980 static sk_sp<GrGeometryProcessor> Make(GrColor, |
980 AAMode aaMode, | 981 AAMode aaMode, |
981 const SkMatrix& localMatrix, | 982 const SkMatrix& localMatrix, |
982 bool usesLocalCoords); | 983 bool usesLocalCoords); |
983 | 984 |
984 const char* name() const override { return "DashingEffect"; } | 985 const char* name() const override { return "DashingEffect"; } |
985 | 986 |
986 const Attribute* inPosition() const { return fInPosition; } | 987 const Attribute* inPosition() const { return fInPosition; } |
987 | 988 |
988 const Attribute* inDashParams() const { return fInDashParams; } | 989 const Attribute* inDashParams() const { return fInDashParams; } |
989 | 990 |
990 const Attribute* inRectParams() const { return fInRectParams; } | 991 const Attribute* inRectParams() const { return fInRectParams; } |
991 | 992 |
992 AAMode aaMode() const { return fAAMode; } | 993 AAMode aaMode() const { return fAAMode; } |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1144 const DashingLineEffect& de = gp.cast<DashingLineEffect>(); | 1145 const DashingLineEffect& de = gp.cast<DashingLineEffect>(); |
1145 uint32_t key = 0; | 1146 uint32_t key = 0; |
1146 key |= de.usesLocalCoords() && de.localMatrix().hasPerspective() ? 0x1 : 0x0
; | 1147 key |= de.usesLocalCoords() && de.localMatrix().hasPerspective() ? 0x1 : 0x0
; |
1147 key |= de.colorIgnored() ? 0x2 : 0x0; | 1148 key |= de.colorIgnored() ? 0x2 : 0x0; |
1148 key |= static_cast<int>(de.aaMode()) << 8; | 1149 key |= static_cast<int>(de.aaMode()) << 8; |
1149 b->add32(key); | 1150 b->add32(key); |
1150 } | 1151 } |
1151 | 1152 |
1152 ////////////////////////////////////////////////////////////////////////////// | 1153 ////////////////////////////////////////////////////////////////////////////// |
1153 | 1154 |
1154 GrGeometryProcessor* DashingLineEffect::Create(GrColor color, | 1155 sk_sp<GrGeometryProcessor> DashingLineEffect::Make(GrColor color, |
1155 AAMode aaMode, | 1156 AAMode aaMode, |
1156 const SkMatrix& localMatrix, | 1157 const SkMatrix& localMatrix, |
1157 bool usesLocalCoords) { | 1158 bool usesLocalCoords) { |
1158 return new DashingLineEffect(color, aaMode, localMatrix, usesLocalCoords); | 1159 return sk_sp<GrGeometryProcessor>( |
| 1160 new DashingLineEffect(color, aaMode, localMatrix, usesLocalCoords)); |
1159 } | 1161 } |
1160 | 1162 |
1161 void DashingLineEffect::getGLSLProcessorKey(const GrGLSLCaps& caps, | 1163 void DashingLineEffect::getGLSLProcessorKey(const GrGLSLCaps& caps, |
1162 GrProcessorKeyBuilder* b) const { | 1164 GrProcessorKeyBuilder* b) const { |
1163 GLDashingLineEffect::GenKey(*this, caps, b); | 1165 GLDashingLineEffect::GenKey(*this, caps, b); |
1164 } | 1166 } |
1165 | 1167 |
1166 GrGLSLPrimitiveProcessor* DashingLineEffect::createGLSLInstance(const GrGLSLCaps
&) const { | 1168 GrGLSLPrimitiveProcessor* DashingLineEffect::createGLSLInstance(const GrGLSLCaps
&) const { |
1167 return new GLDashingLineEffect(); | 1169 return new GLDashingLineEffect(); |
1168 } | 1170 } |
1169 | 1171 |
1170 DashingLineEffect::DashingLineEffect(GrColor color, | 1172 DashingLineEffect::DashingLineEffect(GrColor color, |
1171 AAMode aaMode, | 1173 AAMode aaMode, |
1172 const SkMatrix& localMatrix, | 1174 const SkMatrix& localMatrix, |
1173 bool usesLocalCoords) | 1175 bool usesLocalCoords) |
1174 : fColor(color) | 1176 : fColor(color) |
1175 , fLocalMatrix(localMatrix) | 1177 , fLocalMatrix(localMatrix) |
1176 , fUsesLocalCoords(usesLocalCoords) | 1178 , fUsesLocalCoords(usesLocalCoords) |
1177 , fAAMode(aaMode) { | 1179 , fAAMode(aaMode) { |
1178 this->initClassID<DashingLineEffect>(); | 1180 this->initClassID<DashingLineEffect>(); |
1179 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertex
AttribType)); | 1181 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertex
AttribType)); |
1180 fInDashParams = &this->addVertexAttrib(Attribute("inDashParams", kVec3f_GrVe
rtexAttribType)); | 1182 fInDashParams = &this->addVertexAttrib(Attribute("inDashParams", kVec3f_GrVe
rtexAttribType)); |
1181 fInRectParams = &this->addVertexAttrib(Attribute("inRect", kVec4f_GrVertexAt
tribType)); | 1183 fInRectParams = &this->addVertexAttrib(Attribute("inRect", kVec4f_GrVertexAt
tribType)); |
1182 } | 1184 } |
1183 | 1185 |
1184 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(DashingLineEffect); | 1186 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(DashingLineEffect); |
1185 | 1187 |
1186 const GrGeometryProcessor* DashingLineEffect::TestCreate(GrProcessorTestData* d)
{ | 1188 sk_sp<GrGeometryProcessor> DashingLineEffect::TestCreate(GrProcessorTestData* d)
{ |
1187 AAMode aaMode = static_cast<AAMode>(d->fRandom->nextULessThan(GrDashingEffec
t::kAAModeCnt)); | 1189 AAMode aaMode = static_cast<AAMode>(d->fRandom->nextULessThan(GrDashingEffec
t::kAAModeCnt)); |
1188 return DashingLineEffect::Create(GrRandomColor(d->fRandom), | 1190 return DashingLineEffect::Make(GrRandomColor(d->fRandom), |
1189 aaMode, GrTest::TestMatrix(d->fRandom), | 1191 aaMode, GrTest::TestMatrix(d->fRandom), |
1190 d->fRandom->nextBool()); | 1192 d->fRandom->nextBool()); |
1191 } | 1193 } |
1192 | 1194 |
1193 ////////////////////////////////////////////////////////////////////////////// | 1195 ////////////////////////////////////////////////////////////////////////////// |
1194 | 1196 |
1195 static GrGeometryProcessor* create_dash_gp(GrColor color, | 1197 static sk_sp<GrGeometryProcessor> make_dash_gp(GrColor color, |
1196 AAMode aaMode, | 1198 AAMode aaMode, |
1197 DashCap cap, | 1199 DashCap cap, |
1198 const SkMatrix& viewMatrix, | 1200 const SkMatrix& viewMatrix, |
1199 bool usesLocalCoords) { | 1201 bool usesLocalCoords) { |
1200 SkMatrix invert; | 1202 SkMatrix invert; |
1201 if (usesLocalCoords && !viewMatrix.invert(&invert)) { | 1203 if (usesLocalCoords && !viewMatrix.invert(&invert)) { |
1202 SkDebugf("Failed to invert\n"); | 1204 SkDebugf("Failed to invert\n"); |
1203 return nullptr; | 1205 return nullptr; |
1204 } | 1206 } |
1205 | 1207 |
1206 switch (cap) { | 1208 switch (cap) { |
1207 case kRound_DashCap: | 1209 case kRound_DashCap: |
1208 return DashingCircleEffect::Create(color, aaMode, invert, usesLocalC
oords); | 1210 return DashingCircleEffect::Make(color, aaMode, invert, usesLocalCoo
rds); |
1209 case kNonRound_DashCap: | 1211 case kNonRound_DashCap: |
1210 return DashingLineEffect::Create(color, aaMode, invert, usesLocalCoo
rds); | 1212 return DashingLineEffect::Make(color, aaMode, invert, usesLocalCoord
s); |
1211 } | 1213 } |
1212 return nullptr; | 1214 return nullptr; |
1213 } | 1215 } |
1214 | 1216 |
1215 ////////////////////////////////////////////////////////////////////////////////
///////////////// | 1217 ////////////////////////////////////////////////////////////////////////////////
///////////////// |
1216 | 1218 |
1217 #ifdef GR_TEST_UTILS | 1219 #ifdef GR_TEST_UTILS |
1218 | 1220 |
1219 DRAW_BATCH_TEST_DEFINE(DashBatch) { | 1221 DRAW_BATCH_TEST_DEFINE(DashBatch) { |
1220 GrColor color = GrRandomColor(random); | 1222 GrColor color = GrRandomColor(random); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1278 p.setStrokeWidth(SkIntToScalar(1)); | 1280 p.setStrokeWidth(SkIntToScalar(1)); |
1279 p.setStrokeCap(cap); | 1281 p.setStrokeCap(cap); |
1280 p.setPathEffect(GrTest::TestDashPathEffect::Make(intervals, 2, phase)); | 1282 p.setPathEffect(GrTest::TestDashPathEffect::Make(intervals, 2, phase)); |
1281 | 1283 |
1282 GrStyle style(p); | 1284 GrStyle style(p); |
1283 | 1285 |
1284 return GrDashingEffect::CreateDashLineBatch(color, viewMatrix, pts, aaMode,
style); | 1286 return GrDashingEffect::CreateDashLineBatch(color, viewMatrix, pts, aaMode,
style); |
1285 } | 1287 } |
1286 | 1288 |
1287 #endif | 1289 #endif |
OLD | NEW |