Make asDirectContext public
External clients will eventually have to call this to get access
to a direct context from an SkCanvas or SkSurface (which will
only have 'recordingContext' accessors).
Bug: skia:10441
Change-Id: I10e34081277b685fa59d03e1fce1887f3524e0fa
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/300178
Reviewed-by: Adlai Holler <adlai@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/gm/asyncrescaleandread.cpp b/gm/asyncrescaleandread.cpp
index c27cb5f..de15660 100644
--- a/gm/asyncrescaleandread.cpp
+++ b/gm/asyncrescaleandread.cpp
@@ -17,7 +17,6 @@
#include "src/core/SkAutoPixmapStorage.h"
#include "src/core/SkConvertPixels.h"
#include "src/core/SkScopeExit.h"
-#include "src/gpu/GrRecordingContextPriv.h"
#include "tools/Resources.h"
#include "tools/ToolUtils.h"
@@ -135,7 +134,7 @@
SkString* errorMsg,
int pad = 0) {
if (doYUV420) {
- if (!canvas->recordingContext() || !canvas->recordingContext()->priv().asDirectContext()) {
+ if (!canvas->recordingContext() || !canvas->recordingContext()->asDirectContext()) {
errorMsg->printf("YUV420 only supported on direct GPU for now.");
return skiagm::DrawResult::kSkip;
}
diff --git a/gm/bitmaptiled.cpp b/gm/bitmaptiled.cpp
index 6600ef8..fc00acf 100644
--- a/gm/bitmaptiled.cpp
+++ b/gm/bitmaptiled.cpp
@@ -14,7 +14,6 @@
#include "include/gpu/GrContext.h"
#include "include/private/GrDirectContext.h"
#include "include/private/GrRecordingContext.h"
-#include "src/gpu/GrRecordingContextPriv.h"
class GrRenderTargetContext;
@@ -32,7 +31,7 @@
const int kBitmapLongEdge = 7 * kTileSize;
const int kBitmapShortEdge = 1 * kTileSize;
- if (auto direct = context->priv().asDirectContext()) {
+ if (auto direct = context->asDirectContext()) {
// To trigger tiling, we also need the image to be more than 50% of the cache, so we
// ensure the cache is sized to make that true.
const int kBitmapArea = kBitmapLongEdge * kBitmapShortEdge;
diff --git a/gm/blurrect.cpp b/gm/blurrect.cpp
index cea9137..d304886 100644
--- a/gm/blurrect.cpp
+++ b/gm/blurrect.cpp
@@ -254,7 +254,7 @@
DrawResult onDraw(SkCanvas* canvas, SkString* errorMsg) override {
if (canvas->imageInfo().colorType() == kUnknown_SkColorType ||
- (canvas->recordingContext() && !canvas->recordingContext()->priv().asDirectContext())) {
+ (canvas->recordingContext() && !canvas->recordingContext()->asDirectContext())) {
*errorMsg = "Not supported when recording, relies on canvas->makeSurface()";
return DrawResult::kSkip;
}
diff --git a/gm/crosscontextimage.cpp b/gm/crosscontextimage.cpp
index 5a0ad1e..2b4ae4b 100644
--- a/gm/crosscontextimage.cpp
+++ b/gm/crosscontextimage.cpp
@@ -19,7 +19,6 @@
#include "include/core/SkTypes.h"
#include "include/private/GrDirectContext.h"
#include "include/private/GrRecordingContext.h"
-#include "src/gpu/GrRecordingContextPriv.h"
#include "tools/Resources.h"
class GrContext;
@@ -33,7 +32,7 @@
return skiagm::DrawResult::kFail;
}
- auto direct = context->priv().asDirectContext();
+ auto direct = context->asDirectContext();
if (!direct) {
*errorMsg = "CrossContext image creation requires a direct context.";
return skiagm::DrawResult::kSkip;
diff --git a/gm/discard.cpp b/gm/discard.cpp
index bc9cbcb..f879263 100644
--- a/gm/discard.cpp
+++ b/gm/discard.cpp
@@ -20,7 +20,6 @@
#include "include/private/GrDirectContext.h"
#include "include/private/GrRecordingContext.h"
#include "include/utils/SkRandom.h"
-#include "src/gpu/GrRecordingContextPriv.h"
#include "tools/ToolUtils.h"
class GrContext;
@@ -48,7 +47,7 @@
DrawResult onDraw(GrRecordingContext* context, GrRenderTargetContext*, SkCanvas* canvas,
SkString* errorMsg) override {
- auto direct = context->priv().asDirectContext();
+ auto direct = context->asDirectContext();
if (!direct) {
*errorMsg = "GM relies on having access to a live direct context.";
return DrawResult::kSkip;
diff --git a/gm/flippity.cpp b/gm/flippity.cpp
index b2a517e..173857a 100644
--- a/gm/flippity.cpp
+++ b/gm/flippity.cpp
@@ -256,7 +256,7 @@
return DrawResult::kSkip;
}
- SkASSERT(context->priv().asDirectContext());
+ SkASSERT(context->asDirectContext());
this->makeLabels(context);
fReferenceImages[0] = make_reference_image(context, fLabels, false);
diff --git a/gm/fontregen.cpp b/gm/fontregen.cpp
index de0a08b..9e6724a 100644
--- a/gm/fontregen.cpp
+++ b/gm/fontregen.cpp
@@ -35,7 +35,6 @@
#include "include/private/GrTypesPriv.h"
#include "include/private/SkTemplates.h"
#include "src/gpu/GrContextPriv.h"
-#include "src/gpu/GrRecordingContextPriv.h"
#include "tools/ToolUtils.h"
class GrRenderTargetContext;
@@ -85,7 +84,7 @@
}
void onDraw(GrRecordingContext* context, GrRenderTargetContext*, SkCanvas* canvas) override {
- auto direct = context->priv().asDirectContext();
+ auto direct = context->asDirectContext();
if (!direct) {
return;
}
diff --git a/gm/gpu_blur_utils.cpp b/gm/gpu_blur_utils.cpp
index 2a8fd23..b05af14 100644
--- a/gm/gpu_blur_utils.cpp
+++ b/gm/gpu_blur_utils.cpp
@@ -33,7 +33,7 @@
};
static void run(GrRecordingContext* ctx, GrRenderTargetContext* rtc, bool subsetSrc, bool ref) {
- auto direct = ctx->priv().asDirectContext();
+ auto direct = ctx->asDirectContext();
if (!direct) {
return;
}
diff --git a/gm/image.cpp b/gm/image.cpp
index 39d3ab1..2fce516 100644
--- a/gm/image.cpp
+++ b/gm/image.cpp
@@ -35,7 +35,6 @@
#include "src/core/SkAutoPixmapStorage.h"
#include "src/core/SkReadBuffer.h"
#include "src/core/SkWriteBuffer.h"
-#include "src/gpu/GrRecordingContextPriv.h"
#include "tools/ToolUtils.h"
#include <functional>
@@ -288,7 +287,7 @@
///////////////////////////////////////////////////////////////////////////////////////////////////
DEF_SIMPLE_GPU_GM(new_texture_image, context, rtc, canvas, 280, 60) {
- auto direct = context->priv().asDirectContext();
+ auto direct = context->asDirectContext();
if (!direct) {
return;
}
diff --git a/gm/imagefromyuvtextures.cpp b/gm/imagefromyuvtextures.cpp
index 1cb589a..96186d8 100644
--- a/gm/imagefromyuvtextures.cpp
+++ b/gm/imagefromyuvtextures.cpp
@@ -215,7 +215,7 @@
return DrawResult::kSkip;
}
- SkASSERT(context->priv().asDirectContext());
+ SkASSERT(context->asDirectContext());
fRGBABmp = CreateBmpAndPlanes("images/mandrill_32.png", fYUVABmps);
diff --git a/gm/textblobrandomfont.cpp b/gm/textblobrandomfont.cpp
index 2499354..dc55e8c 100644
--- a/gm/textblobrandomfont.cpp
+++ b/gm/textblobrandomfont.cpp
@@ -25,7 +25,6 @@
#include "include/core/SkTypeface.h"
#include "include/private/GrDirectContext.h"
#include "include/private/GrRecordingContext.h"
-#include "src/gpu/GrRecordingContextPriv.h"
#include "tools/ToolUtils.h"
#include "tools/fonts/RandomScalerContext.h"
@@ -149,7 +148,7 @@
surface->draw(canvas, 0, 0, nullptr);
yOffset += stride;
- if (auto direct = context->priv().asDirectContext()) {
+ if (auto direct = context->asDirectContext()) {
// free gpu resources and verify
direct->freeGpuResources();
}
diff --git a/gm/textblobuseaftergpufree.cpp b/gm/textblobuseaftergpufree.cpp
index 03a7bada3..885f688 100644
--- a/gm/textblobuseaftergpufree.cpp
+++ b/gm/textblobuseaftergpufree.cpp
@@ -16,7 +16,6 @@
#include "include/core/SkTextBlob.h"
#include "include/core/SkTypeface.h"
#include "include/private/GrDirectContext.h"
-#include "src/gpu/GrRecordingContextPriv.h"
#include "tools/ToolUtils.h"
#include <string.h>
@@ -52,7 +51,7 @@
canvas->drawTextBlob(blob, 20, 60, SkPaint());
// This text should look fine
- if (auto direct = context->priv().asDirectContext()) {
+ if (auto direct = context->asDirectContext()) {
direct->freeGpuResources();
}
canvas->drawTextBlob(blob, 20, 160, SkPaint());
diff --git a/gm/wacky_yuv_formats.cpp b/gm/wacky_yuv_formats.cpp
index 04fbce8..032538d 100644
--- a/gm/wacky_yuv_formats.cpp
+++ b/gm/wacky_yuv_formats.cpp
@@ -1603,7 +1603,7 @@
return DrawResult::kSkip;
}
- SkASSERT(context->priv().asDirectContext());
+ SkASSERT(context->asDirectContext());
this->createBitmaps();
if (!this->createImages(context)) {
diff --git a/gm/ycbcrimage.cpp b/gm/ycbcrimage.cpp
index d3eba2c..95a71c2 100644
--- a/gm/ycbcrimage.cpp
+++ b/gm/ycbcrimage.cpp
@@ -75,7 +75,7 @@
return DrawResult::kSkip;
}
- SkASSERT(context->priv().asDirectContext());
+ SkASSERT(context->asDirectContext());
if (context->backend() != GrBackendApi::kVulkan) {
*errorMsg = "This GM requires a Vulkan context.";
diff --git a/include/private/GrContext_Base.h b/include/private/GrContext_Base.h
index 45c2c94..42d8f71 100644
--- a/include/private/GrContext_Base.h
+++ b/include/private/GrContext_Base.h
@@ -25,6 +25,11 @@
virtual ~GrContext_Base();
/*
+ * Safely downcast to a GrDirectContext.
+ */
+ virtual GrDirectContext* asDirectContext() { return nullptr; }
+
+ /*
* The 3D API backing this context
*/
SK_API GrBackendApi backend() const;
@@ -77,7 +82,6 @@
virtual GrImageContext* asImageContext() { return nullptr; }
virtual GrRecordingContext* asRecordingContext() { return nullptr; }
- virtual GrDirectContext* asDirectContext() { return nullptr; }
sk_sp<GrContextThreadSafeProxy> fThreadSafeProxy;
diff --git a/src/gpu/GrAHardwareBufferImageGenerator.cpp b/src/gpu/GrAHardwareBufferImageGenerator.cpp
index 4bb2c91..7c45332 100644
--- a/src/gpu/GrAHardwareBufferImageGenerator.cpp
+++ b/src/gpu/GrAHardwareBufferImageGenerator.cpp
@@ -85,7 +85,7 @@
return {};
}
- auto direct = context->priv().asDirectContext();
+ auto direct = context->asDirectContext();
if (!direct) {
return {};
}
diff --git a/src/gpu/GrClipStackClip.cpp b/src/gpu/GrClipStackClip.cpp
index 5b96643..bc3f47c 100644
--- a/src/gpu/GrClipStackClip.cpp
+++ b/src/gpu/GrClipStackClip.cpp
@@ -471,7 +471,7 @@
SkIRect maskSpaceIBounds = SkIRect::MakeWH(reducedClip.width(), reducedClip.height());
SkTaskGroup* taskGroup = nullptr;
- if (auto direct = context->priv().asDirectContext()) {
+ if (auto direct = context->asDirectContext()) {
taskGroup = direct->priv().getTaskGroup();
}
diff --git a/src/gpu/GrContextPriv.h b/src/gpu/GrContextPriv.h
index 4789030..2abd037 100644
--- a/src/gpu/GrContextPriv.h
+++ b/src/gpu/GrContextPriv.h
@@ -40,7 +40,6 @@
GrImageContext* asImageContext() { return fContext->asImageContext(); }
GrRecordingContext* asRecordingContext() { return fContext->asRecordingContext(); }
- GrDirectContext* asDirectContext() { return fContext->asDirectContext(); }
// from GrImageContext
GrProxyProvider* proxyProvider() { return fContext->proxyProvider(); }
diff --git a/src/gpu/GrDrawingManager.cpp b/src/gpu/GrDrawingManager.cpp
index f14da9b..d273d56 100644
--- a/src/gpu/GrDrawingManager.cpp
+++ b/src/gpu/GrDrawingManager.cpp
@@ -214,7 +214,7 @@
}
}
- auto direct = fContext->priv().asDirectContext();
+ auto direct = fContext->asDirectContext();
if (!direct) {
if (info.fSubmittedProc) {
info.fSubmittedProc(info.fSubmittedContext, false);
@@ -384,7 +384,7 @@
return false;
}
- auto direct = fContext->priv().asDirectContext();
+ auto direct = fContext->asDirectContext();
if (!direct) {
return false; // Can't submit while DDL recording
}
@@ -540,7 +540,7 @@
SkASSERT(numProxies >= 0);
SkASSERT(!numProxies || proxies);
- auto direct = fContext->priv().asDirectContext();
+ auto direct = fContext->asDirectContext();
if (!direct) {
if (info.fSubmittedProc) {
info.fSubmittedProc(info.fSubmittedContext, false);
@@ -953,7 +953,7 @@
}
void GrDrawingManager::flushIfNecessary() {
- auto direct = fContext->priv().asDirectContext();
+ auto direct = fContext->asDirectContext();
if (!direct) {
return;
}
diff --git a/src/gpu/GrImageContextPriv.h b/src/gpu/GrImageContextPriv.h
index 50b7a62..ea7c740 100644
--- a/src/gpu/GrImageContextPriv.h
+++ b/src/gpu/GrImageContextPriv.h
@@ -27,7 +27,6 @@
GrImageContext* asImageContext() { return fContext->asImageContext(); }
GrRecordingContext* asRecordingContext() { return fContext->asRecordingContext(); }
- GrDirectContext* asDirectContext() { return fContext->asDirectContext(); }
// from GrImageContext
GrProxyProvider* proxyProvider() { return fContext->proxyProvider(); }
diff --git a/src/gpu/GrOnFlushResourceProvider.cpp b/src/gpu/GrOnFlushResourceProvider.cpp
index 538b0f4..f09acfa 100644
--- a/src/gpu/GrOnFlushResourceProvider.cpp
+++ b/src/gpu/GrOnFlushResourceProvider.cpp
@@ -90,7 +90,7 @@
SkASSERT(proxy->canSkipResourceAllocator());
// TODO: this class should probably just get a GrDirectContext
- auto direct = fDrawingMgr->getContext()->priv().asDirectContext();
+ auto direct = fDrawingMgr->getContext()->asDirectContext();
if (!direct) {
return false;
}
@@ -107,7 +107,7 @@
sk_sp<GrGpuBuffer> GrOnFlushResourceProvider::makeBuffer(GrGpuBufferType intendedType, size_t size,
const void* data) {
// TODO: this class should probably just get a GrDirectContext
- auto direct = fDrawingMgr->getContext()->priv().asDirectContext();
+ auto direct = fDrawingMgr->getContext()->asDirectContext();
if (!direct) {
return nullptr;
}
@@ -121,7 +121,7 @@
sk_sp<const GrGpuBuffer> GrOnFlushResourceProvider::findOrMakeStaticBuffer(
GrGpuBufferType intendedType, size_t size, const void* data, const GrUniqueKey& key) {
// TODO: class should probably just get a GrDirectContext
- auto direct = fDrawingMgr->getContext()->priv().asDirectContext();
+ auto direct = fDrawingMgr->getContext()->asDirectContext();
if (!direct) {
return nullptr;
}
diff --git a/src/gpu/GrPathRendererChain.cpp b/src/gpu/GrPathRendererChain.cpp
index 37610bb..4ae7bf7 100644
--- a/src/gpu/GrPathRendererChain.cpp
+++ b/src/gpu/GrPathRendererChain.cpp
@@ -63,7 +63,7 @@
fChain.push_back(std::move(spr));
}
if (options.fGpuPathRenderers & GpuPathRenderers::kStencilAndCover) {
- auto direct = context->priv().asDirectContext();
+ auto direct = context->asDirectContext();
if (direct) {
auto resourceProvider = direct->priv().resourceProvider();
diff --git a/src/gpu/GrProxyProvider.cpp b/src/gpu/GrProxyProvider.cpp
index 6e98c7b..776a9fc 100644
--- a/src/gpu/GrProxyProvider.cpp
+++ b/src/gpu/GrProxyProvider.cpp
@@ -58,7 +58,7 @@
#ifdef SK_DEBUG
{
- auto direct = fImageContext->priv().asDirectContext();
+ auto direct = fImageContext->asDirectContext();
if (direct) {
GrResourceCache* resourceCache = direct->priv().getResourceCache();
// If there is already a GrResource with this key then the caller has violated the
@@ -127,7 +127,7 @@
if (this->isAbandoned()) {
return nullptr;
}
- auto direct = fImageContext->priv().asDirectContext();
+ auto direct = fImageContext->asDirectContext();
if (!direct) {
return nullptr;
}
@@ -212,7 +212,7 @@
return result;
}
- auto direct = fImageContext->priv().asDirectContext();
+ auto direct = fImageContext->asDirectContext();
if (!direct) {
return nullptr;
}
@@ -296,7 +296,7 @@
return nullptr;
}
- auto direct = fImageContext->priv().asDirectContext();
+ auto direct = fImageContext->asDirectContext();
if (direct) {
GrResourceProvider* resourceProvider = direct->priv().resourceProvider();
@@ -474,7 +474,7 @@
return nullptr;
}
- auto direct = fImageContext->priv().asDirectContext();
+ auto direct = fImageContext->asDirectContext();
if (direct) {
GrResourceProvider* resourceProvider = direct->priv().resourceProvider();
// In order to reuse code we always create a lazy proxy. When we aren't in DDL mode however
@@ -498,7 +498,7 @@
}
// This is only supported on a direct GrContext.
- auto direct = fImageContext->priv().asDirectContext();
+ auto direct = fImageContext->asDirectContext();
if (!direct) {
return nullptr;
}
@@ -533,7 +533,7 @@
}
// This is only supported on a direct GrContext.
- auto direct = fImageContext->priv().asDirectContext();
+ auto direct = fImageContext->asDirectContext();
if (!direct) {
return nullptr;
}
@@ -569,7 +569,7 @@
}
// This is only supported on a direct GrContext.
- auto direct = fImageContext->priv().asDirectContext();
+ auto direct = fImageContext->asDirectContext();
if (!direct) {
return nullptr;
}
@@ -607,7 +607,7 @@
}
// This is only supported on a direct GrContext.
- auto direct = fImageContext->priv().asDirectContext();
+ auto direct = fImageContext->asDirectContext();
if (!direct) {
return nullptr;
}
@@ -638,7 +638,7 @@
}
// This is only supported on a direct GrContext.
- auto direct = fImageContext->priv().asDirectContext();
+ auto direct = fImageContext->asDirectContext();
if (!direct) {
return nullptr;
}
@@ -665,7 +665,7 @@
}
// This is only supported on a direct GrContext.
- auto direct = fImageContext->priv().asDirectContext();
+ auto direct = fImageContext->asDirectContext();
if (!direct) {
return nullptr;
}
@@ -845,7 +845,7 @@
// proxy's unique key. We must do it in this order because 'key' may alias the proxy's key.
sk_sp<GrGpuResource> invalidGpuResource;
if (InvalidateGPUResource::kYes == invalidateGPUResource) {
- auto direct = fImageContext->priv().asDirectContext();
+ auto direct = fImageContext->asDirectContext();
if (direct) {
GrResourceProvider* resourceProvider = direct->priv().resourceProvider();
invalidGpuResource = resourceProvider->findByUniqueKey<GrGpuResource>(key);
@@ -868,7 +868,7 @@
}
GrDDLProvider GrProxyProvider::isDDLProvider() const {
- return fImageContext->priv().asDirectContext() ? GrDDLProvider::kNo : GrDDLProvider::kYes;
+ return fImageContext->asDirectContext() ? GrDDLProvider::kNo : GrDDLProvider::kYes;
}
uint32_t GrProxyProvider::contextID() const {
@@ -906,5 +906,5 @@
}
bool GrProxyProvider::renderingDirectly() const {
- return fImageContext->priv().asDirectContext();
+ return fImageContext->asDirectContext();
}
diff --git a/src/gpu/GrRecordingContextPriv.h b/src/gpu/GrRecordingContextPriv.h
index f4c4487..9476202 100644
--- a/src/gpu/GrRecordingContextPriv.h
+++ b/src/gpu/GrRecordingContextPriv.h
@@ -28,7 +28,6 @@
GrImageContext* asImageContext() { return fContext->asImageContext(); }
GrRecordingContext* asRecordingContext() { return fContext->asRecordingContext(); }
- GrDirectContext* asDirectContext() { return fContext->asDirectContext(); }
// from GrImageContext
GrProxyProvider* proxyProvider() { return fContext->proxyProvider(); }
diff --git a/src/gpu/GrRenderTargetContext.cpp b/src/gpu/GrRenderTargetContext.cpp
index eab1436..acc8118 100644
--- a/src/gpu/GrRenderTargetContext.cpp
+++ b/src/gpu/GrRenderTargetContext.cpp
@@ -39,7 +39,6 @@
#include "src/gpu/GrMemoryPool.h"
#include "src/gpu/GrPathRenderer.h"
#include "src/gpu/GrProxyProvider.h"
-#include "src/gpu/GrRecordingContextPriv.h"
#include "src/gpu/GrRenderTarget.h"
#include "src/gpu/GrRenderTargetContextPriv.h"
#include "src/gpu/GrResourceProvider.h"
@@ -1712,7 +1711,7 @@
return false;
}
- auto direct = fContext->priv().asDirectContext();
+ auto direct = fContext->asDirectContext();
if (!direct) {
return false;
}
diff --git a/src/gpu/GrSoftwarePathRenderer.cpp b/src/gpu/GrSoftwarePathRenderer.cpp
index b79f3f2..0e479fe 100644
--- a/src/gpu/GrSoftwarePathRenderer.cpp
+++ b/src/gpu/GrSoftwarePathRenderer.cpp
@@ -328,7 +328,7 @@
GrAA aa = GrAA(GrAAType::kCoverage == args.fAAType);
SkTaskGroup* taskGroup = nullptr;
- if (auto direct = args.fContext->priv().asDirectContext()) {
+ if (auto direct = args.fContext->asDirectContext()) {
taskGroup = direct->priv().getTaskGroup();
}
diff --git a/src/gpu/GrSurfaceContext.cpp b/src/gpu/GrSurfaceContext.cpp
index c9dc239..eda6aec 100644
--- a/src/gpu/GrSurfaceContext.cpp
+++ b/src/gpu/GrSurfaceContext.cpp
@@ -138,7 +138,7 @@
SkDEBUGCODE(this->validate();)
GR_AUDIT_TRAIL_AUTO_FRAME(this->auditTrail(), "GrSurfaceContext::readPixels");
- if (!direct && !(direct = fContext->priv().asDirectContext())) {
+ if (!direct && !(direct = fContext->asDirectContext())) {
return false;
}
@@ -296,7 +296,7 @@
SkDEBUGCODE(this->validate();)
GR_AUDIT_TRAIL_AUTO_FRAME(this->auditTrail(), "GrSurfaceContext::writePixels");
- if (!direct && !(direct = fContext->priv().asDirectContext())) {
+ if (!direct && !(direct = fContext->asDirectContext())) {
return false;
}
@@ -483,7 +483,7 @@
SkFilterQuality rescaleQuality,
ReadPixelsCallback callback,
ReadPixelsContext context) {
- auto direct = fContext->priv().asDirectContext();
+ auto direct = fContext->asDirectContext();
// We implement this by rendering and we don't currently support rendering kUnpremul.
if (info.alphaType() == kUnpremul_SkAlphaType) {
@@ -667,7 +667,7 @@
return;
}
- auto directContext = fContext->priv().asDirectContext();
+ auto directContext = fContext->asDirectContext();
SkASSERT(directContext);
auto mappedBufferManager = directContext->priv().clientMappedBufferManager();
@@ -736,7 +736,7 @@
SkASSERT(!dstSize.isZero());
SkASSERT((dstSize.width() % 2 == 0) && (dstSize.height() % 2 == 0));
- auto direct = fContext->priv().asDirectContext();
+ auto direct = fContext->asDirectContext();
if (!direct) {
callback(context, nullptr);
return;
@@ -1170,7 +1170,7 @@
const SkIRect& rect) {
SkASSERT(rect.fLeft >= 0 && rect.fRight <= this->width());
SkASSERT(rect.fTop >= 0 && rect.fBottom <= this->height());
- auto direct = fContext->priv().asDirectContext();
+ auto direct = fContext->asDirectContext();
if (!direct) {
return {};
}
diff --git a/src/gpu/SkGpuDevice_drawTexture.cpp b/src/gpu/SkGpuDevice_drawTexture.cpp
index f68abf3..3f5a645 100644
--- a/src/gpu/SkGpuDevice_drawTexture.cpp
+++ b/src/gpu/SkGpuDevice_drawTexture.cpp
@@ -185,7 +185,7 @@
// and theoretically, the resource cache's limits could be being changed on another thread, so
// even having access to just the limit wouldn't be a reliable test during recording here.
// Instead, we will just upload the entire image to be on the safe side and not tile.
- if (!context->priv().asDirectContext()) {
+ if (!context->asDirectContext()) {
return false;
}
diff --git a/src/image/SkImage_GpuBase.cpp b/src/image/SkImage_GpuBase.cpp
index 7a7d5ba..ce6bf28 100644
--- a/src/image/SkImage_GpuBase.cpp
+++ b/src/image/SkImage_GpuBase.cpp
@@ -17,7 +17,6 @@
#include "src/gpu/GrContextPriv.h"
#include "src/gpu/GrImageInfo.h"
#include "src/gpu/GrProxyProvider.h"
-#include "src/gpu/GrRecordingContextPriv.h"
#include "src/gpu/GrRenderTargetContext.h"
#include "src/gpu/GrTexture.h"
#include "src/gpu/GrTextureAdjuster.h"
@@ -87,7 +86,7 @@
//////////////////////////////////////////////////////////////////////////////////////////////////
bool SkImage_GpuBase::getROPixels(SkBitmap* dst, CachingHint chint) const {
- auto direct = fContext->priv().asDirectContext();
+ auto direct = fContext->asDirectContext();
if (!direct) {
// DDL TODO: buffer up the readback so it occurs when the DDL is drawn?
return false;
@@ -158,7 +157,7 @@
bool SkImage_GpuBase::onReadPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRB,
int srcX, int srcY, CachingHint) const {
- auto direct = fContext->priv().asDirectContext();
+ auto direct = fContext->asDirectContext();
if (!direct) {
// DDL TODO: buffer up the readback so it occurs when the DDL is drawn?
return false;
@@ -196,7 +195,7 @@
GrBackendTexture SkImage_GpuBase::onGetBackendTexture(bool flushPendingGrContextIO,
GrSurfaceOrigin* origin) const {
- auto direct = fContext->priv().asDirectContext();
+ auto direct = fContext->asDirectContext();
if (!direct) {
// This image was created with a DDL context and cannot be instantiated.
return GrBackendTexture(); // invalid
@@ -233,7 +232,7 @@
return proxy->peekTexture();
}
- auto direct = fContext->priv().asDirectContext();
+ auto direct = fContext->asDirectContext();
if (!direct) {
// This image was created with a DDL context and cannot be instantiated.
return nullptr;
diff --git a/src/image/SkSurface_Gpu.cpp b/src/image/SkSurface_Gpu.cpp
index f445f03..d403e9b 100644
--- a/src/image/SkSurface_Gpu.cpp
+++ b/src/image/SkSurface_Gpu.cpp
@@ -244,7 +244,7 @@
if (!canvasContext) {
return false;
}
- if (!canvasContext->priv().asDirectContext() ||
+ if (!canvasContext->asDirectContext() ||
canvasContext->priv().contextID() != context->priv().contextID()) {
return false;
}
diff --git a/tests/FloatingPointTextureTest.cpp b/tests/FloatingPointTextureTest.cpp
index a3f3630..0181e9e 100644
--- a/tests/FloatingPointTextureTest.cpp
+++ b/tests/FloatingPointTextureTest.cpp
@@ -77,7 +77,7 @@
static const SkHalf kMaxIntegerRepresentableInHalfFloatingPoint = 0x6800; // 2 ^ 11
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(HalfFloatAlphaTextureTest, reporter, ctxInfo) {
- auto direct = ctxInfo.grContext()->priv().asDirectContext();
+ auto direct = ctxInfo.grContext()->asDirectContext();
runFPTest<SkHalf>(reporter, direct, SK_HalfMin, SK_HalfMax, SK_HalfEpsilon,
kMaxIntegerRepresentableInHalfFloatingPoint, HALF_ALPHA_CONTROL_ARRAY_SIZE,
@@ -87,7 +87,7 @@
static const int HALF_RGBA_CONTROL_ARRAY_SIZE = DEV_W * DEV_H * 4 /*RGBA*/;
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(HalfFloatRGBATextureTest, reporter, ctxInfo) {
- auto direct = ctxInfo.grContext()->priv().asDirectContext();
+ auto direct = ctxInfo.grContext()->asDirectContext();
runFPTest<SkHalf>(reporter, direct, SK_HalfMin, SK_HalfMax, SK_HalfEpsilon,
kMaxIntegerRepresentableInHalfFloatingPoint, HALF_RGBA_CONTROL_ARRAY_SIZE,
diff --git a/tests/GrTestingBackendTextureUploadTest.cpp b/tests/GrTestingBackendTextureUploadTest.cpp
index 8f31e89..2b5d1d0 100644
--- a/tests/GrTestingBackendTextureUploadTest.cpp
+++ b/tests/GrTestingBackendTextureUploadTest.cpp
@@ -16,7 +16,7 @@
void testing_only_texture_test(skiatest::Reporter* reporter, GrContext* context, SkColorType ct,
GrRenderable renderable, bool doDataUpload, GrMipMapped mipMapped) {
- auto direct = context->priv().asDirectContext();
+ auto direct = context->asDirectContext();
if (!direct) {
return;
}
diff --git a/tools/DDLPromiseImageHelper.cpp b/tools/DDLPromiseImageHelper.cpp
index 2dba0b9..e17dd1a 100644
--- a/tools/DDLPromiseImageHelper.cpp
+++ b/tools/DDLPromiseImageHelper.cpp
@@ -143,7 +143,7 @@
*/
void DDLPromiseImageHelper::CreateBETexturesForPromiseImage(GrContext* context,
PromiseImageInfo* info) {
- SkASSERT(context->priv().asDirectContext());
+ SkASSERT(context->asDirectContext());
if (info->isYUV()) {
int numPixmaps;
@@ -187,7 +187,7 @@
void DDLPromiseImageHelper::DeleteBETexturesForPromiseImage(GrContext* context,
PromiseImageInfo* info) {
- SkASSERT(context->priv().asDirectContext());
+ SkASSERT(context->asDirectContext());
if (info->isYUV()) {
int numPixmaps;
@@ -257,7 +257,7 @@
}
void DDLPromiseImageHelper::uploadAllToGPU(SkTaskGroup* taskGroup, GrContext* context) {
- SkASSERT(context->priv().asDirectContext());
+ SkASSERT(context->asDirectContext());
if (taskGroup) {
for (int i = 0; i < fImageInfo.count(); ++i) {
@@ -273,7 +273,7 @@
}
void DDLPromiseImageHelper::deleteAllFromGPU(SkTaskGroup* taskGroup, GrContext* context) {
- SkASSERT(context->priv().asDirectContext());
+ SkASSERT(context->asDirectContext());
if (taskGroup) {
for (int i = 0; i < fImageInfo.count(); ++i) {
diff --git a/tools/DDLTileHelper.cpp b/tools/DDLTileHelper.cpp
index ef7185f..16e2595 100644
--- a/tools/DDLTileHelper.cpp
+++ b/tools/DDLTileHelper.cpp
@@ -205,7 +205,7 @@
}
void DDLTileHelper::TileData::CreateBackendTexture(GrContext* context, TileData* tile) {
- SkASSERT(context->priv().asDirectContext());
+ SkASSERT(context->asDirectContext());
SkASSERT(tile->fCallbackContext && !tile->fCallbackContext->promiseImageTexture());
GrBackendTexture beTex = context->createBackendTexture(tile->fCharacterization);
@@ -213,7 +213,7 @@
}
void DDLTileHelper::TileData::DeleteBackendTexture(GrContext* context, TileData* tile) {
- SkASSERT(context->priv().asDirectContext());
+ SkASSERT(context->asDirectContext());
SkASSERT(tile->fCallbackContext);
// TODO: it seems that, on the Linux bots, backend texture creation is failing
@@ -355,7 +355,7 @@
}
void DDLTileHelper::createBackendTextures(SkTaskGroup* taskGroup, GrContext* context) {
- SkASSERT(context->priv().asDirectContext());
+ SkASSERT(context->asDirectContext());
if (taskGroup) {
for (int i = 0; i < this->numTiles(); ++i) {
@@ -371,7 +371,7 @@
}
void DDLTileHelper::deleteBackendTextures(SkTaskGroup* taskGroup, GrContext* context) {
- SkASSERT(context->priv().asDirectContext());
+ SkASSERT(context->asDirectContext());
if (taskGroup) {
for (int i = 0; i < this->numTiles(); ++i) {
diff --git a/tools/gpu/ProxyUtils.cpp b/tools/gpu/ProxyUtils.cpp
index 9064546..6ef2741 100644
--- a/tools/gpu/ProxyUtils.cpp
+++ b/tools/gpu/ProxyUtils.cpp
@@ -31,7 +31,7 @@
return nullptr;
}
- auto direct = context->priv().asDirectContext();
+ auto direct = context->asDirectContext();
if (!direct) {
return nullptr;
}
diff --git a/tools/gpu/YUVUtils.cpp b/tools/gpu/YUVUtils.cpp
index 70021ee..4b57f4c 100644
--- a/tools/gpu/YUVUtils.cpp
+++ b/tools/gpu/YUVUtils.cpp
@@ -109,7 +109,7 @@
YUVABackendReleaseContext::YUVABackendReleaseContext(GrContext* context) : fContext(context) {
SkASSERT(context->priv().getGpu());
- SkASSERT(context->priv().asDirectContext());
+ SkASSERT(context->asDirectContext());
}
YUVABackendReleaseContext::~YUVABackendReleaseContext() {