aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar Brian Salomon <bsalomon@google.com>2018-03-15 12:16:02 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-03-15 19:41:26 +0000
commit6a426c1d72aba0e37794fb8043cb71645eed4110 (patch)
tree73ba6627156ddb9e12f482597d08df20beade200 /include
parent1a114377898ae10c943695594223e447bee5aeb0 (diff)
Cleanup SkImage YUV texture factories.
Remove unused GrBackendObject variants. Add versions without redundant size param. Make this work with GrBackendTextures that weren't created with a GrPixelConfig. Change-Id: Ic1bbf5f2817cebab938b4f31000126a6ab5c44d5 Reviewed-on: https://skia-review.googlesource.com/114460 Reviewed-by: Greg Daniel <egdaniel@google.com> Commit-Queue: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'include')
-rw-r--r--include/core/SkImage.h76
-rw-r--r--include/gpu/GrBackendSurface.h1
2 files changed, 20 insertions, 57 deletions
diff --git a/include/core/SkImage.h b/include/core/SkImage.h
index d8612f01e9..c404643171 100644
--- a/include/core/SkImage.h
+++ b/include/core/SkImage.h
@@ -326,92 +326,54 @@ public:
SkAlphaType alphaType = kPremul_SkAlphaType,
sk_sp<SkColorSpace> colorSpace = nullptr);
- /** Creates SkImage from copy of yuvTextureHandles, an array of textures on GPU.
- yuvTextureHandles contain pixels for YUV planes of SkImage.
- yuvSizes contain dimensions for each pixel plane. Dimensions must be greater than
- zero but may differ from plane to plane. Returned SkImage has the dimensions
- yuvSizes[0]. yuvColorSpace describes how YUV colors convert to RGB colors.
+ /** Creates SkImage from copy of yuvTextures, an array of textures on GPU.
+ yuvTextures contain pixels for YUV planes of SkImage.
+ Returned SkImage has the dimensions yuvTextures[0]. yuvColorSpace describes how YUV colors
+ convert to RGB colors.
@param context GPU context
@param yuvColorSpace one of: kJPEG_SkYUVColorSpace, kRec601_SkYUVColorSpace,
kRec709_SkYUVColorSpace
- @param yuvTextureHandles array of YUV textures on GPU
- @param yuvSizes dimensions of YUV textures
+ @param yuvTextures array of YUV textures on GPU
@param surfaceOrigin one of: kBottomLeft_GrSurfaceOrigin, kTopLeft_GrSurfaceOrigin
@param colorSpace range of colors; may be nullptr
@return created SkImage, or nullptr
*/
static sk_sp<SkImage> MakeFromYUVTexturesCopy(GrContext* context, SkYUVColorSpace yuvColorSpace,
- const GrBackendObject yuvTextureHandles[3],
+ const GrBackendTexture yuvTextures[3],
+ GrSurfaceOrigin surfaceOrigin,
+ sk_sp<SkColorSpace> colorSpace = nullptr);
+ /** Deprecated version that takes a redunant array of sizes of the textures. */
+ static sk_sp<SkImage> MakeFromYUVTexturesCopy(GrContext* context, SkYUVColorSpace yuvColorSpace,
+ const GrBackendTexture yuvTextures[3],
const SkISize yuvSizes[3],
GrSurfaceOrigin surfaceOrigin,
sk_sp<SkColorSpace> colorSpace = nullptr);
/** Creates SkImage from copy of nv12TextureHandles, an array of textures on GPU.
- nv12TextureHandles[0] contains pixels for YUV_Component_Y plane.
- nv12TextureHandles[1] contains pixels for YUV_Component_U plane,
+ yuvTextures[0] contains pixels for YUV_Component_Y plane.
+ yuvTextures[1] contains pixels for YUV_Component_U plane,
followed by pixels for YUV_Component_V plane.
- nv12Sizes contain dimensions for each pixel plane. Dimensions must be greater than
- zero but may differ from plane to plane. Returned SkImage has the dimensions
- nv12Sizes[0]. yuvColorSpace describes how YUV colors convert to RGB colors.
+ Returned SkImage has the dimensions nv12Textures[0]. yuvColorSpace describes how YUV colors
+ convert to RGB colors.
@param context GPU context
@param yuvColorSpace one of: kJPEG_SkYUVColorSpace, kRec601_SkYUVColorSpace,
kRec709_SkYUVColorSpace
- @param nv12TextureHandles array of YUV textures on GPU
- @param nv12Sizes dimensions of YUV textures
+ @param nv12Textures array of YUV textures on GPU
@param surfaceOrigin one of: kBottomLeft_GrSurfaceOrigin, kTopLeft_GrSurfaceOrigin
@param colorSpace range of colors; may be nullptr
@return created SkImage, or nullptr
*/
static sk_sp<SkImage> MakeFromNV12TexturesCopy(GrContext* context,
SkYUVColorSpace yuvColorSpace,
- const GrBackendObject nv12TextureHandles[2],
- const SkISize nv12Sizes[2],
+ const GrBackendTexture nv12Textures[2],
GrSurfaceOrigin surfaceOrigin,
sk_sp<SkColorSpace> colorSpace = nullptr);
-
- /** Creates SkImage from copy of yuvTextureHandles, an array of textures on GPU.
- yuvTextureHandles contain pixels for YUV planes of SkImage.
- yuvSizes contain dimensions for each pixel plane. Dimensions must be greater than
- zero but may differ from plane to plane. Returned SkImage has the dimensions
- yuvSizes[0]. yuvColorSpace describes how YUV colors convert to RGB colors.
-
- @param context GPU context
- @param yuvColorSpace one of: kJPEG_SkYUVColorSpace, kRec601_SkYUVColorSpace,
- kRec709_SkYUVColorSpace
- @param yuvTextureHandles array of YUV textures on GPU
- @param yuvSizes dimensions of YUV textures
- @param surfaceOrigin one of: kBottomLeft_GrSurfaceOrigin, kTopLeft_GrSurfaceOrigin
- @param colorSpace range of colors; may be nullptr
- @return created SkImage, or nullptr
- */
- static sk_sp<SkImage> MakeFromYUVTexturesCopy(GrContext* context, SkYUVColorSpace yuvColorSpace,
- const GrBackendTexture yuvTextureHandles[3],
- const SkISize yuvSizes[3],
- GrSurfaceOrigin surfaceOrigin,
- sk_sp<SkColorSpace> colorSpace = nullptr);
-
- /** Creates SkImage from copy of nv12TextureHandles, an array of textures on GPU.
- nv12TextureHandles[0] contains pixels for YUV_Component_Y plane.
- nv12TextureHandles[1] contains pixels for YUV_Component_U plane,
- followed by pixels for YUV_Component_V plane.
- nv12Sizes contain dimensions for each pixel plane. Dimensions must be greater than
- zero but may differ from plane to plane. Returned SkImage has the dimensions
- nv12Sizes[0]. yuvColorSpace describes how YUV colors convert to RGB colors.
-
- @param context GPU context
- @param yuvColorSpace one of: kJPEG_SkYUVColorSpace, kRec601_SkYUVColorSpace,
- kRec709_SkYUVColorSpace
- @param nv12TextureHandles array of YUV textures on GPU
- @param nv12Sizes dimensions of YUV textures
- @param surfaceOrigin one of: kBottomLeft_GrSurfaceOrigin, kTopLeft_GrSurfaceOrigin
- @param colorSpace range of colors; may be nullptr
- @return created SkImage, or nullptr
- */
+ /** Deprecated version that takes a redunant array of sizes of the textures. */
static sk_sp<SkImage> MakeFromNV12TexturesCopy(GrContext* context,
SkYUVColorSpace yuvColorSpace,
- const GrBackendTexture nv12TextureHandles[2],
+ const GrBackendTexture nv12Textures[2],
const SkISize nv12Sizes[2],
GrSurfaceOrigin surfaceOrigin,
sk_sp<SkColorSpace> colorSpace = nullptr);
diff --git a/include/gpu/GrBackendSurface.h b/include/gpu/GrBackendSurface.h
index a57edcd9d1..1312257805 100644
--- a/include/gpu/GrBackendSurface.h
+++ b/include/gpu/GrBackendSurface.h
@@ -148,6 +148,7 @@ public:
private:
// Friending for access to the GrPixelConfig
friend class SkImage;
+ friend class SkImage_Gpu;
friend class SkSurface;
friend class GrBackendTextureImageGenerator;
friend class GrProxyProvider;