aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar Matt Sarett <msarett@google.com>2017-06-06 10:11:34 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-06-06 14:34:03 +0000
commit3928ff8e0b617c3a00eee1963bc31ce5470fba6d (patch)
tree98bbe9e51b3316c175a8b1ffe1063877ca84eb55 /include
parent1608a1dd17187aeeada376e710ecfafb1e229af2 (diff)
Create an SkColorSpaceXform image generator
This should be immediately useful in the Skia-Android rendering pipeline. Possible future uses include creating a "renderable" SkImage from a bitmap with a funny color space. Inspired by: https://skia-review.googlesource.com/c/13981/ Bug: b/62347704 Change-Id: I388c7af1fc43834b8ad22022d0caf3ac90b734c8 Reviewed-on: https://skia-review.googlesource.com/18598 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Matt Sarett <msarett@google.com>
Diffstat (limited to 'include')
-rw-r--r--include/core/SkBitmap.h11
-rw-r--r--include/core/SkPixmap.h7
2 files changed, 13 insertions, 5 deletions
diff --git a/include/core/SkBitmap.h b/include/core/SkBitmap.h
index 764139b3a6..8b8942f194 100644
--- a/include/core/SkBitmap.h
+++ b/include/core/SkBitmap.h
@@ -571,7 +571,12 @@ public:
* - If the src pixels are not available.
*/
bool readPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRowBytes,
- int srcX, int srcY) const;
+ int srcX, int srcY, SkTransferFunctionBehavior behavior) const;
+ bool readPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRowBytes,
+ int srcX, int srcY) const {
+ return this->readPixels(dstInfo, dstPixels, dstRowBytes, srcX, srcY,
+ SkTransferFunctionBehavior::kRespect);
+ }
bool readPixels(const SkPixmap& dst, int srcX, int srcY) const;
bool readPixels(const SkPixmap& dst) const {
return this->readPixels(dst, 0, 0);
@@ -589,6 +594,7 @@ public:
bool writePixels(const SkPixmap& src) {
return this->writePixels(src, 0, 0);
}
+ bool writePixels(const SkPixmap& src, int x, int y, SkTransferFunctionBehavior behavior);
#ifdef SK_BUILD_FOR_ANDROID
bool hasHardwareMipMap() const {
@@ -684,9 +690,6 @@ private:
uint32_t fRowBytes;
uint8_t fFlags;
- friend class SkImage_Raster;
- bool writePixels(const SkPixmap& src, int x, int y, SkTransferFunctionBehavior behavior);
-
/* Unreference any pixelrefs or colortables
*/
void freePixels();
diff --git a/include/core/SkPixmap.h b/include/core/SkPixmap.h
index af8618b4de..1e79bba225 100644
--- a/include/core/SkPixmap.h
+++ b/include/core/SkPixmap.h
@@ -183,10 +183,15 @@ public:
// copy methods
bool readPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRowBytes,
- int srcX, int srcY) const;
+ int srcX, int srcY, SkTransferFunctionBehavior behavior) const;
bool readPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRowBytes) const {
return this->readPixels(dstInfo, dstPixels, dstRowBytes, 0, 0);
}
+ bool readPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRowBytes, int srcX,
+ int srcY) const {
+ return this->readPixels(dstInfo, dstPixels, dstRowBytes, srcX, srcY,
+ SkTransferFunctionBehavior::kRespect);
+ }
bool readPixels(const SkPixmap& dst, int srcX, int srcY) const {
return this->readPixels(dst.info(), dst.writable_addr(), dst.rowBytes(), srcX, srcY);
}