Replace reference parameter with pointer so that we can pass NULL

in SkDrawPaint::add(); check the pointer when it's used to avoid
dereferencing NULL.

Add title to Animator sample slide.



git-svn-id: http://skia.googlecode.com/svn/trunk@1825 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
tomhudson@google.com 2011-07-08 14:41:12 +00:00
parent 895ce131de
commit d6caf2eefd
4 changed files with 14 additions and 5 deletions

View File

@ -24,6 +24,7 @@ public:
protected:
// overrides
virtual void onDraw(SkCanvas*);
virtual bool onQuery(SkEvent* evt);
private:
SkString fBaseURI;
@ -140,6 +141,14 @@ void SkAnimatorView::onDraw(SkCanvas* canvas) {
}
}
bool SkAnimatorView::onQuery(SkEvent* evt) {
if (SampleCode::TitleQ(*evt)) {
SampleCode::TitleR(evt, "Animator");
return true;
}
return this->INHERITED::onQuery(evt);
}
//////////////////////////////////////////////////////////////////////////////
static SkView* MyFactory() {

View File

@ -98,11 +98,11 @@ SkDrawPaint::~SkDrawPaint() {
delete typeface;
}
bool SkDrawPaint::add(SkAnimateMaker& maker, SkDisplayable* child) {
bool SkDrawPaint::add(SkAnimateMaker* maker, SkDisplayable* child) {
SkASSERT(child && child->isPaintPart());
SkPaintPart* part = (SkPaintPart*) child;
if (part->add())
maker.setErrorCode(SkDisplayXMLParserError::kErrorAddingToPaint);
if (part->add() && maker)
maker->setErrorCode(SkDisplayXMLParserError::kErrorAddingToPaint);
return true;
}

View File

@ -34,7 +34,7 @@ class SkDrawPaint : public SkDrawable {
DECLARE_DRAW_MEMBER_INFO(Paint);
SkDrawPaint();
virtual ~SkDrawPaint();
virtual bool add(SkAnimateMaker& , SkDisplayable* child);
virtual bool add(SkAnimateMaker* , SkDisplayable* child);
virtual SkDisplayable* deepCopy(SkAnimateMaker* );
virtual bool draw(SkAnimateMaker& );
#ifdef SK_DUMP_ENABLED

View File

@ -61,7 +61,7 @@ bool SkDrawPathEffect::add() {
fPaint->fOwnsPathEffect = true;
return false;
}
fPaint->add(*(SkAnimateMaker*) NULL, this);
fPaint->add(NULL, this);
return false;
}