sdl2: stop flickering
Optimizing updates by copying the dirty rectangle only do not work because of double-buffering. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com>
This commit is contained in:
		
							parent
							
								
									c046d82844
								
							
						
					
					
						commit
						136a8d9d44
					
				
							
								
								
									
										13
									
								
								ui/sdl2-2d.c
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								ui/sdl2-2d.c
									
									
									
									
									
								
							@ -45,10 +45,23 @@ void sdl2_2d_update(DisplayChangeListener *dcl,
 | 
				
			|||||||
        return;
 | 
					        return;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /*
 | 
				
			||||||
 | 
					     * SDL2 seems to do some double-buffering, and trying to only
 | 
				
			||||||
 | 
					     * update the changed areas results in only one of the two buffers
 | 
				
			||||||
 | 
					     * being updated.  Which flickers alot.  So lets not try to be
 | 
				
			||||||
 | 
					     * clever do a full update every time ...
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					#if 0
 | 
				
			||||||
    rect.x = x;
 | 
					    rect.x = x;
 | 
				
			||||||
    rect.y = y;
 | 
					    rect.y = y;
 | 
				
			||||||
    rect.w = w;
 | 
					    rect.w = w;
 | 
				
			||||||
    rect.h = h;
 | 
					    rect.h = h;
 | 
				
			||||||
 | 
					#else
 | 
				
			||||||
 | 
					    rect.x = 0;
 | 
				
			||||||
 | 
					    rect.y = 0;
 | 
				
			||||||
 | 
					    rect.w = surface_width(surf);
 | 
				
			||||||
 | 
					    rect.h = surface_height(surf);
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    SDL_UpdateTexture(scon->texture, NULL, surface_data(surf),
 | 
					    SDL_UpdateTexture(scon->texture, NULL, surface_data(surf),
 | 
				
			||||||
                      surface_stride(surf));
 | 
					                      surface_stride(surf));
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user