add asset max wxh and max texture tests, fix position clamp for single frame assets
[goodguy/cinelerra.git] / cinelerra-5.1 / guicast / bcdisplayinfo.C
index 489d1314a6242e49c79195a3fd7776a6c0f6b823..62d58338fd648ba13844e17b19b7c5c3189b9608 100644 (file)
@@ -41,6 +41,7 @@ int BC_DisplayInfo::bottom_border = -1;
 int BC_DisplayInfo::right_border = -1;
 int BC_DisplayInfo::auto_reposition_x = -1;
 int BC_DisplayInfo::auto_reposition_y = -1;
+int BC_DisplayInfo::gl_max_texture_size = -1;
 char BC_DisplayInfo::gl_shader_version[64] = { 0, };
 
 BC_DisplayInfo::BC_DisplayInfo(const char *display_name, int show_error)
@@ -114,6 +115,21 @@ int BC_DisplayInfo::xinerama_geometry(int screen, int &x, int &y, int &w, int &h
        return 0;
 }
 
+int BC_DisplayInfo::xinerama_big_screen()
+{
+       int screens = get_xinerama_screens();
+       int best = 0, ret = -1;
+       for( int k=screens; --k>=0; ) {
+               int w = xinerama_info[k].width, h = xinerama_info[k].height;
+               int sz = w * h;
+               if( sz > best ) {
+                       ret = xinerama_info[k].screen_number;
+                       best = sz;
+               }
+       }
+       return ret;
+}
+
 static void get_top_coords(Display *display, Window win, int &px,int &py, int &tx,int &ty)
 {
        Window *pcwin = 0;  unsigned int ncwin = 0;
@@ -225,6 +241,8 @@ int BC_DisplayInfo::gl_probe(Window win)
                if( shader_version )
                        strncpy(gl_shader_version, shader_version, sizeof(gl_shader_version));
        }
+       gl_max_texture_size = 0;
+       glGetIntegerv(GL_MAX_TEXTURE_SIZE, &gl_max_texture_size);
        glXMakeContextCurrent(display, None, None, 0);
        if( glx_ctx ) glXDestroyContext(display, glx_ctx);
        if( glx_win ) glXDestroyWindow(display, glx_win);
@@ -373,6 +391,12 @@ int BC_DisplayInfo::get_bottom_border()
        return bottom_border;
 }
 
+int BC_DisplayInfo::get_gl_max_texture_size()
+{
+       init_borders();
+       return gl_max_texture_size;
+}
+
 const char *BC_DisplayInfo::get_gl_shader_version()
 {
        init_borders();