aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/core
diff options
context:
space:
mode:
authorGravatar brianosman <brianosman@google.com>2016-07-20 13:55:39 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-07-20 13:55:39 -0700
commitdddbe380b0e6b690041a4e020aefe57f1b21691a (patch)
tree4a2afaa3617f174558fdd544dac7d8205646facd /include/core
parent7d46f4af7dc759002537a172af121f2bfe200981 (diff)
Adding an SkColorSpace to SkImage_Gpu
Diffstat (limited to 'include/core')
-rw-r--r--include/core/SkImage.h40
1 files changed, 28 insertions, 12 deletions
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<SkImage> MakeFromGenerator(SkImageGenerator*, const SkIRect* subset = NULL);
+ static sk_sp<SkImage> 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<SkImage> MakeFromEncoded(sk_sp<SkData> encoded, const SkIRect* subset = NULL);
+ static sk_sp<SkImage> MakeFromEncoded(sk_sp<SkData> 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<SkImage> 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<SkImage> 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<SkImage> 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<SkImage> MakeFromTexture(GrContext*, const GrBackendTextureDesc&, SkAlphaType,
- TextureReleaseProc, ReleaseContext);
+ sk_sp<SkColorSpace>, 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<SkImage> MakeFromAdoptedTexture(GrContext*, const GrBackendTextureDesc&,
- SkAlphaType = kPremul_SkAlphaType);
+ SkAlphaType = kPremul_SkAlphaType,
+ sk_sp<SkColorSpace> = 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<SkImage> MakeFromYUVTexturesCopy(GrContext*, SkYUVColorSpace,
const GrBackendObject yuvTextureHandles[3],
const SkISize yuvSizes[3],
- GrSurfaceOrigin);
+ GrSurfaceOrigin,
+ sk_sp<SkColorSpace> = 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<SkImage> MakeFromNV12TexturesCopy(GrContext*, SkYUVColorSpace,
const GrBackendObject nv12TextureHandles[2],
- const SkISize nv12Sizes[2], GrSurfaceOrigin);
+ const SkISize nv12Sizes[2], GrSurfaceOrigin,
+ sk_sp<SkColorSpace> = nullptr);
static sk_sp<SkImage> MakeFromPicture(sk_sp<SkPicture>, 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);