aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Brian Osman <brianosman@google.com>2016-11-28 11:54:42 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2016-11-28 19:50:22 +0000
commit1b51c5297e08e2858e546b79049c14ad0b29d95d (patch)
treef213caf544f3e0356294d7034a67bf7f420d22ef
parent3ab83e25194ab47dacfd83cad422b82ec9954680 (diff)
Narrow the SkImageGenerator interface
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>
-rw-r--r--gm/pictureimagegenerator.cpp2
-rw-r--r--include/core/SkImageGenerator.h20
-rw-r--r--src/core/SkPictureImageGenerator.cpp3
3 files changed, 1 insertions, 24 deletions
diff --git a/gm/pictureimagegenerator.cpp b/gm/pictureimagegenerator.cpp
index c340d1f016..bf97a65305 100644
--- a/gm/pictureimagegenerator.cpp
+++ b/gm/pictureimagegenerator.cpp
@@ -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);
diff --git a/include/core/SkImageGenerator.h b/include/core/SkImageGenerator.h
index c19cbb4fa7..e775d9e02c 100644
--- a/include/core/SkImageGenerator.h
+++ b/include/core/SkImageGenerator.h
@@ -124,15 +124,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;
}
diff --git a/src/core/SkPictureImageGenerator.cpp b/src/core/SkPictureImageGenerator.cpp
index 22baf53be7..b15fadd818 100644
--- a/src/core/SkPictureImageGenerator.cpp
+++ b/src/core/SkPictureImageGenerator.cpp
@@ -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