| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
| 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 "SkDrawExtraPathEffect.h" | 8 #include "SkDrawExtraPathEffect.h" |
| 9 #include "SkDrawPath.h" | 9 #include "SkDrawPath.h" |
| 10 #include "Sk1DPathEffect.h" | 10 #include "Sk1DPathEffect.h" |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 #include "SkDrawMatrix.h" | 83 #include "SkDrawMatrix.h" |
| 84 #include "SkPaint.h" | 84 #include "SkPaint.h" |
| 85 | 85 |
| 86 class SkShape1DPathEffect : public Sk1DPathEffect { | 86 class SkShape1DPathEffect : public Sk1DPathEffect { |
| 87 public: | 87 public: |
| 88 SkShape1DPathEffect(SkDrawShape1DPathEffect* draw, SkAnimateMaker* maker) : | 88 SkShape1DPathEffect(SkDrawShape1DPathEffect* draw, SkAnimateMaker* maker) : |
| 89 fDraw(draw), fMaker(maker) { | 89 fDraw(draw), fMaker(maker) { |
| 90 } | 90 } |
| 91 | 91 |
| 92 // For serialization. This will never be called. | 92 // For serialization. This will never be called. |
| 93 Factory getFactory() const override { sk_throw(); return NULL; } | 93 Factory getFactory() const override { sk_throw(); return nullptr; } |
| 94 | 94 |
| 95 protected: | 95 protected: |
| 96 SkScalar begin(SkScalar contourLength) const override { | 96 SkScalar begin(SkScalar contourLength) const override { |
| 97 SkScriptValue value; | 97 SkScriptValue value; |
| 98 SkAnimatorScript engine(*fMaker, NULL, SkType_Float); | 98 SkAnimatorScript engine(*fMaker, nullptr, SkType_Float); |
| 99 engine.propertyCallBack(GetContourLength, &contourLength); | 99 engine.propertyCallBack(GetContourLength, &contourLength); |
| 100 value.fOperand.fScalar = 0; | 100 value.fOperand.fScalar = 0; |
| 101 engine.evaluate(fDraw->phase.c_str(), &value, SkType_Float); | 101 engine.evaluate(fDraw->phase.c_str(), &value, SkType_Float); |
| 102 return value.fOperand.fScalar; | 102 return value.fOperand.fScalar; |
| 103 } | 103 } |
| 104 | 104 |
| 105 SkScalar next(SkPath* dst, SkScalar distance, SkPathMeasure&) const override
{ | 105 SkScalar next(SkPath* dst, SkScalar distance, SkPathMeasure&) const override
{ |
| 106 fMaker->setExtraPropertyCallBack(fDraw->fType, GetDistance, &distance); | 106 fMaker->setExtraPropertyCallBack(fDraw->fType, GetDistance, &distance); |
| 107 SkDrawPath* drawPath = NULL; | 107 SkDrawPath* drawPath = nullptr; |
| 108 if (fDraw->addPath->isPath()) { | 108 if (fDraw->addPath->isPath()) { |
| 109 drawPath = (SkDrawPath*) fDraw->addPath; | 109 drawPath = (SkDrawPath*) fDraw->addPath; |
| 110 } else { | 110 } else { |
| 111 SkApply* apply = (SkApply*) fDraw->addPath; | 111 SkApply* apply = (SkApply*) fDraw->addPath; |
| 112 apply->refresh(*fMaker); | 112 apply->refresh(*fMaker); |
| 113 apply->activate(*fMaker); | 113 apply->activate(*fMaker); |
| 114 apply->interpolate(*fMaker, SkScalarRoundToInt(distance * 1000)); | 114 apply->interpolate(*fMaker, SkScalarRoundToInt(distance * 1000)); |
| 115 drawPath = (SkDrawPath*) apply->getScope(); | 115 drawPath = (SkDrawPath*) apply->getScope(); |
| 116 } | 116 } |
| 117 SkMatrix m; | 117 SkMatrix m; |
| 118 m.reset(); | 118 m.reset(); |
| 119 if (fDraw->addMatrix) { | 119 if (fDraw->addMatrix) { |
| 120 SkDrawMatrix* matrix; | 120 SkDrawMatrix* matrix; |
| 121 if (fDraw->addMatrix->getType() == SkType_Matrix) | 121 if (fDraw->addMatrix->getType() == SkType_Matrix) |
| 122 matrix = (SkDrawMatrix*) fDraw->addMatrix; | 122 matrix = (SkDrawMatrix*) fDraw->addMatrix; |
| 123 else { | 123 else { |
| 124 SkApply* apply = (SkApply*) fDraw->addMatrix; | 124 SkApply* apply = (SkApply*) fDraw->addMatrix; |
| 125 apply->refresh(*fMaker); | 125 apply->refresh(*fMaker); |
| 126 apply->activate(*fMaker); | 126 apply->activate(*fMaker); |
| 127 apply->interpolate(*fMaker, SkScalarRoundToInt(distance * 1000))
; | 127 apply->interpolate(*fMaker, SkScalarRoundToInt(distance * 1000))
; |
| 128 matrix = (SkDrawMatrix*) apply->getScope(); | 128 matrix = (SkDrawMatrix*) apply->getScope(); |
| 129 } | 129 } |
| 130 if (matrix) { | 130 if (matrix) { |
| 131 m = matrix->getMatrix(); | 131 m = matrix->getMatrix(); |
| 132 } | 132 } |
| 133 } | 133 } |
| 134 SkScalar result = 0; | 134 SkScalar result = 0; |
| 135 SkAnimatorScript::EvaluateFloat(*fMaker, NULL, fDraw->spacing.c_str(), &
result); | 135 SkAnimatorScript::EvaluateFloat(*fMaker, nullptr, fDraw->spacing.c_str()
, &result); |
| 136 if (drawPath) | 136 if (drawPath) |
| 137 dst->addPath(drawPath->getPath(), m); | 137 dst->addPath(drawPath->getPath(), m); |
| 138 fMaker->clearExtraPropertyCallBack(fDraw->fType); | 138 fMaker->clearExtraPropertyCallBack(fDraw->fType); |
| 139 return result; | 139 return result; |
| 140 } | 140 } |
| 141 | 141 |
| 142 #ifndef SK_IGNORE_TO_STRING | 142 #ifndef SK_IGNORE_TO_STRING |
| 143 void toString(SkString* str) const override { | 143 void toString(SkString* str) const override { |
| 144 str->appendf("SkShape1DPathEffect: ("); | 144 str->appendf("SkShape1DPathEffect: ("); |
| 145 // TODO: fill in | 145 // TODO: fill in |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 SK_MEMBER(addMatrix, Drawable), // either matrix or apply | 178 SK_MEMBER(addMatrix, Drawable), // either matrix or apply |
| 179 SK_MEMBER(addPath, Drawable), // either path or apply | 179 SK_MEMBER(addPath, Drawable), // either path or apply |
| 180 SK_MEMBER(path, Path), | 180 SK_MEMBER(path, Path), |
| 181 }; | 181 }; |
| 182 | 182 |
| 183 #endif | 183 #endif |
| 184 | 184 |
| 185 DEFINE_GET_MEMBER(SkDrawShapePathEffect); | 185 DEFINE_GET_MEMBER(SkDrawShapePathEffect); |
| 186 | 186 |
| 187 SkDrawShapePathEffect::SkDrawShapePathEffect() : | 187 SkDrawShapePathEffect::SkDrawShapePathEffect() : |
| 188 addPath(NULL), addMatrix(NULL), path(NULL), fPathEffect(NULL) { | 188 addPath(nullptr), addMatrix(nullptr), path(nullptr), fPathEffect(nullptr) { |
| 189 } | 189 } |
| 190 | 190 |
| 191 SkDrawShapePathEffect::~SkDrawShapePathEffect() { | 191 SkDrawShapePathEffect::~SkDrawShapePathEffect() { |
| 192 SkSafeUnref(fPathEffect); | 192 SkSafeUnref(fPathEffect); |
| 193 } | 193 } |
| 194 | 194 |
| 195 bool SkDrawShapePathEffect::addChild(SkAnimateMaker& , SkDisplayable* child) { | 195 bool SkDrawShapePathEffect::addChild(SkAnimateMaker& , SkDisplayable* child) { |
| 196 path = (SkDrawPath*) child; | 196 path = (SkDrawPath*) child; |
| 197 return true; | 197 return true; |
| 198 } | 198 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 216 | 216 |
| 217 DEFINE_GET_MEMBER(SkDrawShape1DPathEffect); | 217 DEFINE_GET_MEMBER(SkDrawShape1DPathEffect); |
| 218 | 218 |
| 219 SkDrawShape1DPathEffect::SkDrawShape1DPathEffect(SkDisplayTypes type) : fType(ty
pe) { | 219 SkDrawShape1DPathEffect::SkDrawShape1DPathEffect(SkDisplayTypes type) : fType(ty
pe) { |
| 220 } | 220 } |
| 221 | 221 |
| 222 SkDrawShape1DPathEffect::~SkDrawShape1DPathEffect() { | 222 SkDrawShape1DPathEffect::~SkDrawShape1DPathEffect() { |
| 223 } | 223 } |
| 224 | 224 |
| 225 void SkDrawShape1DPathEffect::onEndElement(SkAnimateMaker& maker) { | 225 void SkDrawShape1DPathEffect::onEndElement(SkAnimateMaker& maker) { |
| 226 if (addPath == NULL || (addPath->isPath() == false && addPath->isApply() ==
false)) | 226 if (addPath == nullptr || (addPath->isPath() == false && addPath->isApply()
== false)) |
| 227 maker.setErrorCode(SkDisplayXMLParserError::kUnknownError); // !!! add e
rror | 227 maker.setErrorCode(SkDisplayXMLParserError::kUnknownError); // !!! add e
rror |
| 228 else | 228 else |
| 229 fPathEffect = new SkShape1DPathEffect(this, &maker); | 229 fPathEffect = new SkShape1DPathEffect(this, &maker); |
| 230 } | 230 } |
| 231 | 231 |
| 232 ////////// SkShape2DPathEffect | 232 ////////// SkShape2DPathEffect |
| 233 | 233 |
| 234 class SkShape2DPathEffect : public Sk2DPathEffect { | 234 class SkShape2DPathEffect : public Sk2DPathEffect { |
| 235 public: | 235 public: |
| 236 SkShape2DPathEffect(SkDrawShape2DPathEffect* draw, SkAnimateMaker* maker, | 236 SkShape2DPathEffect(SkDrawShape2DPathEffect* draw, SkAnimateMaker* maker, |
| 237 const SkMatrix& matrix) : Sk2DPathEffect(matrix), fDraw(draw), fMaker(ma
ker) { | 237 const SkMatrix& matrix) : Sk2DPathEffect(matrix), fDraw(draw), fMaker(ma
ker) { |
| 238 } | 238 } |
| 239 | 239 |
| 240 // For serialization. This will never be called. | 240 // For serialization. This will never be called. |
| 241 Factory getFactory() const override { sk_throw(); return NULL; } | 241 Factory getFactory() const override { sk_throw(); return nullptr; } |
| 242 | 242 |
| 243 protected: | 243 protected: |
| 244 void begin(const SkIRect& uvBounds, SkPath*) const override { | 244 void begin(const SkIRect& uvBounds, SkPath*) const override { |
| 245 const_cast<SkShape2DPathEffect*>(this)->setUVBounds(uvBounds); | 245 const_cast<SkShape2DPathEffect*>(this)->setUVBounds(uvBounds); |
| 246 } | 246 } |
| 247 | 247 |
| 248 void next(const SkPoint& loc, int u, int v, SkPath* dst) const override { | 248 void next(const SkPoint& loc, int u, int v, SkPath* dst) const override { |
| 249 const_cast<SkShape2DPathEffect*>(this)->addPath(loc, u, v, dst); | 249 const_cast<SkShape2DPathEffect*>(this)->addPath(loc, u, v, dst); |
| 250 } | 250 } |
| 251 | 251 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 263 fMaker->setExtraPropertyCallBack(fDraw->fType, Get2D, this); | 263 fMaker->setExtraPropertyCallBack(fDraw->fType, Get2D, this); |
| 264 if (fDraw->addPath->isPath()) { | 264 if (fDraw->addPath->isPath()) { |
| 265 drawPath = (SkDrawPath*) fDraw->addPath; | 265 drawPath = (SkDrawPath*) fDraw->addPath; |
| 266 } else { | 266 } else { |
| 267 SkApply* apply = (SkApply*) fDraw->addPath; | 267 SkApply* apply = (SkApply*) fDraw->addPath; |
| 268 apply->refresh(*fMaker); | 268 apply->refresh(*fMaker); |
| 269 apply->activate(*fMaker); | 269 apply->activate(*fMaker); |
| 270 apply->interpolate(*fMaker, v); | 270 apply->interpolate(*fMaker, v); |
| 271 drawPath = (SkDrawPath*) apply->getScope(); | 271 drawPath = (SkDrawPath*) apply->getScope(); |
| 272 } | 272 } |
| 273 if (drawPath == NULL) | 273 if (drawPath == nullptr) |
| 274 goto clearCallBack; | 274 goto clearCallBack; |
| 275 if (fDraw->matrix) { | 275 if (fDraw->matrix) { |
| 276 SkDrawMatrix* matrix; | 276 SkDrawMatrix* matrix; |
| 277 if (fDraw->matrix->getType() == SkType_Matrix) | 277 if (fDraw->matrix->getType() == SkType_Matrix) |
| 278 matrix = (SkDrawMatrix*) fDraw->matrix; | 278 matrix = (SkDrawMatrix*) fDraw->matrix; |
| 279 else { | 279 else { |
| 280 SkApply* apply = (SkApply*) fDraw->matrix; | 280 SkApply* apply = (SkApply*) fDraw->matrix; |
| 281 apply->activate(*fMaker); | 281 apply->activate(*fMaker); |
| 282 apply->interpolate(*fMaker, v); | 282 apply->interpolate(*fMaker, v); |
| 283 matrix = (SkDrawMatrix*) apply->getScope(); | 283 matrix = (SkDrawMatrix*) apply->getScope(); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 | 334 |
| 335 DEFINE_GET_MEMBER(SkDrawShape2DPathEffect); | 335 DEFINE_GET_MEMBER(SkDrawShape2DPathEffect); |
| 336 | 336 |
| 337 SkDrawShape2DPathEffect::SkDrawShape2DPathEffect(SkDisplayTypes type) : fType(ty
pe) { | 337 SkDrawShape2DPathEffect::SkDrawShape2DPathEffect(SkDisplayTypes type) : fType(ty
pe) { |
| 338 } | 338 } |
| 339 | 339 |
| 340 SkDrawShape2DPathEffect::~SkDrawShape2DPathEffect() { | 340 SkDrawShape2DPathEffect::~SkDrawShape2DPathEffect() { |
| 341 } | 341 } |
| 342 | 342 |
| 343 void SkDrawShape2DPathEffect::onEndElement(SkAnimateMaker& maker) { | 343 void SkDrawShape2DPathEffect::onEndElement(SkAnimateMaker& maker) { |
| 344 if (addPath == NULL || (addPath->isPath() == false && addPath->isApply() ==
false) || | 344 if (addPath == nullptr || (addPath->isPath() == false && addPath->isApply()
== false) || |
| 345 matrix == NULL) | 345 matrix == nullptr) |
| 346 maker.setErrorCode(SkDisplayXMLParserError::kUnknownError); // !!! add e
rror | 346 maker.setErrorCode(SkDisplayXMLParserError::kUnknownError); // !!! add e
rror |
| 347 else | 347 else |
| 348 fPathEffect = new SkShape2DPathEffect(this, &maker, matrix->getMatrix())
; | 348 fPathEffect = new SkShape2DPathEffect(this, &maker, matrix->getMatrix())
; |
| 349 } | 349 } |
| 350 | 350 |
| 351 ////////// SkDrawComposePathEffect | 351 ////////// SkDrawComposePathEffect |
| 352 | 352 |
| 353 #if SK_USE_CONDENSED_INFO == 0 | 353 #if SK_USE_CONDENSED_INFO == 0 |
| 354 | 354 |
| 355 const SkMemberInfo SkDrawComposePathEffect::fInfo[] = { | 355 const SkMemberInfo SkDrawComposePathEffect::fInfo[] = { |
| 356 SK_MEMBER(effect1, PathEffect), | 356 SK_MEMBER(effect1, PathEffect), |
| 357 SK_MEMBER(effect2, PathEffect) | 357 SK_MEMBER(effect2, PathEffect) |
| 358 }; | 358 }; |
| 359 | 359 |
| 360 #endif | 360 #endif |
| 361 | 361 |
| 362 DEFINE_GET_MEMBER(SkDrawComposePathEffect); | 362 DEFINE_GET_MEMBER(SkDrawComposePathEffect); |
| 363 | 363 |
| 364 SkDrawComposePathEffect::SkDrawComposePathEffect(SkDisplayTypes type) : fType(ty
pe), | 364 SkDrawComposePathEffect::SkDrawComposePathEffect(SkDisplayTypes type) : fType(ty
pe), |
| 365 effect1(NULL), effect2(NULL) { | 365 effect1(nullptr), effect2(nullptr) { |
| 366 } | 366 } |
| 367 | 367 |
| 368 SkDrawComposePathEffect::~SkDrawComposePathEffect() { | 368 SkDrawComposePathEffect::~SkDrawComposePathEffect() { |
| 369 delete effect1; | 369 delete effect1; |
| 370 delete effect2; | 370 delete effect2; |
| 371 } | 371 } |
| 372 | 372 |
| 373 bool SkDrawComposePathEffect::addChild(SkAnimateMaker& , SkDisplayable* child) { | 373 bool SkDrawComposePathEffect::addChild(SkAnimateMaker& , SkDisplayable* child) { |
| 374 if (effect1 == NULL) | 374 if (effect1 == nullptr) |
| 375 effect1 = (SkDrawPathEffect*) child; | 375 effect1 = (SkDrawPathEffect*) child; |
| 376 else | 376 else |
| 377 effect2 = (SkDrawPathEffect*) child; | 377 effect2 = (SkDrawPathEffect*) child; |
| 378 return true; | 378 return true; |
| 379 } | 379 } |
| 380 | 380 |
| 381 SkPathEffect* SkDrawComposePathEffect::getPathEffect() { | 381 SkPathEffect* SkDrawComposePathEffect::getPathEffect() { |
| 382 SkPathEffect* e1 = effect1->getPathEffect(); | 382 SkPathEffect* e1 = effect1->getPathEffect(); |
| 383 SkPathEffect* e2 = effect2->getPathEffect(); | 383 SkPathEffect* e2 = effect2->getPathEffect(); |
| 384 SkPathEffect* composite = SkComposePathEffect::Create(e1, e2); | 384 SkPathEffect* composite = SkComposePathEffect::Create(e1, e2); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 class SkExtraPathEffects : public SkExtras { | 426 class SkExtraPathEffects : public SkExtras { |
| 427 public: | 427 public: |
| 428 SkExtraPathEffects() : | 428 SkExtraPathEffects() : |
| 429 skDrawShape1DPathEffectType(SkType_Unknown), | 429 skDrawShape1DPathEffectType(SkType_Unknown), |
| 430 skDrawShape2DPathEffectType(SkType_Unknown), | 430 skDrawShape2DPathEffectType(SkType_Unknown), |
| 431 skDrawComposePathEffectType(SkType_Unknown), | 431 skDrawComposePathEffectType(SkType_Unknown), |
| 432 skDrawCornerPathEffectType(SkType_Unknown) { | 432 skDrawCornerPathEffectType(SkType_Unknown) { |
| 433 } | 433 } |
| 434 | 434 |
| 435 virtual SkDisplayable* createInstance(SkDisplayTypes type) { | 435 virtual SkDisplayable* createInstance(SkDisplayTypes type) { |
| 436 SkDisplayable* result = NULL; | 436 SkDisplayable* result = nullptr; |
| 437 if (skDrawShape1DPathEffectType == type) | 437 if (skDrawShape1DPathEffectType == type) |
| 438 result = new SkDrawShape1DPathEffect(type); | 438 result = new SkDrawShape1DPathEffect(type); |
| 439 else if (skDrawShape2DPathEffectType == type) | 439 else if (skDrawShape2DPathEffectType == type) |
| 440 result = new SkDrawShape2DPathEffect(type); | 440 result = new SkDrawShape2DPathEffect(type); |
| 441 else if (skDrawComposePathEffectType == type) | 441 else if (skDrawComposePathEffectType == type) |
| 442 result = new SkDrawComposePathEffect(type); | 442 result = new SkDrawComposePathEffect(type); |
| 443 else if (skDrawCornerPathEffectType == type) | 443 else if (skDrawCornerPathEffectType == type) |
| 444 result = new SkDrawCornerPathEffect(type); | 444 result = new SkDrawCornerPathEffect(type); |
| 445 return result; | 445 return result; |
| 446 } | 446 } |
| 447 | 447 |
| 448 virtual bool definesType(SkDisplayTypes type) { | 448 virtual bool definesType(SkDisplayTypes type) { |
| 449 return type == skDrawShape1DPathEffectType || | 449 return type == skDrawShape1DPathEffectType || |
| 450 type == skDrawShape2DPathEffectType || | 450 type == skDrawShape2DPathEffectType || |
| 451 type == skDrawComposePathEffectType || | 451 type == skDrawComposePathEffectType || |
| 452 type == skDrawCornerPathEffectType; | 452 type == skDrawCornerPathEffectType; |
| 453 } | 453 } |
| 454 | 454 |
| 455 #if SK_USE_CONDENSED_INFO == 0 | 455 #if SK_USE_CONDENSED_INFO == 0 |
| 456 virtual const SkMemberInfo* getMembers(SkDisplayTypes type, int* infoCountPt
r) { | 456 virtual const SkMemberInfo* getMembers(SkDisplayTypes type, int* infoCountPt
r) { |
| 457 const SkMemberInfo* info = NULL; | 457 const SkMemberInfo* info = nullptr; |
| 458 int infoCount = 0; | 458 int infoCount = 0; |
| 459 if (skDrawShape1DPathEffectType == type) { | 459 if (skDrawShape1DPathEffectType == type) { |
| 460 info = SkDrawShape1DPathEffect::fInfo; | 460 info = SkDrawShape1DPathEffect::fInfo; |
| 461 infoCount = SkDrawShape1DPathEffect::fInfoCount; | 461 infoCount = SkDrawShape1DPathEffect::fInfoCount; |
| 462 } else if (skDrawShape2DPathEffectType == type) { | 462 } else if (skDrawShape2DPathEffectType == type) { |
| 463 info = SkDrawShape2DPathEffect::fInfo; | 463 info = SkDrawShape2DPathEffect::fInfo; |
| 464 infoCount = SkDrawShape2DPathEffect::fInfoCount; | 464 infoCount = SkDrawShape2DPathEffect::fInfoCount; |
| 465 } else if (skDrawComposePathEffectType == type) { | 465 } else if (skDrawComposePathEffectType == type) { |
| 466 info = SkDrawComposePathEffect::fInfo; | 466 info = SkDrawComposePathEffect::fInfo; |
| 467 infoCount = SkDrawShape1DPathEffect::fInfoCount; | 467 infoCount = SkDrawShape1DPathEffect::fInfoCount; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 478 #ifdef SK_DEBUG | 478 #ifdef SK_DEBUG |
| 479 virtual const char* getName(SkDisplayTypes type) { | 479 virtual const char* getName(SkDisplayTypes type) { |
| 480 if (skDrawShape1DPathEffectType == type) | 480 if (skDrawShape1DPathEffectType == type) |
| 481 return kDrawShape1DPathEffectName; | 481 return kDrawShape1DPathEffectName; |
| 482 else if (skDrawShape2DPathEffectType == type) | 482 else if (skDrawShape2DPathEffectType == type) |
| 483 return kDrawShape2DPathEffectName; | 483 return kDrawShape2DPathEffectName; |
| 484 else if (skDrawComposePathEffectType == type) | 484 else if (skDrawComposePathEffectType == type) |
| 485 return kDrawComposePathEffectName; | 485 return kDrawComposePathEffectName; |
| 486 else if (skDrawCornerPathEffectType == type) | 486 else if (skDrawCornerPathEffectType == type) |
| 487 return kDrawCornerPathEffectName; | 487 return kDrawCornerPathEffectName; |
| 488 return NULL; | 488 return nullptr; |
| 489 } | 489 } |
| 490 #endif | 490 #endif |
| 491 | 491 |
| 492 virtual SkDisplayTypes getType(const char name[], size_t len ) { | 492 virtual SkDisplayTypes getType(const char name[], size_t len ) { |
| 493 SkDisplayTypes* type = NULL; | 493 SkDisplayTypes* type = nullptr; |
| 494 if (SK_LITERAL_STR_EQUAL(kDrawShape1DPathEffectName, name, len)) | 494 if (SK_LITERAL_STR_EQUAL(kDrawShape1DPathEffectName, name, len)) |
| 495 type = &skDrawShape1DPathEffectType; | 495 type = &skDrawShape1DPathEffectType; |
| 496 else if (SK_LITERAL_STR_EQUAL(kDrawShape2DPathEffectName, name, len)) | 496 else if (SK_LITERAL_STR_EQUAL(kDrawShape2DPathEffectName, name, len)) |
| 497 type = &skDrawShape2DPathEffectType; | 497 type = &skDrawShape2DPathEffectType; |
| 498 else if (SK_LITERAL_STR_EQUAL(kDrawComposePathEffectName, name, len)) | 498 else if (SK_LITERAL_STR_EQUAL(kDrawComposePathEffectName, name, len)) |
| 499 type = &skDrawComposePathEffectType; | 499 type = &skDrawComposePathEffectType; |
| 500 else if (SK_LITERAL_STR_EQUAL(kDrawCornerPathEffectName, name, len)) | 500 else if (SK_LITERAL_STR_EQUAL(kDrawCornerPathEffectName, name, len)) |
| 501 type = &skDrawCornerPathEffectType; | 501 type = &skDrawCornerPathEffectType; |
| 502 if (type) { | 502 if (type) { |
| 503 if (*type == SkType_Unknown) | 503 if (*type == SkType_Unknown) |
| (...skipping 10 matching lines...) Expand all Loading... |
| 514 SkDisplayTypes skDrawCornerPathEffectType; | 514 SkDisplayTypes skDrawCornerPathEffectType; |
| 515 }; | 515 }; |
| 516 | 516 |
| 517 void InitializeSkExtraPathEffects(SkAnimator* animator) { | 517 void InitializeSkExtraPathEffects(SkAnimator* animator) { |
| 518 animator->addExtras(new SkExtraPathEffects()); | 518 animator->addExtras(new SkExtraPathEffects()); |
| 519 } | 519 } |
| 520 | 520 |
| 521 //////////////// | 521 //////////////// |
| 522 | 522 |
| 523 | 523 |
| 524 SkExtras::SkExtras() : fExtraCallBack(NULL), fExtraStorage(NULL) { | 524 SkExtras::SkExtras() : fExtraCallBack(nullptr), fExtraStorage(nullptr) { |
| 525 } | 525 } |
| OLD | NEW |