|
1234567891011121314151617181920212223242526272829303132333435363738394041 |
- #pragma once
- #include <widget/Widget.hpp>
-
-
- namespace rack {
- namespace widget {
-
-
- /** Caches a widget's draw() result to a framebuffer so it is called less frequently.
- When `dirty` is true, its children will be re-rendered on the next call to step().
- Events are not passed to the underlying scene.
- */
- struct FramebufferWidget : Widget {
- struct Internal;
- Internal* internal;
-
- /** Set this to true to re-render the children to the framebuffer the next time it is drawn */
- bool dirty = true;
- bool bypassed = false;
- float oversample = 1.0;
- /** Redraw when the world offset of the FramebufferWidget changes its fractional value. */
- bool dirtyOnSubpixelChange = true;
-
- FramebufferWidget();
- ~FramebufferWidget();
- void setDirty(bool dirty = true);
- void onDirty(const DirtyEvent& e) override;
- void step() override;
- void draw(const DrawArgs& args) override;
- virtual void drawFramebuffer();
- int getImageHandle();
- NVGLUframebuffer* getFramebuffer();
- math::Vec getFramebufferSize();
- void setScale(math::Vec scale);
- void onContextCreate(const ContextCreateEvent& e) override;
- void onContextDestroy(const ContextDestroyEvent& e) override;
- };
-
-
- } // namespace widget
- } // namespace rack
|