aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar reed <reed@google.com>2014-09-03 05:48:56 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2014-09-03 05:48:56 -0700
commit2bdf1f56c3c81b90dd5532f279d867a4f5bacd16 (patch)
tree0c4173903097773fad0dfefa40685c0adfe4b61b /include
parentc56653cdd22eab4cf3cd0076e26a20401c33ccf5 (diff)
Revert of Add gamma/sRGB tag to SkImageInfo (patchset #1 id:1 of https://codereview.chromium.org/527073003/)
Reason for revert: virtual gpu failures in layouttests http://build.chromium.org/p/tryserver.blink/builders/linux_blink_dbg/builds/23717 [6:6:0903/041147:1700960503:INFO:SkBitmap.cpp(1003)] ../../third_party/skia/src/core/SkBitmap.cpp:1003: failed assertion "fPixelRef->info() == pixelRef->info()" [6:6:0903/041147:1700961002:FATAL:SkBitmap.cpp(1003)] SK_CRASH #0 0x7f9867df2c1e base::debug::StackTrace::StackTrace() #1 0x7f9867e89e05 logging::LogMessage::~LogMessage() #2 0x7f98689c4970 SkDebugf_FileLine() #3 0x7f986870ebc6 SkBitmap::deepCopyTo() #4 0x7f98690a3b6d blink::deepSkBitmapCopy() #5 0x7f98690a3abe blink::ImageBuffer::copyImage() #6 0x7f985fd4479e blink::ImageBitmap::ImageBitmap() #7 0x7f985fd45942 blink::ImageBitmap::create() #8 0x7f985fd84fdc blink::ImageBitmapFactories::createImageBitmap() #9 0x7f985fd84d11 blink::ImageBitmapFactories::createImageBitmap() #10 0x7f985ec9a7f2 blink::LocalDOMWindowV8Internal::createImageBitmap13Method() #11 0x7f985ec96b0c blink::LocalDOMWindowV8Internal::createImageBitmapMethod() #12 0x7f985ec91954 blink::LocalDOMWindowV8Internal::createImageBitmapMethodCallback() #13 0x7f9869955af0 v8::internal::FunctionCallbackArguments::Call() #14 0x7f98699833bd v8::internal::Builtin_HandleApiCall() Original issue's description: > Add gamma/sRGB tag to SkImageInfo > > This reverts commit 1cbc68f9659f15206d920dacd434ddf4b658ad1f. > > requires this to land in blink https://codereview.chromium.org/531883002/ > > Committed: https://skia.googlesource.com/skia/+/2f6abdecc5c2f21da13003c615903679abc73fc7 R=fmalita@google.com, reed@chromium.org TBR=fmalita@google.com, reed@chromium.org NOTREECHECKS=true NOTRY=true Author: reed@google.com Review URL: https://codereview.chromium.org/535113002
Diffstat (limited to 'include')
-rw-r--r--include/core/SkImageInfo.h96
1 files changed, 25 insertions, 71 deletions
diff --git a/include/core/SkImageInfo.h b/include/core/SkImageInfo.h
index 0f488a6c0f..3d82dc805c 100644
--- a/include/core/SkImageInfo.h
+++ b/include/core/SkImageInfo.h
@@ -135,57 +135,37 @@ bool SkColorTypeValidateAlphaType(SkColorType colorType, SkAlphaType alphaType,
/**
* Describe an image's dimensions and pixel type.
*/
-struct SK_API SkImageInfo {
-public:
- SkImageInfo()
- : fWidth(0)
- , fHeight(0)
- , fColorType(kUnknown_SkColorType)
- , fAlphaType(kIgnore_SkAlphaType)
- , fProfile(kUnknown_Profile)
- , fGamma(0)
- {}
-
+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;
}
/**
@@ -196,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();
+ SkImageInfo info = {
+ 0, 0, kUnknown_SkColorType, kIgnore_SkAlphaType
+ };
+ return info;
}
int width() const { return fWidth; }
@@ -249,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) {
@@ -272,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