aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/core/SkImageGenerator.h
diff options
context:
space:
mode:
authorGravatar Matt Sarett <msarett@google.com>2017-03-24 16:31:19 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-04-03 18:32:42 +0000
commitd531ca038fac8acb3320a78c393c002ca59768fe (patch)
tree2d9891fae706bf8aa7972dda94b01cb6a56cf45c /include/core/SkImageGenerator.h
parent8576014d8a8b799b30dbee4b9d86571fc4781807 (diff)
Use SkTransferFunctionBehavior in SkImageGenerator
This fixes SkColorSpaceXformCanvas gms that expect non-linear premuls from the codec. BUG=skia: Change-Id: I5dc236d0cd760c23605a26e9c33ddb18955f9231 Reviewed-on: https://skia-review.googlesource.com/10164 Reviewed-by: Mike Klein <mtklein@chromium.org> Commit-Queue: Matt Sarett <msarett@google.com>
Diffstat (limited to 'include/core/SkImageGenerator.h')
-rw-r--r--include/core/SkImageGenerator.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/include/core/SkImageGenerator.h b/include/core/SkImageGenerator.h
index 6263dee574..8624359e1a 100644
--- a/include/core/SkImageGenerator.h
+++ b/include/core/SkImageGenerator.h
@@ -177,6 +177,23 @@ protected:
return false;
}
+ struct Options {
+ Options()
+ : fColorTable(nullptr)
+ , fColorTableCount(nullptr)
+ , fBehavior(SkTransferFunctionBehavior::kRespect)
+ {}
+
+ SkPMColor* fColorTable;
+ int* fColorTableCount;
+ SkTransferFunctionBehavior fBehavior;
+ };
+ bool getPixels(const SkImageInfo& info, void* pixels, size_t rowBytes, const Options* opts);
+ virtual bool onGetPixels(const SkImageInfo& info, void* pixels, size_t rowBytes,
+ const Options& opts) {
+ return this->onGetPixels(info, pixels, rowBytes, opts.fColorTable, opts.fColorTableCount);
+ }
+
#if SK_SUPPORT_GPU
virtual sk_sp<GrTextureProxy> onGenerateTexture(GrContext*, const SkImageInfo&,
const SkIPoint&);
@@ -186,6 +203,8 @@ private:
const SkImageInfo fInfo;
const uint32_t fUniqueID;
+ friend class SkImageCacherator;
+
// This is our default impl, which may be different on different platforms.
// It is called from NewFromEncoded() after it has checked for any runtime factory.
// The SkData will never be NULL, as that will have been checked by NewFromEncoded.