skia2/tools/sk_app/WindowContext.h
Brian Salomon 18c52a7b52 Revert "Revert "Revert "Redefine the meaning of sample counts in GPU backend."""
This reverts commit d0d7270fcc.

Revert "More sample count cleanup:"

This reverts commit d653cac70e.

Revert "Add new GrContext queries for imagability, surfacability, and max sample count of color types"

This reverts commit 85ae7159c9.


Need to understand NVPR perf changes before relanding

Change-Id: I0db075fb42438ef2a1f9885df184dce52892ac4b
Reviewed-on: https://skia-review.googlesource.com/102780
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2018-02-02 12:19:52 +00:00

76 lines
1.9 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 WindowContext_DEFINED
#define WindowContext_DEFINED
#include "DisplayParams.h"
#include "GrContext.h"
#include "GrTypes.h"
#include "SkRefCnt.h"
#include "SkSurfaceProps.h"
class SkSurface;
class GrRenderTarget;
namespace sk_app {
class WindowContext {
public:
WindowContext(const DisplayParams& params)
: fContext(nullptr)
, fDisplayParams(params)
, fSurfaceProps(SkSurfaceProps::kLegacyFontHost_InitType)
, fSampleCount(0)
, fStencilBits(0) {}
virtual ~WindowContext() {}
virtual sk_sp<SkSurface> getBackbufferSurface() = 0;
virtual void swapBuffers() = 0;
virtual bool isValid() = 0;
virtual void resize(int w, int h) = 0;
const DisplayParams& getDisplayParams() { return fDisplayParams; }
virtual void setDisplayParams(const DisplayParams& params) = 0;
SkSurfaceProps getSurfaceProps() const { return fSurfaceProps; }
void setSurfaceProps(const SkSurfaceProps& props) {
fSurfaceProps = props;
}
virtual GrBackendContext getBackendContext() = 0;
GrContext* getGrContext() const { return fContext.get(); }
int width() const { return fWidth; }
int height() const { return fHeight; }
int sampleCount() const { return fSampleCount; }
int stencilBits() const { return fStencilBits; }
protected:
virtual bool isGpuContext() { return true; }
sk_sp<GrContext> fContext;
int fWidth;
int fHeight;
DisplayParams fDisplayParams;
SkSurfaceProps fSurfaceProps;
// parameters obtained from the native window
// Note that the platform .cpp file is responsible for
// initializing fSampleCount and fStencilBits!
int fSampleCount;
int fStencilBits;
};
} // namespace sk_app
#endif