Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Unified Diff: src/animator/SkDrawExtraPathEffect.cpp

Issue 12480002: Fixing some warnings on Linux (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/animator/SkDrawExtraPathEffect.cpp
===================================================================
--- src/animator/SkDrawExtraPathEffect.cpp (revision 8005)
+++ src/animator/SkDrawExtraPathEffect.cpp (working copy)
@@ -118,15 +118,11 @@
SkMatrix m;
m.reset();
if (fDraw->addMatrix) {
- SkDrawMatrix* matrix;
sugoi 2013/03/06 16:14:59 matrix is assigned, but unused, so it was deleted
- if (fDraw->addMatrix->getType() == SkType_Matrix)
- matrix = (SkDrawMatrix*) fDraw->addMatrix;
- else {
+ if (fDraw->addMatrix->getType() != SkType_Matrix) {
SkApply* apply = (SkApply*) fDraw->addMatrix;
apply->refresh(*fMaker);
apply->activate(*fMaker);
apply->interpolate(*fMaker, SkScalarMulRound(distance, 1000));
- matrix = (SkDrawMatrix*) apply->getScope();
}
}
SkScalar result = 0;
@@ -224,55 +220,76 @@
class SkShape2DPathEffect : public Sk2DPathEffect {
public:
SkShape2DPathEffect(SkDrawShape2DPathEffect* draw, SkAnimateMaker* maker,
- const SkMatrix& matrix) : Sk2DPathEffect(matrix), fDraw(draw), fMaker(maker) {
+ const SkMatrix& matrix) : Sk2DPathEffect(matrix) {
+ fData = new SkShape2DPathEffectData(draw, maker);
}
+ ~SkShape2DPathEffect() {
+ delete fData;
+ }
protected:
- virtual void begin(const SkIRect& uvBounds, SkPath* )
- {
- fUVBounds.set(SkIntToScalar(uvBounds.fLeft), SkIntToScalar(uvBounds.fTop),
- SkIntToScalar(uvBounds.fRight), SkIntToScalar(uvBounds.fBottom));
+ virtual void begin(const SkIRect& uvBounds, SkPath*) const {
sugoi 2013/03/06 16:14:59 These virtual functions are const in the base clas
+ fData->begin(uvBounds);
}
- virtual void next(const SkPoint& loc, int u, int v, SkPath* dst)
- {
- fLoc = loc;
- fU = u;
- fV = v;
- SkDrawPath* drawPath;
- fMaker->setExtraPropertyCallBack(fDraw->fType, Get2D, this);
- if (fDraw->addPath->isPath()) {
- drawPath = (SkDrawPath*) fDraw->addPath;
- } else {
- SkApply* apply = (SkApply*) fDraw->addPath;
- apply->refresh(*fMaker);
- apply->activate(*fMaker);
- apply->interpolate(*fMaker, v);
- drawPath = (SkDrawPath*) apply->getScope();
+ virtual void next(const SkPoint& loc, int u, int v, SkPath* dst) const {
+ fData->next(loc, u, v, dst);
+ }
+
+private:
+ struct SkShape2DPathEffectData {
+ SkShape2DPathEffectData(SkDrawShape2DPathEffect* draw, SkAnimateMaker* maker) :
+ fDraw(draw), fMaker(maker) {}
+
+ void begin(const SkIRect& uvBounds) {
+ fUVBounds.set(SkIntToScalar(uvBounds.fLeft), SkIntToScalar(uvBounds.fTop),
+ SkIntToScalar(uvBounds.fRight), SkIntToScalar(uvBounds.fBottom));
}
- if (drawPath == NULL)
- goto clearCallBack;
- if (fDraw->matrix) {
- SkDrawMatrix* matrix;
- if (fDraw->matrix->getType() == SkType_Matrix)
- matrix = (SkDrawMatrix*) fDraw->matrix;
- else {
- SkApply* apply = (SkApply*) fDraw->matrix;
+
+ void next(const SkPoint& loc, int u, int v, SkPath* dst) {
+ fLoc = loc;
+ fU = u;
+ fV = v;
+ SkDrawPath* drawPath;
+ fMaker->setExtraPropertyCallBack(fDraw->fType, Get2D, this);
+ if (fDraw->addPath->isPath()) {
+ drawPath = (SkDrawPath*) fDraw->addPath;
+ } else {
+ SkApply* apply = (SkApply*) fDraw->addPath;
+ apply->refresh(*fMaker);
apply->activate(*fMaker);
apply->interpolate(*fMaker, v);
- matrix = (SkDrawMatrix*) apply->getScope();
+ drawPath = (SkDrawPath*) apply->getScope();
}
- if (matrix) {
- dst->addPath(drawPath->getPath(), matrix->getMatrix());
+ if (drawPath == NULL)
goto clearCallBack;
+ if (fDraw->matrix) {
+ SkDrawMatrix* matrix;
+ if (fDraw->matrix->getType() == SkType_Matrix)
+ matrix = (SkDrawMatrix*) fDraw->matrix;
+ else {
+ SkApply* apply = (SkApply*) fDraw->matrix;
+ apply->activate(*fMaker);
+ apply->interpolate(*fMaker, v);
+ matrix = (SkDrawMatrix*) apply->getScope();
+ }
+ if (matrix) {
+ dst->addPath(drawPath->getPath(), matrix->getMatrix());
+ goto clearCallBack;
+ }
}
+ dst->addPath(drawPath->getPath());
+clearCallBack:
+ fMaker->clearExtraPropertyCallBack(fDraw->fType);
}
- dst->addPath(drawPath->getPath());
-clearCallBack:
- fMaker->clearExtraPropertyCallBack(fDraw->fType);
- }
-private:
+ SkPoint fLoc;
+ SkRect fUVBounds;
+ int32_t fU;
+ int32_t fV;
+ SkDrawShape2DPathEffect* fDraw;
+ SkAnimateMaker* fMaker;
+ };
static bool Get2D(const char* token, size_t len, void* s2D, SkScriptValue* value) {
static const char match[] = "locX|locY|left|top|right|bottom|u|v" ;
@@ -283,20 +300,15 @@
SkASSERT((sizeof(SkPoint) + sizeof(SkRect)) / sizeof(SkScalar) == 6);
if (index < 6) {
value->fType = SkType_Float;
- value->fOperand.fScalar = (&shape2D->fLoc.fX)[index];
+ value->fOperand.fScalar = (&shape2D->fData->fLoc.fX)[index];
} else {
value->fType = SkType_Int;
- value->fOperand.fS32 = (&shape2D->fU)[index - 6];
+ value->fOperand.fS32 = (&shape2D->fData->fU)[index - 6];
}
return true;
}
- SkPoint fLoc;
- SkRect fUVBounds;
- int32_t fU;
- int32_t fV;
- SkDrawShape2DPathEffect* fDraw;
- SkAnimateMaker* fMaker;
+ SkShape2DPathEffectData* fData;
// illegal
SkShape2DPathEffect(const SkShape2DPathEffect&);

Powered by Google App Engine
This is Rietveld 408576698