Index: src/animator/SkDrawGradient.cpp |
diff --git a/src/animator/SkDrawGradient.cpp b/src/animator/SkDrawGradient.cpp |
index c11559581b919c84e6eff35e831cb5b495d97ba9..70e5e4493e0e5f3560bff5e56697e443b77f2c0d 100644 |
--- a/src/animator/SkDrawGradient.cpp |
+++ b/src/animator/SkDrawGradient.cpp |
@@ -11,49 +11,6 @@ |
#include "SkAnimateMaker.h" |
#include "SkAnimatorScript.h" |
#include "SkGradientShader.h" |
-#include "SkUnitMapper.h" |
- |
-static SkScalar SkUnitToScalar(U16CPU x) { |
- return x / 65535.0f; |
-} |
- |
-static U16CPU SkScalarToUnit(SkScalar x) { |
- SkScalar pin = SkScalarPin(x, 0, SK_Scalar1); |
- return (int) (pin * 65535.0f); |
-} |
- |
-class SkDrawGradientUnitMapper : public SkUnitMapper { |
-public: |
- SkDrawGradientUnitMapper(SkAnimateMaker* maker, const char* script) : fMaker(maker), fScript(script) { |
- } |
- |
- SK_DECLARE_UNFLATTENABLE_OBJECT() |
- |
-protected: |
- virtual uint16_t mapUnit16(uint16_t x) { |
- fUnit = SkUnitToScalar(x); |
- SkScriptValue value; |
- SkAnimatorScript engine(*fMaker, NULL, SkType_Float); |
- engine.propertyCallBack(GetUnitValue, &fUnit); |
- if (engine.evaluate(fScript, &value, SkType_Float)) |
- x = SkScalarToUnit(value.fOperand.fScalar); |
- return x; |
- } |
- |
- static bool GetUnitValue(const char* token, size_t len, void* unitPtr, SkScriptValue* value) { |
- if (SK_LITERAL_STR_EQUAL("unit", token, len)) { |
- value->fOperand.fScalar = *(SkScalar*) unitPtr; |
- value->fType = SkType_Float; |
- return true; |
- } |
- return false; |
- } |
- |
- SkAnimateMaker* fMaker; |
- const char* fScript; |
- SkScalar fUnit; |
-}; |
- |
#if SK_USE_CONDENSED_INFO == 0 |
@@ -67,13 +24,12 @@ const SkMemberInfo SkDrawGradient::fInfo[] = { |
DEFINE_GET_MEMBER(SkDrawGradient); |
-SkDrawGradient::SkDrawGradient() : fUnitMapper(NULL) { |
+SkDrawGradient::SkDrawGradient() { |
} |
SkDrawGradient::~SkDrawGradient() { |
for (int index = 0; index < fDrawColors.count(); index++) |
delete fDrawColors[index]; |
- delete fUnitMapper; |
} |
bool SkDrawGradient::addChild(SkAnimateMaker& , SkDisplayable* child) { |
@@ -138,8 +94,6 @@ void SkDrawGradient::onEndElement(SkAnimateMaker& maker) { |
} |
} |
} |
- if (unitMapper.size() > 0) |
- fUnitMapper = new SkDrawGradientUnitMapper(&maker, unitMapper.c_str()); |
INHERITED::onEndElement(maker); |
} |
@@ -176,7 +130,7 @@ SkShader* SkDrawLinearGradient::getShader() { |
return NULL; |
SkShader* shader = SkGradientShader::CreateLinear((SkPoint*)points.begin(), |
fColors.begin(), offsets.begin(), fColors.count(), (SkShader::TileMode) tileMode, |
- fUnitMapper, 0, getMatrix()); |
+ 0, getMatrix()); |
SkAutoTDelete<SkShader> autoDel(shader); |
(void)autoDel.detach(); |
return shader; |
@@ -211,7 +165,7 @@ SkShader* SkDrawRadialGradient::getShader() { |
return NULL; |
SkShader* shader = SkGradientShader::CreateRadial(center, |
radius, fColors.begin(), offsets.begin(), fColors.count(), (SkShader::TileMode) tileMode, |
- fUnitMapper, 0, getMatrix()); |
+ 0, getMatrix()); |
SkAutoTDelete<SkShader> autoDel(shader); |
(void)autoDel.detach(); |
return shader; |