Changeset - r22016:c479d9747192
[Not reviewed]
master
0 1 0
frosch - 9 years ago 2015-02-28 20:09:49
frosch@openttd.org
(svn r27173) -Fix [FS#6237] (r27134): Use the regular clipping functions in the sprite aligner instead of some magic.
1 file changed with 12 insertions and 12 deletions:
0 comments (0 inline, 0 general)
src/newgrf_debug_gui.cpp
Show inline comments
 
@@ -856,20 +856,20 @@ struct SpriteAlignerWindow : Window {
 
			case WID_SA_SPRITE: {
 
				/* Center the sprite ourselves */
 
				const Sprite *spr = GetSprite(this->current_sprite, ST_NORMAL);
 
				int width  = r.right  - r.left + 1;
 
				int height = r.bottom - r.top  + 1;
 
				int x = r.left - UnScaleGUI(spr->x_offs) + (width  - UnScaleGUI(spr->width) ) / 2;
 
				int y = r.top  - UnScaleGUI(spr->y_offs) + (height - UnScaleGUI(spr->height)) / 2;
 
				int width  = r.right  - r.left + 1 - WD_BEVEL_LEFT - WD_BEVEL_RIGHT;
 
				int height = r.bottom - r.top  + 1 - WD_BEVEL_TOP - WD_BEVEL_BOTTOM;
 
				int x = -UnScaleGUI(spr->x_offs) + (width  - UnScaleGUI(spr->width) ) / 2;
 
				int y = -UnScaleGUI(spr->y_offs) + (height - UnScaleGUI(spr->height)) / 2;
 

	
 
				/* And draw only the part within the sprite area */
 
				SubSprite subspr = {
 
					spr->x_offs + (spr->width  - UnScaleGUI(width) ) / 2 + 1,
 
					spr->y_offs + (spr->height - UnScaleGUI(height)) / 2 + 1,
 
					spr->x_offs + (spr->width  + UnScaleGUI(width) ) / 2 - 1,
 
					spr->y_offs + (spr->height + UnScaleGUI(height)) / 2 - 1,
 
				};
 
				DrawPixelInfo new_dpi;
 
				if (!FillDrawPixelInfo(&new_dpi, r.left + WD_BEVEL_LEFT, r.top + WD_BEVEL_TOP, width, height)) break;
 
				DrawPixelInfo *old_dpi = _cur_dpi;
 
				_cur_dpi = &new_dpi;
 

	
 
				DrawSprite(this->current_sprite, PAL_NONE, x, y, &subspr, ZOOM_LVL_GUI);
 
				DrawSprite(this->current_sprite, PAL_NONE, x, y, NULL, ZOOM_LVL_GUI);
 

	
 
				_cur_dpi = old_dpi;
 

	
 
				break;
 
			}
 

	
0 comments (0 inline, 0 general)