aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/core/SkImageInfo.h
diff options
context:
space:
mode:
authorGravatar reed <reed@google.com>2014-08-29 07:50:28 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2014-08-29 07:50:28 -0700
commit64ba5fa1ff428858f803523257cd862f8b33423b (patch)
tree42a0045a3cfd126df51f0611cfadea76a1327be7 /include/core/SkImageInfo.h
parent32d0b3b5463c11032f12d03d993f11ea0af05959 (diff)
Revert of Add gamma/sRGB tags to SkImageInfo (patchset #1 of https://codereview.chromium.org/517123002/)
Reason for revert: Seems to be triggering assert in blink SSLUITest.TestRedirectHTTPToBadHTTPS (run #1): [ RUN ] SSLUITest.TestRedirectHTTPToBadHTTPS HTTP server started on http://127.0.0.1:58000... sending server_data: {"host": "127.0.0.1", "port": 58000} (36 bytes) HTTPS server started on https://127.0.0.1:58009... sending server_data: {"host": "127.0.0.1", "port": 58009} (36 bytes) ASSERTION FAILED: info.fAlphaType == m_imageInfo.fAlphaType ../../third_party/WebKit/Source/platform/graphics/DecodingImageGenerator.cpp(78) : virtual bool blink::DecodingImageGenerator::onGetPixels(const SkImageInfo &, void *, size_t, SkPMColor *, int *) 1 0x77eb0d3 blink::DecodingImageGenerator::onGetPixels(SkImageInfo const&, void*, unsigned long, unsigned int*, int*) 2 0x92edddc SkImageGenerator::getPixels(SkImageInfo const&, void*, unsigned long, unsigned int*, int*) 3 0x92adf78 SkDiscardablePixelRef::onNewLockPixels(SkPixelRef::LockRec*) 4 0x9369283 SkPixelRef::lockPixels(SkPixelRef::LockRec*) 5 0x9369433 SkPixelRef::lockPixels() 6 0x9213344 SkBitmap::lockPixels() const 7 0x921ca57 SkAutoLockPixels::SkAutoLockPixels(SkBitmap const&, bool) 8 0x921ad80 SkAutoLockPixels::SkAutoLockPixels(SkBitmap const&, bool) 9 0x92b7125 SkDraw::drawBitmap(SkBitmap const&, SkMatrix const&, SkPaint const&) const 10 0x921f4fb SkBitmapDevice::drawBitmap(SkDraw const&, SkBitmap const&, SkMatrix const&, SkPaint const&) 11 0x921f8c7 SkBitmapDevice::drawBitmapRect(SkDraw const&, SkBitmap const&, SkRect const*, SkRect const&, SkPaint const&, SkCanvas::DrawBitmapRectFlags) 12 0x9288e12 SkCanvas::internalDrawBitmapRect(SkBitmap const&, SkRect const*, SkRect const&, SkPaint const*, SkCanvas::DrawBitmapRectFlags) 13 0x9288ee9 SkCanvas::drawBitmapRectToRect(SkBitmap const&, SkRect const*, SkRect const&, SkPaint const*, SkCanvas::DrawBitmapRectFlags) Original issue's description: > Add gamma/sRGB tags to SkImageInfo > > requires this CL to land in chrome > https://codereview.chromium.org/517803002/ > > BUG=skia: > > Committed: https://skia.googlesource.com/skia/+/228b285ba14a6e9b6d1cc95ea1583caab30168a1 R=fmalita@google.com, fmalita@chromium.org, reed@chromium.org TBR=fmalita@chromium.org, fmalita@google.com, reed@chromium.org NOTREECHECKS=true NOTRY=true BUG=skia: Author: reed@google.com Review URL: https://codereview.chromium.org/519583004
Diffstat (limited to 'include/core/SkImageInfo.h')
-rw-r--r--include/core/SkImageInfo.h89
1 files changed, 25 insertions, 64 deletions
diff --git a/include/core/SkImageInfo.h b/include/core/SkImageInfo.h
index 7a56fb4557..3d82dc805c 100644
--- a/include/core/SkImageInfo.h
+++ b/include/core/SkImageInfo.h
@@ -135,50 +135,37 @@ bool SkColorTypeValidateAlphaType(SkColorType colorType, SkAlphaType alphaType,
/**
* Describe an image's dimensions and pixel type.
*/
-struct SK_API SkImageInfo {
-public:
- SkImageInfo() {}
-
+struct SkImageInfo {
int fWidth;
int fHeight;
SkColorType fColorType;
SkAlphaType fAlphaType;
- /*
- * Return an info with the specified attributes, tagged as sRGB. Note that if the requested
- * color type does not make sense with sRGB (e.g. kAlpha_8) then the sRGB request is ignored.
- *
- * You can call isSRGB() on the returned info to determine if the request was fulfilled.
- */
- static SkImageInfo MakeSRGB(int width, int height, SkColorType ct, SkAlphaType at);
-
- /*
- * Return an info with the specified attributes, tagged with a specific gamma.
- * Note that if the requested gamma is unsupported for the requested color type, then the gamma
- * value will be set to 1.0 (the default).
- *
- * You can call gamma() to query the resulting gamma value.
- */
- static SkImageInfo MakeWithGamma(int width, int height, SkColorType ct, SkAlphaType at,
- float gamma);
-
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at) {
- return MakeWithGamma(width, height, ct, at, 1);
+ SkImageInfo info = {
+ width, height, ct, at
+ };
+ return info;
}
/**
* Sets colortype to the native ARGB32 type.
*/
static SkImageInfo MakeN32(int width, int height, SkAlphaType at) {
- return SkImageInfo(width, height, kN32_SkColorType, at, kExponential_Profile, 1);
+ SkImageInfo info = {
+ width, height, kN32_SkColorType, at
+ };
+ return info;
}
/**
* Sets colortype to the native ARGB32 type, and the alphatype to premul.
*/
static SkImageInfo MakeN32Premul(int width, int height) {
- return SkImageInfo(width, height, kN32_SkColorType, kPremul_SkAlphaType,
- kExponential_Profile, 1);
+ SkImageInfo info = {
+ width, height, kN32_SkColorType, kPremul_SkAlphaType
+ };
+ return info;
}
/**
@@ -189,17 +176,24 @@ public:
}
static SkImageInfo MakeA8(int width, int height) {
- return SkImageInfo(width, height, kAlpha_8_SkColorType, kPremul_SkAlphaType,
- kUnknown_Profile, 0);
+ SkImageInfo info = {
+ width, height, kAlpha_8_SkColorType, kPremul_SkAlphaType
+ };
+ return info;
}
static SkImageInfo MakeUnknown(int width, int height) {
- return SkImageInfo(width, height, kUnknown_SkColorType, kIgnore_SkAlphaType,
- kUnknown_Profile, 0);
+ SkImageInfo info = {
+ width, height, kUnknown_SkColorType, kIgnore_SkAlphaType
+ };
+ return info;
}
static SkImageInfo MakeUnknown() {
- return SkImageInfo(0, 0, kUnknown_SkColorType, kIgnore_SkAlphaType, kUnknown_Profile, 0);
+ SkImageInfo info = {
+ 0, 0, kUnknown_SkColorType, kIgnore_SkAlphaType
+ };
+ return info;
}
int width() const { return fWidth; }
@@ -242,11 +236,8 @@ public:
return 0 != memcmp(this, &other, sizeof(other));
}
- // DEPRECATED : use the static Unflatten
void unflatten(SkReadBuffer&);
void flatten(SkWriteBuffer&) const;
-
- static SkImageInfo Unflatten(SkReadBuffer&);
int64_t getSafeSize64(size_t rowBytes) const {
if (0 == fHeight) {
@@ -265,36 +256,6 @@ public:
}
SkDEBUGCODE(void validate() const;)
-
- /**
- * If the Info was tagged to be sRGB, return true, else return false.
- */
- bool isSRGB() const { return kSRGB_Profile == fProfile; }
-
- /**
- * If this was tagged with an explicit gamma value, return that value, else return 0.
- * If this was tagged as sRGB, return 0.
- */
- float gamma() const { return fGamma; }
-
-private:
- enum Profile {
- kUnknown_Profile,
- kSRGB_Profile,
- kExponential_Profile,
- };
-
- uint32_t fProfile;
- float fGamma;
-
- SkImageInfo(int width, int height, SkColorType ct, SkAlphaType at, Profile p, float g)
- : fWidth(width)
- , fHeight(height)
- , fColorType(ct)
- , fAlphaType(at)
- , fProfile(p)
- , fGamma(g)
- {}
};
#endif