skia2/tools/sk_app/ios/Window_ios.h
Brian Osman 6848b716f7 Fix flicker when changing backend on iOS viewer
This is the same fix from: https://skia-review.googlesource.com/c/skia/+/107941

Change-Id: I1367b1fc466cecbc2733b4e337376ce9f48cb6d8
Reviewed-on: https://skia-review.googlesource.com/107980
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2018-02-16 15:31:36 +00:00

67 lines
1.3 KiB
C++

/*
* Copyright 2017 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef Window_ios_DEFINED
#define Window_ios_DEFINED
#include "../Window.h"
#include "SkChecksum.h"
#include "SkTDynamicHash.h"
#include "SDL.h"
namespace sk_app {
class Window_ios : public Window {
public:
Window_ios()
: INHERITED()
, fWindow(nullptr)
, fWindowID(0)
, fGLContext(nullptr)
, fMSAASampleCount(1) {}
~Window_ios() override { this->closeWindow(); }
bool initWindow();
void setTitle(const char*) override;
void show() override;
bool attach(BackendType) override;
void onInval() override;
static bool HandleWindowEvent(const SDL_Event& event);
static const Uint32& GetKey(const Window_ios& w) {
return w.fWindowID;
}
static uint32_t Hash(const Uint32& winID) {
return winID;
}
private:
bool handleEvent(const SDL_Event& event);
void closeWindow();
static SkTDynamicHash<Window_ios, Uint32> gWindowMap;
SDL_Window* fWindow;
Uint32 fWindowID;
SDL_GLContext fGLContext;
int fMSAASampleCount;
typedef Window INHERITED;
};
} // namespace sk_app
#endif