@@ -51,20 +51,6 @@ static void checkWindowSize(GLFWwindow *window, int expectedWidth, int expectedH
51
51
assert (fbw == (int ) (expectedWidth * ratio ) && fbh == (int ) (expectedHeight * ratio ));
52
52
}
53
53
54
- static void checkCanvasSize (int expectedWidth , int expectedHeight ) {
55
- int w , h ;
56
- emscripten_get_canvas_element_size ("#canvas" , & w , & h );
57
- printf ("canvas size => %d == %d && %d == %d\n" , w , expectedWidth , h , expectedHeight );
58
- assert (w == expectedWidth && h == expectedHeight );
59
- }
60
-
61
- static void checkCanvasFramebufferSize (int expectedWidth , int expectedHeight ) {
62
- double fbw , fbh ;
63
- emscripten_get_element_css_size ("#canvas" , & fbw , & fbh );
64
- printf ("canvas framebufferSize => %d == %d && %d == %d\n" , (int ) fbw , (int ) expectedWidth , (int ) fbh , expectedHeight );
65
- assert ((int ) fbw == expectedWidth && (int ) fbh == expectedHeight );
66
- }
67
-
68
54
static bool getGLFWIsHiDPIAware () {
69
55
return EM_ASM_INT (return GLFW .isHiDPIAware () ? 1 : 0 ) != 0 ;
70
56
}
@@ -89,17 +75,13 @@ int main() {
89
75
// Expected outcome is window size and frame buffer size are the same
90
76
{
91
77
printf ("Use case #1\n" );
92
- checkCanvasSize (300 , 150 ); // 300x150 is the default canvas size
93
- checkCanvasFramebufferSize (300 , 150 );
94
78
window = glfwCreateWindow (640 , 480 , "test_glfw3_hi_dpi_aware.c | #1" , NULL , NULL );
95
79
assert (window != NULL );
96
80
checkHiDPIAware (window , false);
97
81
checkWindowSize (window , 640 , 480 , 1.0 );
98
82
glfwSetWindowSize (window , 600 , 400 );
99
83
checkWindowSize (window , 600 , 400 , 1.0 );
100
84
glfwDestroyWindow (window );
101
- checkCanvasSize (300 , 150 ); // we make sure that the glfw code resets the canvas how it was
102
- checkCanvasFramebufferSize (300 , 150 );
103
85
}
104
86
105
87
// Use case 2: GLFW is NOT Hi DPI Aware | devicePixelRatio is 2.0
@@ -192,24 +174,6 @@ int main() {
192
174
glfwDestroyWindow (window );
193
175
}
194
176
195
- // Use case 8: GLFW is Hi DPI Aware | devicePixelRatio is 2.0 | canvas has css override
196
- // Expected outcome is that the framebuffer size is adjusted according to the canvas size
197
- {
198
- printf ("Use case #8\n" );
199
- setDevicePixelRatio (2.0 );
200
- glfwWindowHint (GLFW_SCALE_TO_MONITOR , GLFW_TRUE );
201
- emscripten_set_element_css_size ("#canvas" , 700 , 525 );
202
- checkCanvasSize (300 , 150 ); // default canvas size
203
- checkCanvasFramebufferSize (700 , 525 ); // css override
204
- window = glfwCreateWindow (640 , 480 , "test_glfw3_hi_dpi_aware.c | #8" , NULL , NULL );
205
- assert (window != NULL );
206
- checkHiDPIAware (window , true);
207
- checkWindowSize (window , 700 , 525 , 2.0 ); // canvas size overrides window size
208
- glfwDestroyWindow (window );
209
- checkCanvasSize (300 , 150 );
210
- checkCanvasFramebufferSize (700 , 525 );
211
- }
212
-
213
177
glfwTerminate ();
214
178
215
179
return 0 ;
0 commit comments