@@ -13,18 +13,18 @@ CCanvasWindow canvasWindow;
1313/* FUNCTIONS ********************************************************/
1414
1515HCURSOR
16- CStyledCursor::CreateStyledCursor (BrushStyle style, INT radius, COLORREF color, BOOL is_rubber)
16+ CStyledCursor::CreateStyledCursor (BrushStyle style, INT zoom, INT radius, COLORREF color, BOOL is_rubber)
1717{
1818 const INT diameter = 2 * radius;
19- if (diameter <= 2 )
19+ if (diameter * zoom / DEFAULT_ZOOM <= 2 )
2020 {
2121 HCURSOR hCursor = ::LoadCursor (NULL , IDC_CROSS );
2222 return hCursor ? CopyCursor (hCursor) : NULL ;
2323 }
2424
2525 const INT crosshair1 = 6 , crosshair2 = crosshair1 - 2 ;
2626 const INT width = diameter + 2 * crosshair1, height = diameter + 2 * crosshair1;
27- const DWORD hotX = width / 2 , hotY = height / 2 ;
27+ DWORD hotX = width / 2 , hotY = height / 2 ;
2828
2929 HDC hdcScreen = ::GetDC (NULL );
3030 if (!hdcScreen)
@@ -116,6 +116,20 @@ CStyledCursor::CreateStyledCursor(BrushStyle style, INT radius, COLORREF color,
116116 ::ReleaseDC (NULL , hdcScreen);
117117 ::DeleteDC (hdcMem);
118118
119+ if (zoom != DEFAULT_ZOOM )
120+ {
121+ INT newWidth = width * zoom / DEFAULT_ZOOM ;
122+ INT newHeight = height * zoom / DEFAULT_ZOOM ;
123+ HBITMAP hbmMaskNew = CopyMonoImage (hbmMask, newWidth, newHeight, STRETCH_DELETESCANS );
124+ HBITMAP hbmColorNew = CopyDIBImage (hbmColor, newWidth, newHeight, STRETCH_DELETESCANS );
125+ ::DeleteObject (hbmMask);
126+ ::DeleteObject (hbmColor);
127+ hbmMask = hbmMaskNew;
128+ hbmColor = hbmColorNew;
129+ hotX = width * zoom / (2 * DEFAULT_ZOOM );
130+ hotY = height * zoom / (2 * DEFAULT_ZOOM );
131+ }
132+
119133 ICONINFO ii = { FALSE , hotX, hotY, hbmMask, hbmColor };
120134 HCURSOR hCursor = (HCURSOR )::CreateIconIndirect (&ii);
121135
@@ -125,9 +139,13 @@ CStyledCursor::CreateStyledCursor(BrushStyle style, INT radius, COLORREF color,
125139 return hCursor;
126140}
127141
128- void CStyledCursor::SetStyle (BrushStyle style, INT radius, COLORREF color, BOOL is_rubber)
142+ void CStyledCursor::SetStyle (BrushStyle style, INT zoom, INT radius, COLORREF color, BOOL is_rubber)
129143{
130- if (m_hCursor && m_style == style && m_radius == radius && m_color == color &&
144+ if (m_hCursor &&
145+ m_style == style &&
146+ m_zoom == zoom &&
147+ m_radius == radius &&
148+ m_color == color &&
131149 m_is_rubber == is_rubber)
132150 {
133151 return ;
@@ -136,8 +154,9 @@ void CStyledCursor::SetStyle(BrushStyle style, INT radius, COLORREF color, BOOL
136154 if (m_hCursor)
137155 DestroyCursor (m_hCursor);
138156
139- m_hCursor = CreateStyledCursor (style, radius, color, is_rubber);
157+ m_hCursor = CreateStyledCursor (style, zoom, radius, color, is_rubber);
140158 m_style = style;
159+ m_zoom = zoom;
141160 m_radius = radius;
142161 m_color = color;
143162 m_is_rubber = is_rubber;
@@ -775,14 +794,17 @@ LRESULT CCanvasWindow::OnSetCursor(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL
775794 break ;
776795 case TOOL_RUBBER :
777796 {
778- m_hRubberCursor.SetStyle (BrushStyleSquare, toolsModel.GetRubberRadius (),
797+ m_hRubberCursor.SetStyle (BrushStyleSquare,
798+ toolsModel.GetZoom (),
799+ toolsModel.GetRubberRadius (),
779800 paletteModel.GetBgColor (), TRUE );
780801 m_hRubberCursor.SetCursor ();
781802 break ;
782803 }
783804 case TOOL_BRUSH :
784805 {
785806 m_hBrushCursor.SetStyle (toolsModel.GetBrushStyle (),
807+ toolsModel.GetZoom (),
786808 toolsModel.GetBrushWidth () / 2 ,
787809 paletteModel.GetFgColor (), FALSE );
788810 m_hBrushCursor.SetCursor ();
0 commit comments