[graphite] Centralize Graphite onMakeTextureImage stubs in SkImage_GpuBase
This is just some minor refactoring/cleanup from an omnibus CL.
Bug: b/237111152
Change-Id: I09e6ab2c975b6c45eda4258cba728b237e398dec
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/627697
Reviewed-by: James Godfrey-Kittle <jamesgk@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp
index f86ce2f..8f43d46 100644
--- a/src/image/SkImage_Gpu.cpp
+++ b/src/image/SkImage_Gpu.cpp
@@ -40,10 +40,6 @@
#include "src/gpu/ganesh/SurfaceFillContext.h"
#include "src/gpu/ganesh/effects/GrTextureEffect.h"
-#ifdef SK_GRAPHITE_ENABLED
-#include "src/gpu/graphite/Log.h"
-#endif
-
#include <cstddef>
#include <cstring>
#include <type_traits>
@@ -866,15 +862,6 @@
return {std::move(view), ct};
}
-#ifdef SK_GRAPHITE_ENABLED
-sk_sp<SkImage> SkImage_Gpu::onMakeTextureImage(skgpu::graphite::Recorder*,
- SkImage::RequiredImageProperties) const {
- SKGPU_LOG_W("Cannot convert Ganesh-backed image to Graphite");
- return nullptr;
-}
-#endif
-
-
std::unique_ptr<GrFragmentProcessor> SkImage_Gpu::onAsFragmentProcessor(
GrRecordingContext* rContext,
SkSamplingOptions sampling,
diff --git a/src/image/SkImage_Gpu.h b/src/image/SkImage_Gpu.h
index b47c6f0..7fc507a 100644
--- a/src/image/SkImage_Gpu.h
+++ b/src/image/SkImage_Gpu.h
@@ -85,11 +85,6 @@
GrMipmapped,
GrImageTexGenPolicy) const override;
-#ifdef SK_GRAPHITE_ENABLED
- sk_sp<SkImage> onMakeTextureImage(skgpu::graphite::Recorder*,
- RequiredImageProperties) const override;
-#endif
-
std::unique_ptr<GrFragmentProcessor> onAsFragmentProcessor(GrRecordingContext*,
SkSamplingOptions,
const SkTileMode[2],
diff --git a/src/image/SkImage_GpuBase.cpp b/src/image/SkImage_GpuBase.cpp
index 1e37c00..51a4eef 100644
--- a/src/image/SkImage_GpuBase.cpp
+++ b/src/image/SkImage_GpuBase.cpp
@@ -28,8 +28,12 @@
#include "src/image/SkImage_Gpu.h"
#include "src/image/SkReadPixelsRec.h"
+#ifdef SK_GRAPHITE_ENABLED
+#include "src/gpu/graphite/Log.h"
+#endif
+
SkImage_GpuBase::SkImage_GpuBase(sk_sp<GrImageContext> context, SkImageInfo info, uint32_t uniqueID)
- : INHERITED(std::move(info), uniqueID)
+ : SkImage_Base(std::move(info), uniqueID)
, fContext(std::move(context)) {}
//////////////////////////////////////////////////////////////////////////////////////////////////
@@ -159,6 +163,14 @@
this->imageInfo().colorInfo());
}
+#ifdef SK_GRAPHITE_ENABLED
+sk_sp<SkImage> SkImage_GpuBase::onMakeTextureImage(skgpu::graphite::Recorder*,
+ SkImage::RequiredImageProperties) const {
+ SKGPU_LOG_W("Cannot convert Ganesh-backed image to Graphite");
+ return nullptr;
+}
+#endif
+
bool SkImage_GpuBase::onReadPixels(GrDirectContext* dContext,
const SkImageInfo& dstInfo,
void* dstPixels,
diff --git a/src/image/SkImage_GpuBase.h b/src/image/SkImage_GpuBase.h
index 4a80147..6cb9d10 100644
--- a/src/image/SkImage_GpuBase.h
+++ b/src/image/SkImage_GpuBase.h
@@ -60,7 +60,10 @@
sk_sp<GrImageContext> fContext;
private:
- using INHERITED = SkImage_Base;
+#ifdef SK_GRAPHITE_ENABLED
+ sk_sp<SkImage> onMakeTextureImage(skgpu::graphite::Recorder*,
+ RequiredImageProperties) const final;
+#endif
};
#endif
diff --git a/src/image/SkImage_GpuYUVA.cpp b/src/image/SkImage_GpuYUVA.cpp
index 432e2e3..47ff12b 100644
--- a/src/image/SkImage_GpuYUVA.cpp
+++ b/src/image/SkImage_GpuYUVA.cpp
@@ -28,10 +28,6 @@
#include "src/gpu/ganesh/effects/GrYUVtoRGBEffect.h"
#include "src/image/SkImage_Gpu.h"
-#ifdef SK_GRAPHITE_ENABLED
-#include "src/gpu/graphite/Log.h"
-#endif
-
static constexpr auto kAssumedColorType = kRGBA_8888_SkColorType;
SkImage_GpuYUVA::SkImage_GpuYUVA(sk_sp<GrImageContext> context,
@@ -231,15 +227,6 @@
return fp;
}
-
-#ifdef SK_GRAPHITE_ENABLED
-sk_sp<SkImage> SkImage_GpuYUVA::onMakeTextureImage(skgpu::graphite::Recorder*,
- RequiredImageProperties) const {
- SKGPU_LOG_W("Cannot convert Ganesh-backed YUVA image to Graphite");
- return nullptr;
-}
-#endif
-
//////////////////////////////////////////////////////////////////////////////////////////////////
sk_sp<SkImage> SkImage::MakeFromYUVATextures(GrRecordingContext* context,
diff --git a/src/image/SkImage_GpuYUVA.h b/src/image/SkImage_GpuYUVA.h
index 440f0fb..85e5223 100644
--- a/src/image/SkImage_GpuYUVA.h
+++ b/src/image/SkImage_GpuYUVA.h
@@ -60,11 +60,6 @@
const SkRect*,
const SkRect*) const override;
-#ifdef SK_GRAPHITE_ENABLED
- sk_sp<SkImage> onMakeTextureImage(skgpu::graphite::Recorder*,
- RequiredImageProperties) const override;
-#endif
-
mutable GrYUVATextureProxies fYUVAProxies;
// If this is non-null then the planar data should be converted from fFromColorSpace to