Allow RGB24 in textures.
[dcpomatic.git] / src / wx / gl_video_view.h
index 272198591c3e05f92ba1148570863b4fef1f1658..d7f8429af78c705faff83d831d1cd888be16fa42 100644 (file)
@@ -38,16 +38,19 @@ DCPOMATIC_ENABLE_WARNINGS
 class Texture
 {
 public:
-       Texture ();
+       Texture (GLint unpack_alignment);
        ~Texture ();
 
        Texture (Texture const&) = delete;
        Texture& operator= (Texture const&) = delete;
 
        void bind ();
+       void set (std::shared_ptr<const Image> image);
 
 private:
        GLuint _name;
+       GLint _unpack_alignment;
+       boost::optional<dcp::Size> _size;
 };
 
 
@@ -90,10 +93,37 @@ private:
        wxGLCanvas* _canvas;
        wxGLContext* _context;
 
+       template <class T>
+       class Last
+       {
+       public:
+               void set_next (T const& next) {
+                       _next = next;
+               }
+
+               bool changed () const {
+                       return !_value || *_value != _next;
+               }
+
+               void update () {
+                       _value = _next;
+               }
+
+       private:
+               boost::optional<T> _value;
+               T _next;
+       };
+
+       Last<wxSize> _last_canvas_size;
+       Last<dcp::Size> _last_video_size;
+       Last<Position<int>> _last_inter_position;
+       Last<dcp::Size> _last_inter_size;
+       Last<dcp::Size> _last_out_size;
+
        boost::atomic<wxSize> _canvas_size;
        std::unique_ptr<Texture> _video_texture;
-       boost::optional<dcp::Size> _video_size;
-       bool _have_storage;
+       std::unique_ptr<Texture> _subtitle_texture;
+       bool _have_subtitle_to_render = false;
        bool _vsync_enabled;
        boost::thread _thread;