namespace tvg
{
- enum class PaintType { Shape = 0, Scene, Picture };
+ enum ContextFlag {Invalid = 0, FastTrack = 1};
+
+ struct Iterator
+ {
+ virtual ~Iterator() {}
+ virtual const Paint* next() = 0;
+ virtual uint32_t count() = 0;
+ virtual void begin() = 0;
+ };
struct StrategyMethod
{
virtual bool dispose(RenderMethod& renderer) = 0;
virtual void* update(RenderMethod& renderer, const RenderTransform* transform, uint32_t opacity, Array<RenderData>& clips, RenderUpdateFlag pFlag) = 0; //Return engine data if it has.
virtual bool render(RenderMethod& renderer) = 0;
- virtual bool bounds(float* x, float* y, float* w, float* h) const = 0;
+ virtual bool bounds(float* x, float* y, float* w, float* h) = 0;
virtual RenderRegion bounds(RenderMethod& renderer) const = 0;
virtual Paint* duplicate() = 0;
+ virtual Iterator* iterator() = 0;
};
struct Paint::Impl
{
StrategyMethod* smethod = nullptr;
- RenderTransform *rTransform = nullptr;
- uint32_t flag = RenderUpdateFlag::None;
+ RenderTransform* rTransform = nullptr;
+ uint32_t renderFlag = RenderUpdateFlag::None;
Paint* cmpTarget = nullptr;
CompositeMethod cmpMethod = CompositeMethod::None;
+ uint32_t ctxFlag = ContextFlag::Invalid;
+ uint32_t id;
uint8_t opacity = 255;
- PaintType type;
~Impl() {
if (cmpTarget) delete(cmpTarget);
if (!rTransform) return false;
}
rTransform->override(m);
- flag |= RenderUpdateFlag::Transform;
+ renderFlag |= RenderUpdateFlag::Transform;
return true;
}
return nullptr;
}
- bool bounds(float* x, float* y, float* w, float* h) const
- {
- return smethod->bounds(x, y, w, h);
- }
-
RenderRegion bounds(RenderMethod& renderer) const
{
return smethod->bounds(renderer);
return smethod->dispose(renderer);
}
+ Iterator* iterator()
+ {
+ return smethod->iterator();
+ }
+
bool composite(Paint* target, CompositeMethod method)
{
if ((!target && method != CompositeMethod::None) || (target && method == CompositeMethod::None)) return false;
bool rotate(float degree);
bool scale(float factor);
bool translate(float x, float y);
+ bool bounds(float* x, float* y, float* w, float* h, bool transformed);
void* update(RenderMethod& renderer, const RenderTransform* pTransform, uint32_t opacity, Array<RenderData>& clips, uint32_t pFlag);
bool render(RenderMethod& renderer);
Paint* duplicate();
PaintMethod(T* _inst) : inst(_inst) {}
~PaintMethod() {}
- bool bounds(float* x, float* y, float* w, float* h) const override
+ bool bounds(float* x, float* y, float* w, float* h) override
{
return inst->bounds(x, y, w, h);
}
return inst->dispose(renderer);
}
- void* update(RenderMethod& renderer, const RenderTransform* transform, uint32_t opacity, Array<RenderData>& clips, RenderUpdateFlag flag) override
+ void* update(RenderMethod& renderer, const RenderTransform* transform, uint32_t opacity, Array<RenderData>& clips, RenderUpdateFlag renderFlag) override
{
- return inst->update(renderer, transform, opacity, clips, flag);
+ return inst->update(renderer, transform, opacity, clips, renderFlag);
}
bool render(RenderMethod& renderer) override
{
return inst->duplicate();
}
+
+ Iterator* iterator() override
+ {
+ return inst->iterator();
+ }
};
}