aboutsummaryrefslogtreecommitdiffhomepage
path: root/docs
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 /docs
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 'docs')
-rw-r--r--docs/SkImage_Reference.bmh36
1 files changed, 20 insertions, 16 deletions
diff --git a/docs/SkImage_Reference.bmh b/docs/SkImage_Reference.bmh
index 7d93555b68..32ddbe3397 100644
--- a/docs/SkImage_Reference.bmh
+++ b/docs/SkImage_Reference.bmh
@@ -465,7 +465,8 @@ for (auto origin : { kBottomLeft_GrSurfaceOrigin, kTopLeft_GrSurfaceOrigin } ) {
#Method static sk_sp<SkImage> MakeCrossContextFromEncoded(GrContext* context, sk_sp<SkData> data,
bool buildMips,
- SkColorSpace* dstColorSpace)
+ SkColorSpace* dstColorSpace,
+ bool limitToMaxTextureSize = false)
#In Constructor
#Line # creates Image from encoded data, and uploads to GPU ##
@@ -491,6 +492,7 @@ moving resources between contexts.
#Param data Image to decode ##
#Param buildMips create Image as Mip_Map if true ##
#Param dstColorSpace range of colors of matching Surface on GPU ##
+#Param limitToMaxTextureSize downscale image to GPU maximum texture size, if necessary ##
#Return created Image, or nullptr ##
@@ -512,7 +514,8 @@ canvas->drawImage(image, 0, 0);
#Method static sk_sp<SkImage> MakeCrossContextFromPixmap(GrContext* context, const SkPixmap& pixmap,
bool buildMips,
- SkColorSpace* dstColorSpace)
+ SkColorSpace* dstColorSpace,
+ bool limitToMaxTextureSize = false)
#In Constructor
#Line # creates Image from Pixmap, and uploads to GPU ##
@@ -538,6 +541,7 @@ Recognized GPU formats vary by platform and GPU back-end.
#Param pixmap Image_Info, pixel address, and row bytes ##
#Param buildMips create Image as Mip_Map if true ##
#Param dstColorSpace range of colors of matching Surface on GPU ##
+#Param limitToMaxTextureSize downscale image to GPU maximum texture size, if necessary ##
#Return created Image, or nullptr ##
@@ -1413,20 +1417,20 @@ If origin in not nullptr, copies location of content drawn into Image.
#Example
#Image 3
#Platform gpu
- GrContext* grContext = canvas->getGrContext();
- if (!grContext) {
- canvas->drawString("GPU only!", 20, 40, SkPaint());
- return;
- }
- sk_sp<SkImage> imageFromBackend = SkImage::MakeFromAdoptedTexture(grContext, backEndTexture,
- kBottomLeft_GrSurfaceOrigin, kRGBA_8888_SkColorType, kOpaque_SkAlphaType);
- GrBackendTexture textureFromImage = imageFromBackend->getBackendTexture(false);
- if (!textureFromImage.isValid()) {
- return;
- }
- sk_sp<SkImage> imageFromTexture = SkImage::MakeFromAdoptedTexture(grContext, textureFromImage,
- kTopLeft_GrSurfaceOrigin, kRGBA_8888_SkColorType, kOpaque_SkAlphaType);
- canvas->drawImage(imageFromTexture, 0, 0);
+ GrContext* grContext = canvas->getGrContext();
+ if (!grContext) {
+ canvas->drawString("GPU only!", 20, 40, SkPaint());
+ return;
+ }
+ sk_sp<SkImage> imageFromBackend = SkImage::MakeFromAdoptedTexture(grContext, backEndTexture,
+ kBottomLeft_GrSurfaceOrigin, kRGBA_8888_SkColorType, kOpaque_SkAlphaType);
+ GrBackendTexture textureFromImage = imageFromBackend->getBackendTexture(false);
+ if (!textureFromImage.isValid()) {
+ return;
+ }
+ sk_sp<SkImage> imageFromTexture = SkImage::MakeFromAdoptedTexture(grContext, textureFromImage,
+ kTopLeft_GrSurfaceOrigin, kRGBA_8888_SkColorType, kOpaque_SkAlphaType);
+ canvas->drawImage(imageFromTexture, 0, 0);
canvas->drawImage(imageFromBackend, 128, 128);
##