Revert "Fix NoGPU compilation"
This reverts commit d5a78805c5133bc55e07c5da21f8d72b91a3df4f.
Reason for revert: This was a patch for an earlier change that's going to be reverted as well.
Original change's description:
> Fix NoGPU compilation
>
> All of these functions were written to work without GPU support, just
> forgot to compile them in that situation.
>
> BUG=skia:
>
> GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4796
>
> Change-Id: Ia23d304f07eb16714390b459dd448bc08402f479
> Reviewed-on: https://skia-review.googlesource.com/4796
> Reviewed-by: Brian Osman <brianosman@google.com>
> Reviewed-by: Stan Iliev <stani@google.com>
> Commit-Queue: Brian Osman <brianosman@google.com>
> Commit-Queue: Stan Iliev <stani@google.com>
>
TBR=egdaniel@google.com,brianosman@google.com,stani@google.com,reviews@skia.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
Change-Id: Id0b9db355f416c118c0ef95501a6cfdeb083b54e
Reviewed-on: https://skia-review.googlesource.com/4831
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
diff --git a/src/core/SkImageCacherator.cpp b/src/core/SkImageCacherator.cpp
index 373791e..d6f816e 100644
--- a/src/core/SkImageCacherator.cpp
+++ b/src/core/SkImageCacherator.cpp
@@ -263,6 +263,44 @@
//////////////////////////////////////////////////////////////////////////////////////////////////
+#if SK_SUPPORT_GPU
+
+#ifdef SK_SUPPORT_COMPRESSED_TEXTURES_IN_CACHERATOR
+static GrTexture* load_compressed_into_texture(GrContext* ctx, SkData* data, GrSurfaceDesc desc) {
+ const void* rawStart;
+ GrPixelConfig config = GrIsCompressedTextureDataSupported(ctx, data, desc.fWidth, desc.fHeight,
+ &rawStart);
+ if (kUnknown_GrPixelConfig == config) {
+ return nullptr;
+ }
+
+ desc.fConfig = config;
+ return ctx->textureProvider()->createTexture(desc, SkBudgeted::kYes, rawStart, 0);
+}
+#endif
+
+class Generator_GrYUVProvider : public GrYUVProvider {
+ SkImageGenerator* fGen;
+
+public:
+ Generator_GrYUVProvider(SkImageGenerator* gen) : fGen(gen) {}
+
+ uint32_t onGetID() override { return fGen->uniqueID(); }
+ bool onQueryYUV8(SkYUVSizeInfo* sizeInfo, SkYUVColorSpace* colorSpace) const override {
+ return fGen->queryYUV8(sizeInfo, colorSpace);
+ }
+ bool onGetYUV8Planes(const SkYUVSizeInfo& sizeInfo, void* planes[3]) override {
+ return fGen->getYUV8Planes(sizeInfo, planes);
+ }
+};
+
+static GrTexture* set_key_and_return(GrTexture* tex, const GrUniqueKey& key) {
+ if (key.isValid()) {
+ tex->resourcePriv().setUniqueKey(key);
+ }
+ return tex;
+}
+
// Abstraction of GrCaps that handles the cases where we don't have a caps pointer (because
// we're in raster mode), or where GPU support is entirely missing.
struct CacheCaps {
@@ -428,46 +466,6 @@
}
}
-//////////////////////////////////////////////////////////////////////////////////////////////////
-
-#if SK_SUPPORT_GPU
-
-#ifdef SK_SUPPORT_COMPRESSED_TEXTURES_IN_CACHERATOR
-static GrTexture* load_compressed_into_texture(GrContext* ctx, SkData* data, GrSurfaceDesc desc) {
- const void* rawStart;
- GrPixelConfig config = GrIsCompressedTextureDataSupported(ctx, data, desc.fWidth, desc.fHeight,
- &rawStart);
- if (kUnknown_GrPixelConfig == config) {
- return nullptr;
- }
-
- desc.fConfig = config;
- return ctx->textureProvider()->createTexture(desc, SkBudgeted::kYes, rawStart, 0);
-}
-#endif
-
-class Generator_GrYUVProvider : public GrYUVProvider {
- SkImageGenerator* fGen;
-
-public:
- Generator_GrYUVProvider(SkImageGenerator* gen) : fGen(gen) {}
-
- uint32_t onGetID() override { return fGen->uniqueID(); }
- bool onQueryYUV8(SkYUVSizeInfo* sizeInfo, SkYUVColorSpace* colorSpace) const override {
- return fGen->queryYUV8(sizeInfo, colorSpace);
- }
- bool onGetYUV8Planes(const SkYUVSizeInfo& sizeInfo, void* planes[3]) override {
- return fGen->getYUV8Planes(sizeInfo, planes);
- }
-};
-
-static GrTexture* set_key_and_return(GrTexture* tex, const GrUniqueKey& key) {
- if (key.isValid()) {
- tex->resourcePriv().setUniqueKey(key);
- }
- return tex;
-}
-
/*
* We have a 5 ways to try to return a texture (in sorted order)
*
diff --git a/src/core/SkImageCacherator.h b/src/core/SkImageCacherator.h
index bffea82..fc03e8e 100644
--- a/src/core/SkImageCacherator.h
+++ b/src/core/SkImageCacherator.h
@@ -112,9 +112,6 @@
SkImageCacherator(Validator*);
- CachedFormat chooseCacheFormat(SkDestinationSurfaceColorMode, const GrCaps* = nullptr);
- SkImageInfo buildCacheInfo(CachedFormat);
-
bool generateBitmap(SkBitmap*, const SkImageInfo&);
bool tryLockAsBitmap(SkBitmap*, const SkImage*, SkImage::CachingHint, CachedFormat,
const SkImageInfo&);
@@ -123,6 +120,8 @@
// it should use the passed in key (if the key is valid).
GrTexture* lockTexture(GrContext*, const GrUniqueKey& key, const SkImage* client,
SkImage::CachingHint, bool willBeMipped, SkDestinationSurfaceColorMode);
+ CachedFormat chooseCacheFormat(SkDestinationSurfaceColorMode, const GrCaps* = nullptr);
+ SkImageInfo buildCacheInfo(CachedFormat);
#endif
sk_sp<SharedGenerator> fSharedGenerator;