mirror of
				https://github.com/nicbarker/clay.git
				synced 2025-11-04 00:26:17 +00:00 
			
		
		
		
	Change HWND_DESKTOP to NULL in GetDC() calls
At first I liked the idea to use something more semantic to pass as `HWND` to get the screen device context. And there is a HWND_DESKTOP macro which just a simple alias to NULL, but it is actually designed for CreateWindow and naming isn't clear enough. It may confuse someone who reading code that we're trying to get not the screen dc, but that desktop window dc itself. So I won't stand out let it be NULL as that commonly used.
This commit is contained in:
		
							parent
							
								
									b1910a45be
								
							
						
					
					
						commit
						607af63b08
					
				| 
						 | 
					@ -499,7 +499,7 @@ static inline Clay_Dimensions Clay_Win32_MeasureText(Clay_StringSlice text, Clay
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (hFont != NULL)
 | 
					        if (hFont != NULL)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            HDC hScreenDC = GetDC(HWND_DESKTOP);
 | 
					            HDC hScreenDC = GetDC(NULL);
 | 
				
			||||||
            HDC hTempDC = CreateCompatibleDC(hScreenDC);
 | 
					            HDC hTempDC = CreateCompatibleDC(hScreenDC);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (hTempDC != NULL)
 | 
					            if (hTempDC != NULL)
 | 
				
			||||||
| 
						 | 
					@ -560,7 +560,7 @@ HFONT Clay_Win32_SimpleCreateFont(const char* filePath, const char* family, int
 | 
				
			||||||
    // If negative, treat height as Pt rather than pixels
 | 
					    // If negative, treat height as Pt rather than pixels
 | 
				
			||||||
    if (height < 0) {
 | 
					    if (height < 0) {
 | 
				
			||||||
        // Get the screen DPI
 | 
					        // Get the screen DPI
 | 
				
			||||||
        HDC hScreenDC = GetDC(HWND_DESKTOP);
 | 
					        HDC hScreenDC = GetDC(NULL);
 | 
				
			||||||
        int iScreenDPI = GetDeviceCaps(hScreenDC, LOGPIXELSY);
 | 
					        int iScreenDPI = GetDeviceCaps(hScreenDC, LOGPIXELSY);
 | 
				
			||||||
        ReleaseDC(HWND_DESKTOP, hScreenDC);
 | 
					        ReleaseDC(HWND_DESKTOP, hScreenDC);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue