Narrow the SkImageGenerator interface
authorBrian Osman <brianosman@google.com>
Mon, 28 Nov 2016 16:54:42 +0000 (11:54 -0500)
committerSkia Commit-Bot <skia-commit-bot@chromium.org>
Mon, 28 Nov 2016 19:50:22 +0000 (19:50 +0000)
Remove some unused variants of bitmap generation and a helper that
serves no purpose.

BUG=skia:
TBR=reed@google.com

Change-Id: I16022e7f0242c4511eebdc06d890f6bfdf81d1f9
Reviewed-on: https://skia-review.googlesource.com/5229
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Matt Sarett <msarett@google.com>
gm/pictureimagegenerator.cpp
include/core/SkImageGenerator.h
src/core/SkPictureImageGenerator.cpp

index c340d1f01687f4d0d531fbb658b6022bfec31eae..bf97a65305a1378980a02ffcd9a673c1889fe455 100644 (file)
@@ -156,7 +156,7 @@ protected:
                 SkImageGenerator::NewFromPicture(configs[i].size, fPicture.get(), &m,
                                                  p.getAlpha() != 255 ? &p : nullptr));
             SkBitmap bm;
-            gen->generateBitmap(&bm);
+            gen->generateBitmap(&bm, SkImageInfo::MakeN32Premul(configs[i].size));
 
             const SkScalar x = kDrawSize * (i % kDrawsPerRow);
             const SkScalar y = kDrawSize * (i / kDrawsPerRow);
index c19cbb4fa71d909e4daecb1ea2ac0ca1daae6618..e775d9e02c51f0b2e508057864418876abd70ce0 100644 (file)
@@ -123,15 +123,6 @@ public:
      */
     bool getYUV8Planes(const SkYUVSizeInfo& sizeInfo, void* planes[3]);
 
-    /**
-     *  Returns true if the generate can efficiently return a texture (given the properties of the
-     *  proxy). By default, simple codecs will usually return false, since they must be decoded
-     *  on the CPU and then uploaded to become a texture.
-     */
-    bool canGenerateTexture(const GrContextThreadSafeProxy& proxy) {
-        return this->onCanGenerateTexture(proxy);
-    }
-
     /**
      *  If the generator can natively/efficiently return its pixels as a GPU image (backed by a
      *  texture) this will return that image. If not, this will return NULL.
@@ -250,17 +241,9 @@ public:
     static SkImageGenerator* NewFromPicture(const SkISize&, const SkPicture*, const SkMatrix*,
                                             const SkPaint*);
 
-    bool tryGenerateBitmap(SkBitmap* bm) {
-        return this->tryGenerateBitmap(bm, nullptr, nullptr);
-    }
     bool tryGenerateBitmap(SkBitmap* bm, const SkImageInfo& info, SkBitmap::Allocator* allocator) {
         return this->tryGenerateBitmap(bm, &info, allocator);
     }
-    void generateBitmap(SkBitmap* bm) {
-        if (!this->tryGenerateBitmap(bm, nullptr, nullptr)) {
-            sk_throw();
-        }
-    }
     void generateBitmap(SkBitmap* bm, const SkImageInfo& info) {
         if (!this->tryGenerateBitmap(bm, &info, nullptr)) {
             sk_throw();
@@ -286,9 +269,6 @@ protected:
         return false;
     }
 
-    virtual bool onCanGenerateTexture(const GrContextThreadSafeProxy&) {
-        return false;
-    }
     virtual GrTexture* onGenerateTexture(GrContext*, const SkIRect*) {
         return nullptr;
     }
index 22baf53be77d04bdb758b57ad47006ec380e53b0..b15fadd818fa4bb5eb49c044d7161ff8f13b9753 100644 (file)
@@ -26,9 +26,6 @@ protected:
     bool onGenerateScaledPixels(const SkISize&, const SkIPoint&, const SkPixmap&) override;
 
 #if SK_SUPPORT_GPU
-    bool onCanGenerateTexture(const GrContextThreadSafeProxy&) override {
-        return true;
-    }
     GrTexture* onGenerateTexture(GrContext*, const SkIRect*) override;
 #endif