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

Side by Side Diff: src/core/SkImageInfo.cpp

Issue 2071393002: More removal of SkColorProfileType... (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Restore API used in Chrome Created 4 years, 6 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 | « src/core/SkCanvas.cpp ('k') | src/gpu/GrContext.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 2010 Google Inc. 2 * Copyright 2010 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 #include "SkImageInfo.h" 8 #include "SkImageInfo.h"
9 #include "SkImageInfoPriv.h"
10 #include "SkReadBuffer.h" 9 #include "SkReadBuffer.h"
11 #include "SkWriteBuffer.h" 10 #include "SkWriteBuffer.h"
12 11
13 /* 12 /*
14 * We store this as a byte in the ImageInfo flatten buffer. 13 * We store this as a byte in the ImageInfo flatten buffer.
15 */ 14 */
16 enum class SkFlattenColorSpaceEnum { 15 enum class SkFlattenColorSpaceEnum {
17 kUnspecified, 16 kUnspecified,
18 kSRGB, 17 kSRGB,
19 kAdobe1998, 18 kAdobe1998,
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 53
55 //////////////////////////////////////////////////////////////////////////////// /////////////////// 54 //////////////////////////////////////////////////////////////////////////////// ///////////////////
56 55
57 #ifdef SK_SUPPORT_LEGACY_COLORPROFILETYPE 56 #ifdef SK_SUPPORT_LEGACY_COLORPROFILETYPE
58 SkColorProfileType SkImageInfo::profileType() const { 57 SkColorProfileType SkImageInfo::profileType() const {
59 return fColorSpace && fColorSpace->gammaCloseToSRGB() 58 return fColorSpace && fColorSpace->gammaCloseToSRGB()
60 ? kSRGB_SkColorProfileType : kLinear_SkColorProfileType; 59 ? kSRGB_SkColorProfileType : kLinear_SkColorProfileType;
61 } 60 }
62 #endif 61 #endif
63 62
64 // Indicate how images and gradients should interpret colors by default.
65 bool gDefaultProfileIsSRGB;
66
67 SkColorProfileType SkDefaultColorProfile() {
68 return gDefaultProfileIsSRGB ? kSRGB_SkColorProfileType
69 : kLinear_SkColorProfileType;
70 }
71
72 static bool alpha_type_is_valid(SkAlphaType alphaType) { 63 static bool alpha_type_is_valid(SkAlphaType alphaType) {
73 return (alphaType >= 0) && (alphaType <= kLastEnum_SkAlphaType); 64 return (alphaType >= 0) && (alphaType <= kLastEnum_SkAlphaType);
74 } 65 }
75 66
76 static bool color_type_is_valid(SkColorType colorType) { 67 static bool color_type_is_valid(SkColorType colorType) {
77 return (colorType >= 0) && (colorType <= kLastEnum_SkColorType); 68 return (colorType >= 0) && (colorType <= kLastEnum_SkColorType);
78 } 69 }
79 70
80 SkImageInfo SkImageInfo::MakeS32(int width, int height, SkAlphaType at) { 71 SkImageInfo SkImageInfo::MakeS32(int width, int height, SkAlphaType at) {
81 return SkImageInfo(width, height, kN32_SkColorType, at, 72 return SkImageInfo(width, height, kN32_SkColorType, at,
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 } 186 }
196 // here x,y are either 0 or negative 187 // here x,y are either 0 or negative
197 fPixels = ((char*)fPixels - y * fRowBytes - x * fInfo.bytesPerPixel()); 188 fPixels = ((char*)fPixels - y * fRowBytes - x * fInfo.bytesPerPixel());
198 // the intersect may have shrunk info's logical size 189 // the intersect may have shrunk info's logical size
199 fInfo = fInfo.makeWH(srcR.width(), srcR.height()); 190 fInfo = fInfo.makeWH(srcR.width(), srcR.height());
200 fX = srcR.x(); 191 fX = srcR.x();
201 fY = srcR.y(); 192 fY = srcR.y();
202 193
203 return true; 194 return true;
204 } 195 }
OLDNEW
« no previous file with comments | « src/core/SkCanvas.cpp ('k') | src/gpu/GrContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698