Make SkImage_Gpu be deferred (take 2)
This CL removes the GrTexture-based ctor forcing everyone to create deferred SkImage_Gpus.
relanding of: https://skia-review.googlesource.com/c/6680/ (Make SkImage_Gpu be deferred)
split out into:
https://skia-review.googlesource.com/c/9106/ (Remove atlas creation from GrResourceProvider)
Change-Id: I834ede430b9706cf9b675bdfdddf1c8c624c2f14
Reviewed-on: https://skia-review.googlesource.com/9965
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index 676dc2b..8a6d973 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 @@
}
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 @@
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 @@
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,