]> git.sesse.net Git - movit/commitdiff
Allow setting width/height on FlatInput and YCbCrInput after instantiation.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 21 Nov 2015 20:32:29 +0000 (21:32 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 21 Nov 2015 20:32:29 +0000 (21:32 +0100)
flat_input.h
util.cpp
version.h
ycbcr_input.cpp
ycbcr_input.h

index 14f8df16b82c853a9ad7bcf8b05301789cc202a2..d8b62b7ec369b4ecf4272bd90cbf89fa4933bf08 100644 (file)
@@ -107,6 +107,20 @@ public:
 
        void invalidate_pixel_data();
 
 
        void invalidate_pixel_data();
 
+       // Note: Sets pitch to width, so even if your pitch is unchanged,
+       // you will need to re-set it after this call.
+       void set_width(unsigned width)
+       {
+               this->pitch = this->width = width;
+               invalidate_pixel_data();
+       }
+
+       void set_height(unsigned height)
+       {
+               this->height = height;
+               invalidate_pixel_data();
+       }
+
        void set_pitch(unsigned pitch) {
                this->pitch = pitch;
                invalidate_pixel_data();
        void set_pitch(unsigned pitch) {
                this->pitch = pitch;
                invalidate_pixel_data();
index 9c077e92909d639f203299b3162f805c8bd975e3..d50039993bafc08853fe1278803f053212521f71 100644 (file)
--- a/util.cpp
+++ b/util.cpp
@@ -334,11 +334,11 @@ void *get_gl_context_identifier()
 #elif defined(WIN32)
        return (void *)wglGetCurrentContext();
 #else
 #elif defined(WIN32)
        return (void *)wglGetCurrentContext();
 #else
-       void *ret = (void *)glXGetCurrentContext();
+       void *ret = (void *)eglGetCurrentContext();
        if (ret != NULL) {
                return ret;
        }
        if (ret != NULL) {
                return ret;
        }
-       return (void *)eglGetCurrentContext();
+       return (void *)glXGetCurrentContext();
 #endif
 }
 
 #endif
 }
 
index c23d0e238752b34bb4672757770de08bfcdc68d0..87be6406e67bebedf2be83aecc19bc206f410816 100644 (file)
--- a/version.h
+++ b/version.h
@@ -5,6 +5,6 @@
 // changes, even within git versions. There is no specific version
 // documentation outside the regular changelogs, though.
 
 // changes, even within git versions. There is no specific version
 // documentation outside the regular changelogs, though.
 
-#define MOVIT_VERSION 11
+#define MOVIT_VERSION 12
 
 #endif // !defined(_MOVIT_VERSION_H)
 
 #endif // !defined(_MOVIT_VERSION_H)
index 4c824c6d092ddc94617a2ecf18e96be4c3a51202..071ce134833151b33bbb9cce800c1971143106dc 100644 (file)
@@ -30,15 +30,8 @@ YCbCrInput::YCbCrInput(const ImageFormat &image_format,
        pbos[0] = pbos[1] = pbos[2] = 0;
        texture_num[0] = texture_num[1] = texture_num[2] = 0;
 
        pbos[0] = pbos[1] = pbos[2] = 0;
        texture_num[0] = texture_num[1] = texture_num[2] = 0;
 
-       assert(width % ycbcr_format.chroma_subsampling_x == 0);
-       pitch[0] = widths[0] = width;
-       pitch[1] = widths[1] = width / ycbcr_format.chroma_subsampling_x;
-       pitch[2] = widths[2] = width / ycbcr_format.chroma_subsampling_x;
-
-       assert(height % ycbcr_format.chroma_subsampling_y == 0);
-       heights[0] = height;
-       heights[1] = height / ycbcr_format.chroma_subsampling_y;
-       heights[2] = height / ycbcr_format.chroma_subsampling_y;
+       set_width(width);
+       set_height(height);
 
        pixel_data[0] = pixel_data[1] = pixel_data[2] = NULL;
        owns_texture[0] = owns_texture[1] = owns_texture[2] = false;
 
        pixel_data[0] = pixel_data[1] = pixel_data[2] = NULL;
        owns_texture[0] = owns_texture[1] = owns_texture[2] = false;
index 6f4b66d437b1e5cc140e0fa10264bbc24115f6f2..3aed51b3b19a90d9e0b0e03e6cfdc16fcfab726f 100644 (file)
@@ -79,7 +79,32 @@ public:
 
        void invalidate_pixel_data();
 
 
        void invalidate_pixel_data();
 
-       void set_pitch(unsigned channel, unsigned pitch) {
+       // Note: Sets pitch to width, so even if your pitch is unchanged,
+       // you will need to re-set it after this call.
+       void set_width(unsigned width)
+       {
+               this->width = width;
+
+               assert(width % ycbcr_format.chroma_subsampling_x == 0);
+               pitch[0] = widths[0] = width;
+               pitch[1] = widths[1] = width / ycbcr_format.chroma_subsampling_x;
+               pitch[2] = widths[2] = width / ycbcr_format.chroma_subsampling_x;
+               invalidate_pixel_data();
+       }
+
+       void set_height(unsigned height)
+       {
+               this->height = height;
+
+               assert(height % ycbcr_format.chroma_subsampling_y == 0);
+               heights[0] = height;
+               heights[1] = height / ycbcr_format.chroma_subsampling_y;
+               heights[2] = height / ycbcr_format.chroma_subsampling_y;
+               invalidate_pixel_data();
+       }
+
+       void set_pitch(unsigned channel, unsigned pitch)
+       {
                assert(channel >= 0 && channel < num_channels);
                this->pitch[channel] = pitch;
                invalidate_pixel_data();
                assert(channel >= 0 && channel < num_channels);
                this->pitch[channel] = pitch;
                invalidate_pixel_data();