OLD | NEW |
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 "SkReadBuffer.h" | 9 #include "SkReadBuffer.h" |
10 #include "SkWriteBuffer.h" | 10 #include "SkWriteBuffer.h" |
11 | 11 |
12 #ifdef SK_SUPPORT_LEGACY_COLORPROFILETYPE | |
13 SkColorProfileType SkImageInfo::profileType() const { | |
14 return fColorSpace && fColorSpace->gammaCloseToSRGB() | |
15 ? kSRGB_SkColorProfileType : kLinear_SkColorProfileType; | |
16 } | |
17 #endif | |
18 | |
19 static bool alpha_type_is_valid(SkAlphaType alphaType) { | 12 static bool alpha_type_is_valid(SkAlphaType alphaType) { |
20 return (alphaType >= 0) && (alphaType <= kLastEnum_SkAlphaType); | 13 return (alphaType >= 0) && (alphaType <= kLastEnum_SkAlphaType); |
21 } | 14 } |
22 | 15 |
23 static bool color_type_is_valid(SkColorType colorType) { | 16 static bool color_type_is_valid(SkColorType colorType) { |
24 return (colorType >= 0) && (colorType <= kLastEnum_SkColorType); | 17 return (colorType >= 0) && (colorType <= kLastEnum_SkColorType); |
25 } | 18 } |
26 | 19 |
27 SkImageInfo SkImageInfo::MakeS32(int width, int height, SkAlphaType at) { | 20 SkImageInfo SkImageInfo::MakeS32(int width, int height, SkAlphaType at) { |
28 return SkImageInfo(width, height, kN32_SkColorType, at, | 21 return SkImageInfo(width, height, kN32_SkColorType, at, |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 } | 126 } |
134 // here x,y are either 0 or negative | 127 // here x,y are either 0 or negative |
135 fPixels = ((char*)fPixels - y * fRowBytes - x * fInfo.bytesPerPixel()); | 128 fPixels = ((char*)fPixels - y * fRowBytes - x * fInfo.bytesPerPixel()); |
136 // the intersect may have shrunk info's logical size | 129 // the intersect may have shrunk info's logical size |
137 fInfo = fInfo.makeWH(srcR.width(), srcR.height()); | 130 fInfo = fInfo.makeWH(srcR.width(), srcR.height()); |
138 fX = srcR.x(); | 131 fX = srcR.x(); |
139 fY = srcR.y(); | 132 fY = srcR.y(); |
140 | 133 |
141 return true; | 134 return true; |
142 } | 135 } |
OLD | NEW |