Cleanup SkImageGenerator, add missing fns to GrBackendTextureImageGenerator
No "real" API changes.
TBR=reed@google.com
Bug: skia:
Change-Id: I08c29f76806388394938f204f2a50b2fd6ea8942
Reviewed-on: https://skia-review.googlesource.com/16662
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Matt Sarett <msarett@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
diff --git a/include/core/SkImageGenerator.h b/include/core/SkImageGenerator.h
index 3e433a3..8e875da 100644
--- a/include/core/SkImageGenerator.h
+++ b/include/core/SkImageGenerator.h
@@ -169,19 +169,14 @@
SkImageGenerator(const SkImageInfo& info, uint32_t uniqueId = kNeedNewImageUniqueID);
- virtual SkData* onRefEncodedData();
+ virtual SkData* onRefEncodedData() { return nullptr; }
- virtual bool onGetPixels(const SkImageInfo& info, void* pixels, size_t rowBytes,
- SkPMColor ctable[], int* ctableCount);
+ virtual bool onGetPixels(const SkImageInfo&, void*, size_t, SkPMColor[], int*) { return false; }
- virtual bool onIsValid(GrContext*) const;
+ virtual bool onIsValid(GrContext*) const { return true; }
- virtual bool onQueryYUV8(SkYUVSizeInfo*, SkYUVColorSpace*) const {
- return false;
- }
- virtual bool onGetYUV8Planes(const SkYUVSizeInfo&, void*[3] /*planes*/) {
- return false;
- }
+ virtual bool onQueryYUV8(SkYUVSizeInfo*, SkYUVColorSpace*) const { return false; }
+ virtual bool onGetYUV8Planes(const SkYUVSizeInfo&, void*[3] /*planes*/) { return false; }
struct Options {
Options()
diff --git a/src/core/SkImageGenerator.cpp b/src/core/SkImageGenerator.cpp
index fe9bb00..35eaf89 100644
--- a/src/core/SkImageGenerator.cpp
+++ b/src/core/SkImageGenerator.cpp
@@ -104,21 +104,6 @@
}
#endif
-/////////////////////////////////////////////////////////////////////////////////////////////
-
-SkData* SkImageGenerator::onRefEncodedData() {
- return nullptr;
-}
-
-bool SkImageGenerator::onGetPixels(const SkImageInfo& info, void* dst, size_t rb,
- SkPMColor* colors, int* colorCount) {
- return false;
-}
-
-bool SkImageGenerator::onIsValid(GrContext*) const {
- return true;
-}
-
///////////////////////////////////////////////////////////////////////////////////////////////////
#include "SkBitmap.h"
diff --git a/src/gpu/GrBackendTextureImageGenerator.cpp b/src/gpu/GrBackendTextureImageGenerator.cpp
index d92b32f..da9fe69 100644
--- a/src/gpu/GrBackendTextureImageGenerator.cpp
+++ b/src/gpu/GrBackendTextureImageGenerator.cpp
@@ -89,20 +89,6 @@
fRefHelper->unref();
}
-bool GrBackendTextureImageGenerator::onGetPixels(const SkImageInfo& info, void* pixels,
- size_t rowBytes, SkPMColor ctable[],
- int* ctableCount) {
- // TODO: Is there any way to implement this? I don't think so.
- return false;
-}
-
-bool GrBackendTextureImageGenerator::onGetPixels(const SkImageInfo& info, void* pixels,
- size_t rowBytes, const Options& opts) {
-
- // TODO: Is there any way to implement this? I don't think so.
- return false;
-}
-
///////////////////////////////////////////////////////////////////////////////////////////////////
#if SK_SUPPORT_GPU
diff --git a/src/gpu/GrBackendTextureImageGenerator.h b/src/gpu/GrBackendTextureImageGenerator.h
index 2f35895..1a316d1 100644
--- a/src/gpu/GrBackendTextureImageGenerator.h
+++ b/src/gpu/GrBackendTextureImageGenerator.h
@@ -22,12 +22,12 @@
~GrBackendTextureImageGenerator();
protected:
- bool onGetPixels(const SkImageInfo& info, void* pixels, size_t rowBytes, SkPMColor ctable[],
- int* ctableCount) override;
- bool onGetPixels(const SkImageInfo& info, void* pixels, size_t rowBytes, const Options& opts)
- override;
+ // NOTE: We would like to validate that the owning context hasn't been abandoned, but we can't
+ // do that safely (we might be on another thread). So assume everything is fine.
+ bool onIsValid(GrContext*) const override { return true; }
#if SK_SUPPORT_GPU
+ bool onCanGenerateTexture() const override { return true; }
sk_sp<GrTextureProxy> onGenerateTexture(GrContext*, const SkImageInfo&,
const SkIPoint&) override;
#endif