aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar Brian Osman <brianosman@google.com>2018-04-13 15:48:26 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-04-13 20:41:12 +0000
commit584b501816657e38b8c1406103a54c3c7fc1c5e4 (patch)
tree23fc25cba3f04759c7718c549970d1837eb04530 /include
parent7e87e84d850ae47fafc71db03db9118758d69f4d (diff)
Support downscaling to max texture size when making cross-context images
This is one solution to https://github.com/flutter/flutter/issues/16454 Change-Id: Iacd59f07e1bf87b6caccb64df16ab8827dfc78b1 Reviewed-on: https://skia-review.googlesource.com/121342 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Brian Osman <brianosman@google.com>
Diffstat (limited to 'include')
-rw-r--r--include/core/SkImage.h28
1 files changed, 16 insertions, 12 deletions
diff --git a/include/core/SkImage.h b/include/core/SkImage.h
index c4b5efb1e7..6d3ae42fa4 100644
--- a/include/core/SkImage.h
+++ b/include/core/SkImage.h
@@ -240,14 +240,16 @@ public:
SkImage is returned using MakeFromEncoded() if context is nullptr or does not support
moving resources between contexts.
- @param context GPU context
- @param data SkImage to decode
- @param buildMips create SkImage as Mip_Map if true
- @param dstColorSpace range of colors of matching SkSurface on GPU
- @return created SkImage, or nullptr
+ @param context GPU context
+ @param data SkImage to decode
+ @param buildMips create SkImage as Mip_Map if true
+ @param dstColorSpace range of colors of matching SkSurface on GPU
+ @param limitToMaxTextureSize downscale image to GPU maximum texture size, if necessary
+ @return created SkImage, or nullptr
*/
static sk_sp<SkImage> MakeCrossContextFromEncoded(GrContext* context, sk_sp<SkData> data,
- bool buildMips, SkColorSpace* dstColorSpace);
+ bool buildMips, SkColorSpace* dstColorSpace,
+ bool limitToMaxTextureSize = false);
/** Creates SkImage from pixmap. SkImage is uploaded to GPU back-end using context.
@@ -267,14 +269,16 @@ public:
as returned in raster format if possible; nullptr may be returned.
Recognized GPU formats vary by platform and GPU back-end.
- @param context GPU context
- @param pixmap SkImageInfo, pixel address, and row bytes
- @param buildMips create SkImage as Mip_Map if true
- @param dstColorSpace range of colors of matching SkSurface on GPU
- @return created SkImage, or nullptr
+ @param context GPU context
+ @param pixmap SkImageInfo, pixel address, and row bytes
+ @param buildMips create SkImage as Mip_Map if true
+ @param dstColorSpace range of colors of matching SkSurface on GPU
+ @param limitToMaxTextureSize downscale image to GPU maximum texture size, if necessary
+ @return created SkImage, or nullptr
*/
static sk_sp<SkImage> MakeCrossContextFromPixmap(GrContext* context, const SkPixmap& pixmap,
- bool buildMips, SkColorSpace* dstColorSpace);
+ bool buildMips, SkColorSpace* dstColorSpace,
+ bool limitToMaxTextureSize = false);
/** Creates SkImage from backendTexture associated with context. backendTexture and
returned SkImage are managed internally, and are released when no longer needed.