76948d4faa
This isn't wired in anywhere yet. GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1937553002 Committed: https://skia.googlesource.com/skia/+/de5bf0cfeca908b81a28cc50065f7bc2da3d2fd1 Committed: https://skia.googlesource.com/skia/+/92605b35efa0155c44d24bd8415b4cc1db8831db Review-Url: https://codereview.chromium.org/1937553002
73 lines
2.2 KiB
C++
73 lines
2.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 GrSurfaceProxy_DEFINED
|
|
#define GrSurfaceProxy_DEFINED
|
|
|
|
#include "GrGpuResource.h"
|
|
|
|
class GrTextureProxy;
|
|
class GrRenderTargetProxy;
|
|
|
|
class GrSurfaceProxy : public GrIORef<GrSurfaceProxy> {
|
|
public:
|
|
const GrSurfaceDesc& desc() const { return fDesc; }
|
|
|
|
GrSurfaceOrigin origin() const {
|
|
SkASSERT(kTopLeft_GrSurfaceOrigin == fDesc.fOrigin ||
|
|
kBottomLeft_GrSurfaceOrigin == fDesc.fOrigin);
|
|
return fDesc.fOrigin;
|
|
}
|
|
int width() const { return fDesc.fWidth; }
|
|
int height() const { return fDesc.fWidth; }
|
|
GrPixelConfig config() const { return fDesc.fConfig; }
|
|
|
|
uint32_t uniqueID() const { return fUniqueID; }
|
|
|
|
/**
|
|
* @return the texture proxy associated with the surface proxy, may be NULL.
|
|
*/
|
|
virtual GrTextureProxy* asTextureProxy() { return nullptr; }
|
|
virtual const GrTextureProxy* asTextureProxy() const { return nullptr; }
|
|
|
|
/**
|
|
* @return the render target proxy associated with the surface proxy, may be NULL.
|
|
*/
|
|
virtual GrRenderTargetProxy* asRenderTargetProxy() { return nullptr; }
|
|
virtual const GrRenderTargetProxy* asRenderTargetProxy() const { return nullptr; }
|
|
|
|
protected:
|
|
GrSurfaceProxy(const GrSurfaceDesc& desc, SkBackingFit fit, SkBudgeted budgeted)
|
|
: fDesc(desc)
|
|
, fFit(fit)
|
|
, fBudgeted(budgeted)
|
|
, fUniqueID(CreateUniqueID()) {
|
|
}
|
|
|
|
virtual ~GrSurfaceProxy() {}
|
|
|
|
// For wrapped resources, 'fDesc' will always be filled in from the wrapped resource.
|
|
const GrSurfaceDesc fDesc;
|
|
const SkBackingFit fFit; // always exact for wrapped resources
|
|
const SkBudgeted fBudgeted; // set from the backing resource for wrapped resources
|
|
const uint32_t fUniqueID;
|
|
|
|
private:
|
|
static uint32_t CreateUniqueID();
|
|
|
|
// See comment in GrGpuResource.h.
|
|
void notifyAllCntsAreZero(CntType) const { delete this; }
|
|
bool notifyRefCountIsZero() const { return true; }
|
|
|
|
typedef GrIORef<GrSurfaceProxy> INHERITED;
|
|
|
|
// to access notifyAllCntsAreZero and notifyRefCntIsZero.
|
|
friend class GrIORef<GrSurfaceProxy>;
|
|
};
|
|
|
|
#endif
|