mirror of https://github.com/aseprite/aseprite.git
				
				
				
			Fix color problems with overlays (fix #1914)
There were two problems: 1) Overlays weren't using the screen color space, so restoring the pixels were modifying the original saved area 2) A custom cursor (when "Use native cursors" option were enabled) was using overlays, when we could use a native custom cursor anyway (without overlays)
This commit is contained in:
		
							parent
							
								
									b36d3b09e2
								
							
						
					
					
						commit
						d32d8bf938
					
				|  | @ -78,8 +78,12 @@ void Overlay::captureOverlappedArea(os::Surface* screen) | |||
|   if (!m_surface) | ||||
|     return; | ||||
| 
 | ||||
|   if (!m_overlap) | ||||
|     m_overlap = os::instance()->createSurface(m_surface->width(), m_surface->height()); | ||||
|   if (!m_overlap) { | ||||
|     // Use the same color space for the overlay as in the screen
 | ||||
|     m_overlap = os::instance()->createSurface(m_surface->width(), | ||||
|                                               m_surface->height(), | ||||
|                                               screen->colorSpace()); | ||||
|   } | ||||
| 
 | ||||
|   os::SurfaceLock lock(m_overlap); | ||||
|   screen->blitTo(m_overlap, m_pos.x, m_pos.y, 0, 0, | ||||
|  |  | |||
|  | @ -82,8 +82,7 @@ static bool update_custom_native_cursor(const Cursor* cursor) | |||
|   bool result = false; | ||||
| 
 | ||||
|   // Check if we can use a custom native mouse in this platform
 | ||||
|   if (!use_native_mouse_cursor && | ||||
|       support_native_custom_cursor && | ||||
|   if (support_native_custom_cursor && | ||||
|       mouse_display) { | ||||
|     if (cursor) { | ||||
|       result = mouse_display->setNativeMouseCursor( | ||||
|  | @ -167,7 +166,8 @@ static void update_mouse_cursor() | |||
|   } | ||||
| 
 | ||||
|   // Try to use a custom native cursor if it's possible
 | ||||
|   if (!update_custom_native_cursor(cursor)) { | ||||
|   if (nativeCursor == os::kNoCursor && | ||||
|       !update_custom_native_cursor(cursor)) { | ||||
|     // Or an overlay as last resource
 | ||||
|     update_mouse_overlay(cursor); | ||||
|   } | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue