skia2/tools/sk_app/mac/WindowContextFactory_mac.h
Brian Osman 4013db8e08 Fix flicker when changing backend on Mac viewer
Tie the SDL GL context to the Window, not the context. Deleting the context
causes the window to render a frame of black - this keeps the context alive
along with the window, so that never happens.

Change-Id: Id4df18a6f2fe09f617ec2ff1809d000f18f547ba
Reviewed-on: https://skia-review.googlesource.com/107941
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2018-02-15 19:14:32 +00:00

40 lines
792 B
C++

/*
* Copyright 2016 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef WindowContextFactory_mac_DEFINED
#define WindowContextFactory_mac_DEFINED
#include "SDL.h"
namespace sk_app {
class WindowContext;
struct DisplayParams;
namespace window_context_factory {
struct MacWindowInfo {
SDL_Window* fWindow;
SDL_GLContext fGLContext;
};
inline WindowContext* NewVulkanForMac(const MacWindowInfo&, const DisplayParams&) {
// No Vulkan support on Mac.
return nullptr;
}
WindowContext* NewGLForMac(const MacWindowInfo&, const DisplayParams&);
WindowContext* NewRasterForMac(const MacWindowInfo&, const DisplayParams&);
} // namespace window_context_factory
} // namespace sk_app
#endif