Rename GrContext::uniqueID to contextID and hide it
The GrContext's ID isn't really unique any more (since it can be shared among a family of contexts). Change its name to reflect the new reality.
Additionally, no client seems to be using it so make it private.
Change-Id: Ibb9004d699fe6ca7876b3be94142e612b5b9efbd
Reviewed-on: https://skia-review.googlesource.com/c/188308
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/src/image/SkImage_GpuBase.cpp b/src/image/SkImage_GpuBase.cpp
index e4aabb7..54ef66a 100644
--- a/src/image/SkImage_GpuBase.cpp
+++ b/src/image/SkImage_GpuBase.cpp
@@ -31,6 +31,13 @@
//////////////////////////////////////////////////////////////////////////////////////////////////
+#if GR_TEST_UTILS
+void SkImage_GpuBase::resetContext(sk_sp<GrContext> newContext) {
+ SkASSERT(fContext->contextPriv().contextID() == newContext->contextPriv().contextID());
+ fContext = newContext;
+}
+#endif
+
bool SkImage_GpuBase::ValidateBackendTexture(GrContext* ctx, const GrBackendTexture& tex,
GrPixelConfig* config, SkColorType ct, SkAlphaType at,
sk_sp<SkColorSpace> cs) {
@@ -53,6 +60,10 @@
//////////////////////////////////////////////////////////////////////////////////////////////////
+uint32_t SkImage_GpuBase::contextID() const {
+ return fContext->contextPriv().contextID();
+}
+
bool SkImage_GpuBase::getROPixels(SkBitmap* dst, CachingHint chint) const {
if (!fContext->contextPriv().resourceProvider()) {
// DDL TODO: buffer up the readback so it occurs when the DDL is drawn?
@@ -200,7 +211,7 @@
sk_sp<GrTextureProxy> SkImage_GpuBase::asTextureProxyRef(GrContext* context,
const GrSamplerState& params,
SkScalar scaleAdjust[2]) const {
- if (context->uniqueID() != fContext->uniqueID()) {
+ if (context->contextPriv().contextID() != fContext->contextPriv().contextID()) {
SkASSERT(0);
return nullptr;
}
@@ -498,8 +509,8 @@
}
tex->resourcePriv().setUniqueKey(fLastFulfilledKey);
SkASSERT(fContextID == SK_InvalidUniqueID ||
- fContextID == tex->getContext()->uniqueID());
- fContextID = tex->getContext()->uniqueID();
+ fContextID == tex->getContext()->contextPriv().contextID());
+ fContextID = tex->getContext()->contextPriv().contextID();
promiseTexture->addKeyToInvalidate(fContextID, fLastFulfilledKey);
return std::move(tex);
}