f750fbcb69
WindowContext still supports color spaces, but not other color types. Any off-screen rendering is the app's responsibility. This change also adds (working) F16 support to viewer. Note that the previous 10-bit and FP16 support in WindowContext was broken. There was no code to push the off-screen canvas to the window. If you ever made it to the unreachable off-screen code path in createSurface, it would have simply stopped drawing. The decision to limit the window's gamut to sRGB is mostly driven by my desire to add real-time editing of gamut. This design lets us do that, without tearing down and rebuilding the window for every change. An application could still supply a different gamut via setDisplayParams and render directly to the back buffer with proper color correction. BUG=skia: Change-Id: I94df35c7a42faee396009acc83683e40bb3c284d Reviewed-on: https://skia-review.googlesource.com/8153 Reviewed-by: Jim Van Verth <jvanverth@google.com> Reviewed-by: Matt Sarett <msarett@google.com> Commit-Queue: Brian Osman <brianosman@google.com>
62 lines
1.4 KiB
C++
62 lines
1.4 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 "GrTypes.h"
|
|
#include "SkRefCnt.h"
|
|
#include "SkSurfaceProps.h"
|
|
|
|
class GrContext;
|
|
class SkSurface;
|
|
class GrRenderTarget;
|
|
|
|
namespace sk_app {
|
|
|
|
class WindowContext {
|
|
public:
|
|
WindowContext() : fContext(nullptr)
|
|
, fSurfaceProps(SkSurfaceProps::kLegacyFontHost_InitType) {}
|
|
|
|
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; }
|
|
|
|
protected:
|
|
virtual bool isGpuContext() { return true; }
|
|
|
|
GrContext* fContext;
|
|
|
|
int fWidth;
|
|
int fHeight;
|
|
DisplayParams fDisplayParams;
|
|
GrPixelConfig fPixelConfig;
|
|
SkSurfaceProps fSurfaceProps;
|
|
};
|
|
|
|
} // namespace sk_app
|
|
|
|
#endif
|