From dddbe380b0e6b690041a4e020aefe57f1b21691a Mon Sep 17 00:00:00 2001 From: brianosman Date: Wed, 20 Jul 2016 13:55:39 -0700 Subject: Adding an SkColorSpace to SkImage_Gpu BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2165703003 Review-Url: https://codereview.chromium.org/2165703003 --- include/core/SkImage.h | 40 ++++++++++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 12 deletions(-) (limited to 'include/core') diff --git a/include/core/SkImage.h b/include/core/SkImage.h index 6021590a57..fd20e5e0e5 100644 --- a/include/core/SkImage.h +++ b/include/core/SkImage.h @@ -73,7 +73,7 @@ public: * * If a subset is specified, it must be contained within the generator's bounds. */ - static sk_sp MakeFromGenerator(SkImageGenerator*, const SkIRect* subset = NULL); + static sk_sp MakeFromGenerator(SkImageGenerator*, const SkIRect* subset = nullptr); /** * Construct a new SkImage based on the specified encoded data. Returns NULL on failure, @@ -81,7 +81,7 @@ public: * * If a subset is specified, it must be contained within the encoded data's bounds. */ - static sk_sp MakeFromEncoded(sk_sp encoded, const SkIRect* subset = NULL); + static sk_sp MakeFromEncoded(sk_sp encoded, const SkIRect* subset = nullptr); /** * Create a new image from the specified descriptor. Note - the caller is responsible for @@ -90,12 +90,12 @@ public: * Will return NULL if the specified descriptor is unsupported. */ static sk_sp MakeFromTexture(GrContext* ctx, const GrBackendTextureDesc& desc) { - return MakeFromTexture(ctx, desc, kPremul_SkAlphaType, NULL, NULL); + return MakeFromTexture(ctx, desc, kPremul_SkAlphaType, nullptr, nullptr, nullptr); } static sk_sp MakeFromTexture(GrContext* ctx, const GrBackendTextureDesc& de, SkAlphaType at) { - return MakeFromTexture(ctx, de, at, NULL, NULL); + return MakeFromTexture(ctx, de, at, nullptr, nullptr, nullptr); } typedef void (*TextureReleaseProc)(ReleaseContext); @@ -107,8 +107,21 @@ public: * * Will return NULL if the specified descriptor is unsupported. */ + static sk_sp MakeFromTexture(GrContext* ctx, const GrBackendTextureDesc& desc, + SkAlphaType at, TextureReleaseProc trp, + ReleaseContext rc) { + return MakeFromTexture(ctx, desc, at, nullptr, trp, rc); + } + + /** + * Create a new image from the specified descriptor. The underlying platform texture must stay + * valid and unaltered until the specified release-proc is invoked, indicating that Skia + * no longer is holding a reference to it. + * + * Will return NULL if the specified descriptor is unsupported. + */ static sk_sp MakeFromTexture(GrContext*, const GrBackendTextureDesc&, SkAlphaType, - TextureReleaseProc, ReleaseContext); + sk_sp, TextureReleaseProc, ReleaseContext); /** * Create a new image from the specified descriptor. Note - Skia will delete or recycle the @@ -117,7 +130,8 @@ public: * Will return NULL if the specified descriptor is unsupported. */ static sk_sp MakeFromAdoptedTexture(GrContext*, const GrBackendTextureDesc&, - SkAlphaType = kPremul_SkAlphaType); + SkAlphaType = kPremul_SkAlphaType, + sk_sp = nullptr); /** * Create a new image by copying the pixels from the specified y, u, v textures. The data @@ -127,7 +141,8 @@ public: static sk_sp MakeFromYUVTexturesCopy(GrContext*, SkYUVColorSpace, const GrBackendObject yuvTextureHandles[3], const SkISize yuvSizes[3], - GrSurfaceOrigin); + GrSurfaceOrigin, + sk_sp = nullptr); /** * Create a new image by copying the pixels from the specified y and uv textures. The data @@ -136,7 +151,8 @@ public: */ static sk_sp MakeFromNV12TexturesCopy(GrContext*, SkYUVColorSpace, const GrBackendObject nv12TextureHandles[2], - const SkISize nv12Sizes[2], GrSurfaceOrigin); + const SkISize nv12Sizes[2], GrSurfaceOrigin, + sk_sp = nullptr); static sk_sp MakeFromPicture(sk_sp, const SkISize& dimensions, const SkMatrix*, const SkPaint*); @@ -421,14 +437,14 @@ public: static SkImage* NewFromRaster(const Info&, const void* pixels, size_t rowBytes, RasterReleaseProc, ReleaseContext); static SkImage* NewFromBitmap(const SkBitmap&); - static SkImage* NewFromGenerator(SkImageGenerator*, const SkIRect* subset = NULL); - static SkImage* NewFromEncoded(SkData* encoded, const SkIRect* subset = NULL); + static SkImage* NewFromGenerator(SkImageGenerator*, const SkIRect* subset = nullptr); + static SkImage* NewFromEncoded(SkData* encoded, const SkIRect* subset = nullptr); static SkImage* NewFromTexture(GrContext* ctx, const GrBackendTextureDesc& desc) { - return NewFromTexture(ctx, desc, kPremul_SkAlphaType, NULL, NULL); + return NewFromTexture(ctx, desc, kPremul_SkAlphaType, nullptr, nullptr); } static SkImage* NewFromTexture(GrContext* ctx, const GrBackendTextureDesc& de, SkAlphaType at) { - return NewFromTexture(ctx, de, at, NULL, NULL); + return NewFromTexture(ctx, de, at, nullptr, nullptr); } static SkImage* NewFromTexture(GrContext*, const GrBackendTextureDesc&, SkAlphaType, TextureReleaseProc, ReleaseContext); -- cgit v1.2.3