skia2/tools/sk_app/unix/Window_unix.h
Brian Salomon 3a2cc2c2ec Revert "Revert "Revert "Revert "Revert "Redefine the meaning of sample counts in GPU backend."""""
This reverts commit 5bb82cbecd.

Reason for revert: <INSERT REASONING HERE>

Original change's description:
> Revert "Revert "Revert "Revert "Redefine the meaning of sample counts in GPU backend.""""
> 
> This reverts commit 18c52a7b52.
> 
> Also relands "More sample count cleanup:" and "Add new GrContext queries for imagability, surfacability, and max sample count of color types"
> 
> 
> Bug: skia:
> Change-Id: I4028105a3a1f16ce3944e134619eb6245af6b947
> Reviewed-on: https://skia-review.googlesource.com/102940
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>

TBR=egdaniel@google.com,bsalomon@google.com

Change-Id: Idee23be2f1719f0bdc9305043e95a2d589bee8d1
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/103220
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2018-02-03 00:25:20 +00:00

96 lines
2.1 KiB
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_unix_DEFINED
#define Window_unix_DEFINED
#include <X11/Xlib.h>
#include <GL/glx.h>
#include "../Window.h"
#include "SkChecksum.h"
#include "SkTDynamicHash.h"
typedef Window XWindow;
namespace sk_app {
class Window_unix : public Window {
public:
Window_unix() : Window()
, fDisplay(nullptr)
, fWindow(0)
, fGC(nullptr)
, fFBConfig(nullptr)
, fVisualInfo(nullptr)
, fMSAASampleCount(0) {}
~Window_unix() override { this->closeWindow(); }
bool initWindow(Display* display);
void setTitle(const char*) override;
void show() override;
bool attach(BackendType) override;
void onInval() override;
bool handleEvent(const XEvent& event);
static const XWindow& GetKey(const Window_unix& w) {
return w.fWindow;
}
static uint32_t Hash(const XWindow& w) {
return SkChecksum::Mix(w);
}
static SkTDynamicHash<Window_unix, XWindow> gWindowMap;
void markPendingPaint() { fPendingPaint = true; }
void finishPaint() {
if (fPendingPaint) {
this->onPaint();
fPendingPaint = false;
}
}
void markPendingResize(int width, int height) {
if (width != this->width() || height != this->height()){
fPendingResize = true;
fPendingWidth = width;
fPendingHeight = height;
}
}
void finishResize() {
if (fPendingResize) {
this->onResize(fPendingWidth, fPendingHeight);
fPendingResize = false;
}
}
private:
void closeWindow();
Display* fDisplay;
XWindow fWindow;
GC fGC;
GLXFBConfig* fFBConfig;
XVisualInfo* fVisualInfo;
int fMSAASampleCount;
Atom fWmDeleteMessage;
bool fPendingPaint;
int fPendingWidth;
int fPendingHeight;
bool fPendingResize;
};
} // namespace sk_app
#endif