diff options
author | 2017-03-20 14:37:13 -0400 | |
---|---|---|
committer | 2017-03-21 11:39:41 +0000 | |
commit | 0db235bc0278887c344eb25b4681e9cca4cf892a (patch) | |
tree | 853a3e84db8d689e36ff5e6730ac38d77a621f14 /src/gpu/SkGpuDevice.cpp | |
parent | 53262d0ff466668bfbc76893ba5a581203269572 (diff) |
Make SkImage_Gpu be deferred
This CL removes the GrTexture-based ctor forcing everyone to create deferred SkImage_Gpus.
split out into:
https://skia-review.googlesource.com/c/9106/ (Remove atlas creation from GrResourceProvider)
Change-Id: I266bbe089c242fe54d5b7adcc7895aa5a39440a0
Reviewed-on: https://skia-review.googlesource.com/6680
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'src/gpu/SkGpuDevice.cpp')
-rw-r--r-- | src/gpu/SkGpuDevice.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp index 676dc2b9d9..8a6d973394 100644 --- a/src/gpu/SkGpuDevice.cpp +++ b/src/gpu/SkGpuDevice.cpp @@ -14,6 +14,7 @@ #include "GrImageTextureMaker.h" #include "GrRenderTargetContextPriv.h" #include "GrStyle.h" +#include "GrSurfaceProxyPriv.h" #include "GrTextureAdjuster.h" #include "GrTextureProxy.h" #include "GrTracing.h" @@ -165,7 +166,9 @@ sk_sp<GrRenderTargetContext> SkGpuDevice::MakeRenderTargetContext( } GrPixelConfig config = SkImageInfo2GrPixelConfig(origInfo, *context->caps()); - return context->makeRenderTargetContext(SkBackingFit::kExact, // Why exact? + // This method is used to create SkGpuDevice's for SkSurface_Gpus. In this case + // they need to be exact. + return context->makeRenderTargetContext(SkBackingFit::kExact, origInfo.width(), origInfo.height(), config, origInfo.refColorSpace(), sampleCount, origin, surfaceProps, budgeted); @@ -245,16 +248,19 @@ void SkGpuDevice::replaceRenderTargetContext(bool shouldRetainContent) { SkBudgeted budgeted = fRenderTargetContext->priv().isBudgeted(); + // This entry point is used by SkSurface_Gpu::onCopyOnWrite so it must create a + // kExact-backed render target context. sk_sp<GrRenderTargetContext> newRTC(MakeRenderTargetContext( this->context(), budgeted, this->imageInfo(), - fRenderTargetContext->numColorSamples(), - fRenderTargetContext->origin(), + fRenderTargetContext->numColorSamples(), + fRenderTargetContext->origin(), &this->surfaceProps())); if (!newRTC) { return; } + SkASSERT(newRTC->asSurfaceProxy()->priv().isExact()); if (shouldRetainContent) { if (fRenderTargetContext->wasAbandoned()) { @@ -1326,6 +1332,7 @@ sk_sp<SkSpecialImage> SkGpuDevice::snapSpecial() { const SkImageInfo ii = this->imageInfo(); const SkIRect srcRect = SkIRect::MakeWH(ii.width(), ii.height()); + SkASSERT(proxy->priv().isExact()); return SkSpecialImage::MakeDeferredFromGpu(fContext.get(), srcRect, kNeedNewImageUniqueID_SpecialImage, |