skia2/tools/sk_app/mac/Window_mac.h
Jim Van Verth 3e8392e42c Manage Mac paint events more directly.
Trying to shuttle our paint events through the Mac event system seems
to be causing a number of problems, one being that we're refreshing
too often. This works around that by tracking the invalidation flag
per window.

Bug: skia:8737
Change-Id: Ib1b8041f1d9299ff366747831a466439bfd0db29
Reviewed-on: https://skia-review.googlesource.com/c/190673
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2019-02-08 20:35:00 +00:00

52 lines
971 B
Objective-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 Window_mac_DEFINED
#define Window_mac_DEFINED
#include "../Window.h"
#import <Cocoa/Cocoa.h>
namespace sk_app {
class Window_mac : public Window {
public:
static SkTDArray<Window_mac*> gActiveWindows;
Window_mac()
: INHERITED()
, fWindow(nil)
, fMSAASampleCount(1) {}
~Window_mac() override {
this->closeWindow();
}
bool initWindow();
void setTitle(const char*) override;
void show() override;
bool attach(BackendType) override;
void onInval() override {}
bool needsPaint() { return this->fIsContentInvalidated; }
NSView* view() { return [fWindow contentView]; }
void closeWindow();
private:
NSWindow* fWindow;
int fMSAASampleCount;
typedef Window INHERITED;
};
} // namespace sk_app
#endif