Commit 264b81b48156852c2a6168fb72af76746cdd8555

Ryan C. Gordon 2018-09-06T00:56:13

metal: Make sure layer drawableSize is adjusted on resize. Fixes Bugzilla #4250.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
diff --git a/src/render/metal/SDL_render_metal.m b/src/render/metal/SDL_render_metal.m
index 5afedab..10c585b 100644
--- a/src/render/metal/SDL_render_metal.m
+++ b/src/render/metal/SDL_render_metal.m
@@ -752,8 +752,12 @@ METAL_ActivateRenderCommandEncoder(SDL_Renderer * renderer, MTLLoadAction load)
 static void
 METAL_WindowEvent(SDL_Renderer * renderer, const SDL_WindowEvent *event)
 {
-    if (event->event == SDL_WINDOWEVENT_SIZE_CHANGED ||
-        event->event == SDL_WINDOWEVENT_SHOWN ||
+    if (event->event == SDL_WINDOWEVENT_SIZE_CHANGED) {
+        METAL_RenderData *data = (__bridge METAL_RenderData *) renderer->driverdata;
+        data.mtllayer.drawableSize = CGSizeMake(event->data1, event->data2);
+    }
+
+    if (event->event == SDL_WINDOWEVENT_SHOWN ||
         event->event == SDL_WINDOWEVENT_HIDDEN) {
         // !!! FIXME: write me
     }