skia2/tools/sk_app/mac/Window_mac.h
Brian Salomon c1ce2f7966 Revert "Redefine the meaning of sample counts in GPU backend."
This reverts commit 48825b11ad.

Reason for revert: nanobench

Original change's description:
> Redefine the meaning of sample counts in GPU backend.
> 
> Old: 0  -> nonMSAA
>      1+ -> MSAA
> 
> New:
>      0  -> error/unsupported
>      1  -> nonMSAA
>      2+ -> MSAA
> 
> We still allow 0 to mean nonMSAA in three sets of public APIs for backwards compatibility:
> 
> 1) SkSurface factories
> 2) GrBackendRenderTarget constructors
> 3) GrCaps::getSampleCnt()'s requestedCount parameter
> 
> However, we immediately clamp to 1 and treat 0 as invalid/non-renderable internally.
> 
> This also changes the behavior when using a large sample count. We now fail in that case rather than using the largest sample available sample count. GrCaps::getSampleCount() will return 0 in this case.
> 
> 
> Bug: skia:
> Change-Id: Ida22c6b22c1365e563c9046b611e88bf5eb3ff33
> Reviewed-on: https://skia-review.googlesource.com/101560
> Reviewed-by: Greg Daniel <egdaniel@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>

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

Change-Id: Ic257619a8a5ee9ac15419ecf10259e42daed7f82
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/102662
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2018-02-01 18:34:40 +00:00

65 lines
1.2 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_mac_DEFINED
#define Window_mac_DEFINED
#include "../Window.h"
#include "SkChecksum.h"
#include "SkTDynamicHash.h"
#include "SDL.h"
namespace sk_app {
class Window_mac : public Window {
public:
Window_mac()
: INHERITED()
, fWindow(nullptr)
, fWindowID(0)
, fMSAASampleCount(0) {}
~Window_mac() 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_mac& 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_mac, Uint32> gWindowMap;
SDL_Window* fWindow;
Uint32 fWindowID;
int fMSAASampleCount;
typedef Window INHERITED;
};
} // namespace sk_app
#endif