OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 "SkSurface_Base.h" | 8 #include "SkSurface_Base.h" |
9 #include "SkImagePriv.h" | 9 #include "SkImagePriv.h" |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 } | 60 } |
61 shift = 1; | 61 shift = 1; |
62 break; | 62 break; |
63 case kN32_SkColorType: | 63 case kN32_SkColorType: |
64 if (info.colorSpace() && !info.colorSpace()->gammaCloseToSRGB()) { | 64 if (info.colorSpace() && !info.colorSpace()->gammaCloseToSRGB()) { |
65 return false; | 65 return false; |
66 } | 66 } |
67 shift = 2; | 67 shift = 2; |
68 break; | 68 break; |
69 case kRGBA_F16_SkColorType: | 69 case kRGBA_F16_SkColorType: |
70 if (!info.colorSpace() || | 70 if (!info.colorSpace() || !info.colorSpace()->gammaIsLinear()) { |
71 SkColorSpace::kLinear_GammaNamed != info.colorSpace()->gammaName
d()) { | |
72 return false; | 71 return false; |
73 } | 72 } |
74 shift = 3; | 73 shift = 3; |
75 break; | 74 break; |
76 default: | 75 default: |
77 return false; | 76 return false; |
78 } | 77 } |
79 | 78 |
80 if (kIgnoreRowBytesValue == rowBytes) { | 79 if (kIgnoreRowBytesValue == rowBytes) { |
81 return true; | 80 return true; |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 | 210 |
212 SkAutoTUnref<SkPixelRef> pr(SkMallocPixelRef::NewZeroed(info, rowBytes, null
ptr)); | 211 SkAutoTUnref<SkPixelRef> pr(SkMallocPixelRef::NewZeroed(info, rowBytes, null
ptr)); |
213 if (nullptr == pr.get()) { | 212 if (nullptr == pr.get()) { |
214 return nullptr; | 213 return nullptr; |
215 } | 214 } |
216 if (rowBytes) { | 215 if (rowBytes) { |
217 SkASSERT(pr->rowBytes() == rowBytes); | 216 SkASSERT(pr->rowBytes() == rowBytes); |
218 } | 217 } |
219 return sk_make_sp<SkSurface_Raster>(pr, props); | 218 return sk_make_sp<SkSurface_Raster>(pr, props); |
220 } | 219 } |
OLD | NEW |