metal: Make sure layer drawableSize is adjusted on resize.
authorRyan C. Gordon <icculus@icculus.org>
Thu, 06 Sep 2018 00:56:13 -0400
changeset 12179c06be57c5a01
parent 12178 3136903f2edc
child 12180 a3c2b6e89522
child 12207 9387c6ce977c
metal: Make sure layer drawableSize is adjusted on resize.

Fixes Bugzilla #4250.
src/render/metal/SDL_render_metal.m
     1.1 --- a/src/render/metal/SDL_render_metal.m	Wed Sep 05 21:24:13 2018 -0400
     1.2 +++ b/src/render/metal/SDL_render_metal.m	Thu Sep 06 00:56:13 2018 -0400
     1.3 @@ -752,8 +752,12 @@
     1.4  static void
     1.5  METAL_WindowEvent(SDL_Renderer * renderer, const SDL_WindowEvent *event)
     1.6  {
     1.7 -    if (event->event == SDL_WINDOWEVENT_SIZE_CHANGED ||
     1.8 -        event->event == SDL_WINDOWEVENT_SHOWN ||
     1.9 +    if (event->event == SDL_WINDOWEVENT_SIZE_CHANGED) {
    1.10 +        METAL_RenderData *data = (__bridge METAL_RenderData *) renderer->driverdata;
    1.11 +        data.mtllayer.drawableSize = CGSizeMake(event->data1, event->data2);
    1.12 +    }
    1.13 +
    1.14 +    if (event->event == SDL_WINDOWEVENT_SHOWN ||
    1.15          event->event == SDL_WINDOWEVENT_HIDDEN) {
    1.16          // !!! FIXME: write me
    1.17      }