Inkscape
Vector Graphics Editor
|
A widget that can dynamically switch between a Gtk::DrawingArea and a Gtk::GLArea. More...
#include <optglarea.h>
Public Member Functions | |
OptGLArea () | |
~OptGLArea () override | |
void | set_opengl_enabled (bool) |
Set whether OpenGL is enabled. | |
bool | get_opengl_enabled () const |
void | make_current () |
Call before doing any OpenGL operations to make the context current. | |
void | bind_framebuffer () const |
Call before rendering to the widget to bind the widget's framebuffer. | |
void | snapshot_vfunc (Glib::RefPtr< Gtk::Snapshot > const &snapshot) override |
Protected Member Functions | |
void | on_realize () override |
void | on_unrealize () override |
virtual Glib::RefPtr< Gdk::GLContext > | create_context ()=0 |
Reimplement to create the desired OpenGL context. | |
virtual void | paint_widget (Cairo::RefPtr< Cairo::Context > const &) |
Reimplement to render the widget. | |
Private Member Functions | |
void | init_opengl () |
void | uninit_opengl () |
Private Attributes | |
bool | opengl_enabled = false |
std::shared_ptr< GLState > | gl |
A widget that can dynamically switch between a Gtk::DrawingArea and a Gtk::GLArea.
Based on the source code for both widgets.
Definition at line 19 of file optglarea.h.
|
default |
|
overridedefault |
void Inkscape::UI::Widget::OptGLArea::bind_framebuffer | ( | ) | const |
Call before rendering to the widget to bind the widget's framebuffer.
Definition at line 124 of file optglarea.cpp.
References gl.
Referenced by Inkscape::UI::Widget::Canvas::paint_widget().
|
protectedpure virtual |
Reimplement to create the desired OpenGL context.
Return nullptr on error.
Implemented in Inkscape::UI::Widget::Canvas.
Referenced by init_opengl().
|
inline |
Definition at line 31 of file optglarea.h.
References opengl_enabled.
Referenced by Inkscape::UI::Widget::Canvas::Canvas(), Inkscape::UI::Widget::Canvas::paint_widget(), and Inkscape::UI::Widget::Canvas::set_border().
|
private |
Definition at line 99 of file optglarea.cpp.
References create_context(), gl, and opengl_enabled.
Referenced by on_realize(), and set_opengl_enabled().
void Inkscape::UI::Widget::OptGLArea::make_current | ( | ) |
Call before doing any OpenGL operations to make the context current.
Automatically done before calling paint_widget().
Definition at line 118 of file optglarea.cpp.
References gl.
|
overrideprotected |
Definition at line 79 of file optglarea.cpp.
References init_opengl(), and opengl_enabled.
Referenced by Inkscape::UI::Widget::Canvas::on_realize().
|
overrideprotected |
Definition at line 85 of file optglarea.cpp.
References opengl_enabled, and uninit_opengl().
Referenced by Inkscape::UI::Widget::Canvas::on_unrealize().
|
inlineprotectedvirtual |
Reimplement to render the widget.
The Cairo context is only for when OpenGL is disabled.
Reimplemented in Inkscape::UI::Widget::Canvas.
Definition at line 58 of file optglarea.h.
Referenced by snapshot_vfunc().
void Inkscape::UI::Widget::OptGLArea::set_opengl_enabled | ( | bool | enabled | ) |
Set whether OpenGL is enabled.
Initially it is disabled. Upon enabling it, create_context will be called as soon as the widget is realized. If context creation fails, OpenGL will be disabled again.
Definition at line 91 of file optglarea.cpp.
References init_opengl(), opengl_enabled, and uninit_opengl().
Referenced by Inkscape::UI::Widget::Canvas::Canvas().
|
override |
Definition at line 134 of file optglarea.cpp.
References gl, opengl_enabled, paint_widget(), and Inkscape::size.
Referenced by Inkscape::UI::Widget::TabsWidget::_setTooltip().
|
private |
Definition at line 111 of file optglarea.cpp.
References gl.
Referenced by on_unrealize(), and set_opengl_enabled().
|
private |
Definition at line 64 of file optglarea.h.
Referenced by bind_framebuffer(), init_opengl(), make_current(), snapshot_vfunc(), and uninit_opengl().
|
private |
Definition at line 61 of file optglarea.h.
Referenced by get_opengl_enabled(), init_opengl(), on_realize(), on_unrealize(), set_opengl_enabled(), and snapshot_vfunc().