Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(753)

Side by Side Diff: include/core/SkImageInfo.h

Issue 2196743002: Add SkColorSpace::Equals() API (Closed) Base URL: https://skia.googlesource.com/skia.git@cscleanup
Patch Set: Fix logic Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « include/core/SkColorSpace.h ('k') | src/codec/SkJpegCodec.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2013 Google Inc. 2 * Copyright 2013 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef SkImageInfo_DEFINED 8 #ifndef SkImageInfo_DEFINED
9 #define SkImageInfo_DEFINED 9 #define SkImageInfo_DEFINED
10 10
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 282
283 size_t computeOffset(int x, int y, size_t rowBytes) const { 283 size_t computeOffset(int x, int y, size_t rowBytes) const {
284 SkASSERT((unsigned)x < (unsigned)fWidth); 284 SkASSERT((unsigned)x < (unsigned)fWidth);
285 SkASSERT((unsigned)y < (unsigned)fHeight); 285 SkASSERT((unsigned)y < (unsigned)fHeight);
286 return SkColorTypeComputeOffset(fColorType, x, y, rowBytes); 286 return SkColorTypeComputeOffset(fColorType, x, y, rowBytes);
287 } 287 }
288 288
289 bool operator==(const SkImageInfo& other) const { 289 bool operator==(const SkImageInfo& other) const {
290 return fWidth == other.fWidth && fHeight == other.fHeight && 290 return fWidth == other.fWidth && fHeight == other.fHeight &&
291 fColorType == other.fColorType && fAlphaType == other.fAlphaType && 291 fColorType == other.fColorType && fAlphaType == other.fAlphaType &&
292 fColorSpace == other.fColorSpace; 292 SkColorSpace::Equals(fColorSpace.get(), other.fColorSpace.get());
293 } 293 }
294 bool operator!=(const SkImageInfo& other) const { 294 bool operator!=(const SkImageInfo& other) const {
295 return fWidth != other.fWidth || fHeight != other.fHeight || 295 return !(*this == other);
296 fColorType != other.fColorType || fAlphaType != other.fAlphaType ||
297 fColorSpace != other.fColorSpace;
298 } 296 }
299 297
300 void unflatten(SkReadBuffer&); 298 void unflatten(SkReadBuffer&);
301 void flatten(SkWriteBuffer&) const; 299 void flatten(SkWriteBuffer&) const;
302 300
303 int64_t getSafeSize64(size_t rowBytes) const { 301 int64_t getSafeSize64(size_t rowBytes) const {
304 if (0 == fHeight) { 302 if (0 == fHeight) {
305 return 0; 303 return 0;
306 } 304 }
307 return sk_64_mul(fHeight - 1, rowBytes) + fWidth * this->bytesPerPixel() ; 305 return sk_64_mul(fHeight - 1, rowBytes) + fWidth * this->bytesPerPixel() ;
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 // Anything with a color-space attached is gamma-correct, as is F16. 350 // Anything with a color-space attached is gamma-correct, as is F16.
353 // To get legacy behavior, you need to ask for non-F16, with a nullptr color space. 351 // To get legacy behavior, you need to ask for non-F16, with a nullptr color space.
354 return (cs != nullptr) || kRGBA_F16_SkColorType == ct; 352 return (cs != nullptr) || kRGBA_F16_SkColorType == ct;
355 } 353 }
356 354
357 static inline bool SkImageInfoIsGammaCorrect(const SkImageInfo& info) { 355 static inline bool SkImageInfoIsGammaCorrect(const SkImageInfo& info) {
358 return SkColorAndColorSpaceAreGammaCorrect(info.colorType(), info.colorSpace ()); 356 return SkColorAndColorSpaceAreGammaCorrect(info.colorType(), info.colorSpace ());
359 } 357 }
360 358
361 #endif 359 #endif
OLDNEW
« no previous file with comments | « include/core/SkColorSpace.h ('k') | src/codec/SkJpegCodec.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698