Remove SkImageGeneratorUtils. None of this code is used.
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1778613002
Review URL: https://codereview.chromium.org/1778613002
diff --git a/gyp/utils.gypi b/gyp/utils.gypi
index 018eb12..bc59f27 100644
--- a/gyp/utils.gypi
+++ b/gyp/utils.gypi
@@ -50,7 +50,6 @@
'<(skia_src_path)/utils/SkDumpCanvas.cpp',
'<(skia_src_path)/utils/SkEventTracer.cpp',
'<(skia_src_path)/utils/SkFloatUtils.h',
- '<(skia_src_path)/utils/SkImageGeneratorUtils.cpp',
'<(skia_src_path)/utils/SkInterpolator.cpp',
'<(skia_src_path)/utils/SkLayer.cpp',
'<(skia_src_path)/utils/SkMatrix22.cpp',
diff --git a/src/utils/SkImageGeneratorUtils.cpp b/src/utils/SkImageGeneratorUtils.cpp
deleted file mode 100644
index ebffb30..0000000
--- a/src/utils/SkImageGeneratorUtils.cpp
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * Copyright 2015 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "SkImageGeneratorUtils.h"
-#include "SkBitmap.h"
-
-class GeneratorFromEmpty : public SkImageGenerator {
-public:
- GeneratorFromEmpty(const SkImageInfo& info) : SkImageGenerator(info) {}
-};
-
-SkImageGenerator* SkImageGeneratorUtils::NewEmpty(const SkImageInfo& info) {
- return new GeneratorFromEmpty(info);
-}
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-class GeneratorFromBitmap : public SkImageGenerator {
-public:
- GeneratorFromBitmap(const SkBitmap& bm) : SkImageGenerator(bm.info()), fBM(bm) {
- if (!bm.isImmutable()) {
- bm.copyTo(&fBM);
- }
- }
-
-protected:
- bool onGetPixels(const SkImageInfo& info, void* pixels, size_t rowBytes,
- SkPMColor*, int*) override {
- return fBM.readPixels(info, pixels, rowBytes, 0, 0);
- }
-
-private:
- SkBitmap fBM;
-};
-
-SkImageGenerator* SkImageGeneratorUtils::NewFromBitmap(const SkBitmap& bm) {
- return new GeneratorFromBitmap(bm);
-}
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-#if SK_SUPPORT_GPU
-
-#include "GrContext.h"
-#include "GrTexture.h"
-#include "SkGrPriv.h"
-
-class GeneratorFromTexture : public SkImageGenerator {
-public:
- GeneratorFromTexture(GrContext* ctx, GrTexture* tex, const SkImageInfo& info)
- : SkImageGenerator(info), fCtx(ctx), fTexture(tex)
- {}
-
-protected:
- GrTexture* onGenerateTexture(GrContext* ctx, const SkIRect* subset) override {
- if (ctx) {
- SkASSERT(ctx == fCtx.get());
- }
-
- if (!subset) {
- return SkRef(fTexture.get());
- }
- // need to copy the subset into a new texture
- GrSurfaceDesc desc = fTexture->desc();
- desc.fWidth = subset->width();
- desc.fHeight = subset->height();
-
- GrTexture* dst = fCtx->textureProvider()->createTexture(desc, SkBudgeted::kNo);
- fCtx->copySurface(dst, fTexture, *subset, SkIPoint::Make(0, 0));
- return dst;
- }
-private:
- SkAutoTUnref<GrContext> fCtx;
- SkAutoTUnref<GrTexture> fTexture;
-};
-#endif
-
-SkImageGenerator* SkImageGeneratorUtils::NewFromTexture(GrContext* ctx, GrTexture* tex) {
-#if SK_SUPPORT_GPU
- if (ctx && tex) {
- const GrSurfaceDesc desc = tex->desc();
-
- SkColorType ct;
- SkColorProfileType cpt;
- if (!GrPixelConfig2ColorAndProfileType(desc.fConfig, &ct, &cpt)) {
- return nullptr;
- }
- const SkAlphaType at = kPremul_SkAlphaType; // take isOpaque from caller?
- SkImageInfo info = SkImageInfo::Make(desc.fWidth, desc.fHeight, ct, at, cpt);
- return new GeneratorFromTexture(ctx, tex, info);
- }
-#endif
- return nullptr;
-}
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-#include "SkImage.h"
-
-class GeneratorFromImage : public SkImageGenerator {
-public:
- GeneratorFromImage(const SkImage* image, const SkImageInfo& info)
- : SkImageGenerator(info), fImage(image) {}
-
-protected:
- bool onGetPixels(const SkImageInfo& info, void* pixels, size_t rowBytes,
- SkPMColor*, int*) override {
- return fImage->readPixels(info, pixels, rowBytes, 0, 0);
- }
-
- GrTexture* onGenerateTexture(GrContext* ctx, const SkIRect* subset) override {
- // waiting on https://code.google.com/p/skia/issues/detail?id=4233
- return nullptr;
- }
-
-private:
- SkAutoTUnref<const SkImage> fImage;
-};
-
-SkImageGenerator* SkImageGeneratorUtils::NewFromImage(const SkImage* image) {
- if (image) {
- const SkColorType ct = kN32_SkColorType;
- const SkAlphaType at = image->isOpaque() ? kOpaque_SkAlphaType : kPremul_SkAlphaType;
- const SkImageInfo info = SkImageInfo::Make(image->width(), image->height(), ct, at);
- return new GeneratorFromImage(image, info);
- }
- return nullptr;
-}
-
-
diff --git a/src/utils/SkImageGeneratorUtils.h b/src/utils/SkImageGeneratorUtils.h
deleted file mode 100644
index 940d12d..0000000
--- a/src/utils/SkImageGeneratorUtils.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright 2015 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifndef SkImageGeneratorUtils_DEFINED
-#define SkImageGeneratorUtils_DEFINED
-
-#include "SkImageGenerator.h"
-
-class SkImage;
-
-class SkImageGeneratorUtils {
-public:
- // Returns a generator of the specified dimensions, but will always fail to return anything
- static SkImageGenerator* NewEmpty(const SkImageInfo&);
-
- // If the bitmap is mutable, it will make a copy first
- static SkImageGenerator* NewFromBitmap(const SkBitmap&);
-
- // Ref's the provided texture, so it had better be const!
- static SkImageGenerator* NewFromTexture(GrContext*, GrTexture*);
-
- static SkImageGenerator* NewFromImage(const SkImage*);
-};
-
-#endif