diff options
author | Greg Daniel <egdaniel@google.com> | 2017-10-09 09:57:35 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-10-11 17:11:07 +0000 |
commit | f88c12ea2047c5ccb13613534b1794944bb233e8 (patch) | |
tree | 47e6ddc042c84d39a4578c0889ae8df41e0e53be /src | |
parent | 1fc0909065d7c1d629d4c177c5cbfc0f8d9d9d88 (diff) |
Add api for passing mipped hint into ImageGenerator onGenerateTexture
This does not actually add any additional functionality to the generators.
Once this lands I will enable the generators one at a time to more easily
monitor the effects of each one.
Bug: skia:
Change-Id: I382a1acfaebcbf9ad44c9873b87cdbbe02a13602
Reviewed-on: https://skia-review.googlesource.com/57083
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/core/SkColorSpaceXformImageGenerator.cpp | 2 | ||||
-rw-r--r-- | src/core/SkColorSpaceXformImageGenerator.h | 3 | ||||
-rw-r--r-- | src/core/SkImageGenerator.cpp | 8 | ||||
-rw-r--r-- | src/core/SkPictureImageGenerator.cpp | 2 | ||||
-rw-r--r-- | src/core/SkPictureImageGenerator.h | 3 | ||||
-rw-r--r-- | src/gpu/GrAHardwareBufferImageGenerator.cpp | 2 | ||||
-rw-r--r-- | src/gpu/GrAHardwareBufferImageGenerator.h | 3 | ||||
-rw-r--r-- | src/gpu/GrBackendTextureImageGenerator.cpp | 2 | ||||
-rw-r--r-- | src/gpu/GrBackendTextureImageGenerator.h | 3 | ||||
-rw-r--r-- | src/image/SkImage_Lazy.cpp | 6 |
10 files changed, 19 insertions, 15 deletions
diff --git a/src/core/SkColorSpaceXformImageGenerator.cpp b/src/core/SkColorSpaceXformImageGenerator.cpp index ea277fe410..94566d5d2a 100644 --- a/src/core/SkColorSpaceXformImageGenerator.cpp +++ b/src/core/SkColorSpaceXformImageGenerator.cpp @@ -64,7 +64,7 @@ bool SkColorSpaceXformImageGenerator::onGetPixels(const SkImageInfo& info, void* sk_sp<GrTextureProxy> SkColorSpaceXformImageGenerator::onGenerateTexture( GrContext* ctx, const SkImageInfo& info, const SkIPoint& origin, - SkTransferFunctionBehavior) { + SkTransferFunctionBehavior, bool willNeedMipMaps) { // FIXME: // This always operates as if SkTranferFunctionBehavior is kIgnore. Should we add // options so that caller can also request kRespect? diff --git a/src/core/SkColorSpaceXformImageGenerator.h b/src/core/SkColorSpaceXformImageGenerator.h index ab72eba9ff..3fd6b94a23 100644 --- a/src/core/SkColorSpaceXformImageGenerator.h +++ b/src/core/SkColorSpaceXformImageGenerator.h @@ -23,7 +23,8 @@ protected: #if SK_SUPPORT_GPU sk_sp<GrTextureProxy> onGenerateTexture(GrContext*, const SkImageInfo&, const SkIPoint&, - SkTransferFunctionBehavior) override; + SkTransferFunctionBehavior, + bool willNeedMipMaps) override; TexGenType onCanGenerateTexture() const override { return TexGenType::kExpensive; } diff --git a/src/core/SkImageGenerator.cpp b/src/core/SkImageGenerator.cpp index a3e825302b..865a718e44 100644 --- a/src/core/SkImageGenerator.cpp +++ b/src/core/SkImageGenerator.cpp @@ -66,17 +66,19 @@ bool SkImageGenerator::getYUV8Planes(const SkYUVSizeInfo& sizeInfo, void* planes sk_sp<GrTextureProxy> SkImageGenerator::generateTexture(GrContext* ctx, const SkImageInfo& info, const SkIPoint& origin, - SkTransferFunctionBehavior behavior) { + SkTransferFunctionBehavior behavior, + bool willNeedMipMaps) { SkIRect srcRect = SkIRect::MakeXYWH(origin.x(), origin.y(), info.width(), info.height()); if (!SkIRect::MakeWH(fInfo.width(), fInfo.height()).contains(srcRect)) { return nullptr; } - return this->onGenerateTexture(ctx, info, origin, behavior); + return this->onGenerateTexture(ctx, info, origin, behavior, willNeedMipMaps); } sk_sp<GrTextureProxy> SkImageGenerator::onGenerateTexture(GrContext*, const SkImageInfo&, const SkIPoint&, - SkTransferFunctionBehavior) { + SkTransferFunctionBehavior, + bool willNeedMipMaps) { return nullptr; } #endif diff --git a/src/core/SkPictureImageGenerator.cpp b/src/core/SkPictureImageGenerator.cpp index 75861329d6..f6c36ca93c 100644 --- a/src/core/SkPictureImageGenerator.cpp +++ b/src/core/SkPictureImageGenerator.cpp @@ -102,7 +102,7 @@ SkImageGenerator::MakeFromPicture(const SkISize& size, sk_sp<SkPicture> picture, #if SK_SUPPORT_GPU sk_sp<GrTextureProxy> SkPictureImageGenerator::onGenerateTexture( GrContext* ctx, const SkImageInfo& info, const SkIPoint& origin, - SkTransferFunctionBehavior behavior) { + SkTransferFunctionBehavior behavior, bool willNeedMipMaps) { SkASSERT(ctx); bool useXformCanvas = SkTransferFunctionBehavior::kIgnore == behavior && info.colorSpace(); diff --git a/src/core/SkPictureImageGenerator.h b/src/core/SkPictureImageGenerator.h index f2ebc809c9..4c5f8e3a75 100644 --- a/src/core/SkPictureImageGenerator.h +++ b/src/core/SkPictureImageGenerator.h @@ -23,7 +23,8 @@ protected: #if SK_SUPPORT_GPU TexGenType onCanGenerateTexture() const override { return TexGenType::kExpensive; } sk_sp<GrTextureProxy> onGenerateTexture(GrContext*, const SkImageInfo&, const SkIPoint&, - SkTransferFunctionBehavior) override; + SkTransferFunctionBehavior, + bool willNeedMipMaps) override; #endif private: diff --git a/src/gpu/GrAHardwareBufferImageGenerator.cpp b/src/gpu/GrAHardwareBufferImageGenerator.cpp index ba8e9d7486..164e3d6d45 100644 --- a/src/gpu/GrAHardwareBufferImageGenerator.cpp +++ b/src/gpu/GrAHardwareBufferImageGenerator.cpp @@ -98,7 +98,7 @@ void GrAHardwareBufferImageGenerator::deleteImageTexture(void* context) { sk_sp<GrTextureProxy> GrAHardwareBufferImageGenerator::onGenerateTexture( GrContext* context, const SkImageInfo& info, const SkIPoint& origin, - SkTransferFunctionBehavior) { + SkTransferFunctionBehavior, bool willNeedMipMaps) { auto proxy = this->makeProxy(context); if (!proxy) { return nullptr; diff --git a/src/gpu/GrAHardwareBufferImageGenerator.h b/src/gpu/GrAHardwareBufferImageGenerator.h index f270d6ac9b..e1814f8b47 100644 --- a/src/gpu/GrAHardwareBufferImageGenerator.h +++ b/src/gpu/GrAHardwareBufferImageGenerator.h @@ -36,7 +36,8 @@ protected: #if SK_SUPPORT_GPU TexGenType onCanGenerateTexture() const override { return TexGenType::kCheap; } sk_sp<GrTextureProxy> onGenerateTexture(GrContext*, const SkImageInfo&, const SkIPoint&, - SkTransferFunctionBehavior) override; + SkTransferFunctionBehavior, + bool willNeedMipMaps) override; #endif private: diff --git a/src/gpu/GrBackendTextureImageGenerator.cpp b/src/gpu/GrBackendTextureImageGenerator.cpp index cedc60cc5b..93596cf6bd 100644 --- a/src/gpu/GrBackendTextureImageGenerator.cpp +++ b/src/gpu/GrBackendTextureImageGenerator.cpp @@ -118,7 +118,7 @@ void GrBackendTextureImageGenerator::ReleaseRefHelper_TextureReleaseProc(void* c sk_sp<GrTextureProxy> GrBackendTextureImageGenerator::onGenerateTexture( GrContext* context, const SkImageInfo& info, const SkIPoint& origin, - SkTransferFunctionBehavior) { + SkTransferFunctionBehavior, bool willNeedMipMaps) { SkASSERT(context); if (context->contextPriv().getBackend() != fBackendTexture.backend()) { diff --git a/src/gpu/GrBackendTextureImageGenerator.h b/src/gpu/GrBackendTextureImageGenerator.h index f99055ab86..bebb736750 100644 --- a/src/gpu/GrBackendTextureImageGenerator.h +++ b/src/gpu/GrBackendTextureImageGenerator.h @@ -30,7 +30,8 @@ protected: #if SK_SUPPORT_GPU TexGenType onCanGenerateTexture() const override { return TexGenType::kCheap; } sk_sp<GrTextureProxy> onGenerateTexture(GrContext*, const SkImageInfo&, const SkIPoint&, - SkTransferFunctionBehavior) override; + SkTransferFunctionBehavior, + bool willNeedMipMaps) override; #endif private: diff --git a/src/image/SkImage_Lazy.cpp b/src/image/SkImage_Lazy.cpp index 5e3c037402..8e055f395e 100644 --- a/src/image/SkImage_Lazy.cpp +++ b/src/image/SkImage_Lazy.cpp @@ -788,10 +788,8 @@ sk_sp<GrTextureProxy> SkImage_Lazy::lockTextureProxy(GrContext* ctx, SkImageGenerator::TexGenType::kCheap != generator->onCanGenerateTexture()) { return nullptr; } - // TODO: Pass a flag into generateTexture which says we want to be mipped. If the generator - // can handle creating a mipped surface, then it can either generate the base layer or all - // the layers directly. Otherwise it just returns a non mipped surface as it currently does. - if ((proxy = generator->generateTexture(ctx, genPixelsInfo, fOrigin, behavior))) { + if ((proxy = generator->generateTexture(ctx, genPixelsInfo, fOrigin, behavior, + willBeMipped))) { SK_HISTOGRAM_ENUMERATION("LockTexturePath", kNative_LockTexturePath, kLockTexturePathCount); set_key_on_proxy(ctx->resourceProvider(), proxy.get(), nullptr, key); |