Home | History | Annotate | Download | only in animator
      1 
      2 /*
      3  * Copyright 2006 The Android Open Source Project
      4  *
      5  * Use of this source code is governed by a BSD-style license that can be
      6  * found in the LICENSE file.
      7  */
      8 
      9 
     10 #ifndef SkDrawGroup_DEFINED
     11 #define SkDrawGroup_DEFINED
     12 
     13 #include "SkADrawable.h"
     14 #include "SkIntArray.h"
     15 #include "SkMemberInfo.h"
     16 
     17 class SkGroup : public SkADrawable { //interface for schema element <g>
     18 public:
     19     DECLARE_MEMBER_INFO(Group);
     20     SkGroup();
     21     virtual ~SkGroup();
     22     bool addChild(SkAnimateMaker& , SkDisplayable* child) override;
     23     bool contains(SkDisplayable* ) override;
     24     SkGroup* copy();
     25     SkBool copySet(int index);
     26     SkDisplayable* deepCopy(SkAnimateMaker* ) override;
     27     bool doEvent(SkDisplayEvent::Kind , SkEventState* state ) override;
     28     bool draw(SkAnimateMaker& ) override;
     29 #ifdef SK_DUMP_ENABLED
     30     void dump(SkAnimateMaker* ) override;
     31     virtual void dumpDrawables(SkAnimateMaker* );
     32     void dumpEvents() override;
     33 #endif
     34     int findGroup(SkADrawable* drawable,  SkTDDrawableArray** list,
     35         SkGroup** parent, SkGroup** found, SkTDDrawableArray** grandList);
     36     bool enable(SkAnimateMaker& ) override;
     37     SkTDDrawableArray* getChildren() { return &fChildren; }
     38     SkGroup* getOriginal() { return fOriginal; }
     39     bool hasEnable() const override;
     40     void initialize() override;
     41     SkBool isACopy() { return fOriginal != nullptr; }
     42     void markCopyClear(int index);
     43     void markCopySet(int index);
     44     void markCopySize(int index);
     45     bool markedForDelete(int index) const { return (fCopies[index >> 5] & 1 << (index & 0x1f)) == 0; }
     46     void reset();
     47     bool resolveIDs(SkAnimateMaker& maker, SkDisplayable* original, SkApply* ) override;
     48     void setSteps(int steps) override;
     49 #ifdef SK_DEBUG
     50     void validate() override;
     51 #endif
     52 protected:
     53     bool ifCondition(SkAnimateMaker& maker, SkADrawable* drawable,
     54         SkString& conditionString);
     55     SkString condition;
     56     SkString enableCondition;
     57     SkTDDrawableArray fChildren;
     58     SkTDDrawableArray* fParentList;
     59     SkTDIntArray fCopies;
     60     SkGroup* fOriginal;
     61 private:
     62     typedef SkADrawable INHERITED;
     63 };
     64 
     65 class SkSave: public SkGroup {
     66     DECLARE_MEMBER_INFO(Save);
     67     bool draw(SkAnimateMaker& ) override;
     68 private:
     69     typedef SkGroup INHERITED;
     70 };
     71 
     72 #endif // SkDrawGroup_DEFINED
     73