Add SurfaceProxyView support to Surface/TextureContext.
Bug: skia:9556 Change-Id: I8dfe0a053690acdfdc487cf478e20ea9595d0121 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/249880 Commit-Queue: Greg Daniel <egdaniel@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com>
This commit is contained in:
parent
598741667a
commit
901b98ec55
@ -941,6 +941,10 @@ std::unique_ptr<GrTextureContext> GrDrawingManager::makeTextureContext(
|
||||
|
||||
sk_sp<GrTextureProxy> textureProxy(sk_ref_sp(sProxy->asTextureProxy()));
|
||||
|
||||
GrSurfaceOrigin origin = textureProxy->origin();
|
||||
GrSwizzle texSwizzle = textureProxy->textureSwizzle();
|
||||
|
||||
return std::unique_ptr<GrTextureContext>(new GrTextureContext(
|
||||
fContext, std::move(textureProxy), colorType, alphaType, std::move(colorSpace)));
|
||||
fContext, std::move(textureProxy), colorType, alphaType, std::move(colorSpace), origin,
|
||||
texSwizzle));
|
||||
}
|
||||
|
@ -151,10 +151,9 @@ GrRenderTargetContext::GrRenderTargetContext(GrRecordingContext* context,
|
||||
sk_sp<SkColorSpace> colorSpace,
|
||||
const SkSurfaceProps* surfaceProps,
|
||||
bool managedOpsTask)
|
||||
: GrSurfaceContext(context, colorType, kPremul_SkAlphaType, std::move(colorSpace))
|
||||
: GrSurfaceContext(context, colorType, kPremul_SkAlphaType, std::move(colorSpace), origin,
|
||||
texSwizzle)
|
||||
, fRenderTargetProxy(std::move(rtp))
|
||||
, fOrigin(origin)
|
||||
, fTextureSwizzle(texSwizzle)
|
||||
, fOutputSwizzle(outSwizzle)
|
||||
, fOpsTask(sk_ref_sp(fRenderTargetProxy->getLastOpsTask()))
|
||||
, fSurfaceProps(SkSurfacePropsCopyOrDefault(surfaceProps))
|
||||
|
@ -481,16 +481,12 @@ public:
|
||||
int height() const { return fRenderTargetProxy->height(); }
|
||||
int numSamples() const { return fRenderTargetProxy->numSamples(); }
|
||||
const SkSurfaceProps& surfaceProps() const { return fSurfaceProps; }
|
||||
GrSurfaceOrigin origin() const { return fOrigin; }
|
||||
bool wrapsVkSecondaryCB() const { return fRenderTargetProxy->wrapsVkSecondaryCB(); }
|
||||
GrMipMapped mipMapped() const;
|
||||
|
||||
GrSurfaceProxyView outputSurfaceView() {
|
||||
return { fRenderTargetProxy, fOrigin, fOutputSwizzle };
|
||||
}
|
||||
GrSurfaceProxyView textureSurfaceView() {
|
||||
return { fRenderTargetProxy, fOrigin, fTextureSwizzle };
|
||||
}
|
||||
|
||||
// This entry point should only be called if the backing GPU object is known to be
|
||||
// instantiated.
|
||||
@ -648,8 +644,6 @@ private:
|
||||
std::unique_ptr<GrTextTarget> fTextTarget;
|
||||
|
||||
sk_sp<GrRenderTargetProxy> fRenderTargetProxy;
|
||||
GrSurfaceOrigin fOrigin;
|
||||
GrSwizzle fTextureSwizzle;
|
||||
GrSwizzle fOutputSwizzle;
|
||||
|
||||
// In MDB-mode the GrOpsTask can be closed by some other renderTargetContext that has picked
|
||||
|
@ -35,8 +35,13 @@
|
||||
GrSurfaceContext::GrSurfaceContext(GrRecordingContext* context,
|
||||
GrColorType colorType,
|
||||
SkAlphaType alphaType,
|
||||
sk_sp<SkColorSpace> colorSpace)
|
||||
: fContext(context), fColorInfo(colorType, alphaType, std::move(colorSpace)) {}
|
||||
sk_sp<SkColorSpace> colorSpace,
|
||||
GrSurfaceOrigin origin,
|
||||
GrSwizzle texSwizzle)
|
||||
: fContext(context)
|
||||
, fOrigin(origin)
|
||||
, fColorInfo(colorType, alphaType, std::move(colorSpace))
|
||||
, fTextureSwizzle(texSwizzle) {}
|
||||
|
||||
const GrCaps* GrSurfaceContext::caps() const { return fContext->priv().caps(); }
|
||||
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "src/gpu/GrColorInfo.h"
|
||||
#include "src/gpu/GrDataUtils.h"
|
||||
#include "src/gpu/GrSurfaceProxy.h"
|
||||
#include "src/gpu/GrSurfaceProxyView.h"
|
||||
|
||||
class GrAuditTrail;
|
||||
class GrDrawingManager;
|
||||
@ -38,6 +39,10 @@ public:
|
||||
virtual ~GrSurfaceContext() = default;
|
||||
|
||||
const GrColorInfo& colorInfo() const { return fColorInfo; }
|
||||
GrSurfaceOrigin origin() const { return fOrigin; }
|
||||
GrSurfaceProxyView textureSurfaceView() {
|
||||
return { this->asSurfaceProxyRef(), fOrigin, fTextureSwizzle };
|
||||
}
|
||||
|
||||
// TODO: these two calls would be way cooler if this object had a GrSurfaceProxy pointer
|
||||
int width() const { return this->asSurfaceProxy()->width(); }
|
||||
@ -104,7 +109,8 @@ public:
|
||||
protected:
|
||||
friend class GrSurfaceContextPriv;
|
||||
|
||||
GrSurfaceContext(GrRecordingContext*, GrColorType, SkAlphaType, sk_sp<SkColorSpace>);
|
||||
GrSurfaceContext(GrRecordingContext*, GrColorType, SkAlphaType, sk_sp<SkColorSpace>,
|
||||
GrSurfaceOrigin, GrSwizzle texSwizzle);
|
||||
|
||||
GrDrawingManager* drawingManager();
|
||||
const GrDrawingManager* drawingManager() const;
|
||||
@ -115,6 +121,8 @@ protected:
|
||||
|
||||
GrRecordingContext* fContext;
|
||||
|
||||
GrSurfaceOrigin fOrigin;
|
||||
|
||||
// The rescaling step of asyncRescaleAndReadPixels[YUV420]().
|
||||
std::unique_ptr<GrRenderTargetContext> rescale(const SkImageInfo& info, const SkIRect& srcRect,
|
||||
SkSurface::RescaleGamma rescaleGamma,
|
||||
@ -159,6 +167,7 @@ private:
|
||||
}
|
||||
|
||||
GrColorInfo fColorInfo;
|
||||
GrSwizzle fTextureSwizzle;
|
||||
|
||||
typedef SkRefCnt INHERITED;
|
||||
};
|
||||
|
@ -20,8 +20,10 @@ GrTextureContext::GrTextureContext(GrRecordingContext* context,
|
||||
sk_sp<GrTextureProxy> textureProxy,
|
||||
GrColorType colorType,
|
||||
SkAlphaType alphaType,
|
||||
sk_sp<SkColorSpace> colorSpace)
|
||||
: GrSurfaceContext(context, colorType, alphaType, std::move(colorSpace))
|
||||
sk_sp<SkColorSpace> colorSpace,
|
||||
GrSurfaceOrigin origin,
|
||||
GrSwizzle texSwizzle)
|
||||
: GrSurfaceContext(context, colorType, alphaType, std::move(colorSpace), origin, texSwizzle)
|
||||
, fTextureProxy(std::move(textureProxy)) {
|
||||
SkDEBUGCODE(this->validate();)
|
||||
}
|
||||
|
@ -42,7 +42,9 @@ protected:
|
||||
sk_sp<GrTextureProxy>,
|
||||
GrColorType,
|
||||
SkAlphaType,
|
||||
sk_sp<SkColorSpace>);
|
||||
sk_sp<SkColorSpace>,
|
||||
GrSurfaceOrigin origin,
|
||||
GrSwizzle texSwizzle);
|
||||
|
||||
SkDEBUGCODE(void validate() const override;)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user