| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 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 "SkImageGeneratorCG.h" | 8 #include "SkImageGeneratorCG.h" |
| 9 | 9 |
| 10 #ifdef SK_BUILD_FOR_MAC | 10 #ifdef SK_BUILD_FOR_MAC |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 return nullptr; | 59 return nullptr; |
| 60 } | 60 } |
| 61 | 61 |
| 62 SkAlphaType alphaType = hasAlpha ? kPremul_SkAlphaType : kOpaque_SkAlphaType
; | 62 SkAlphaType alphaType = hasAlpha ? kPremul_SkAlphaType : kOpaque_SkAlphaType
; |
| 63 SkImageInfo info = SkImageInfo::Make(width, height, kN32_SkColorType, alphaT
ype); | 63 SkImageInfo info = SkImageInfo::Make(width, height, kN32_SkColorType, alphaT
ype); |
| 64 | 64 |
| 65 // FIXME: We have the opportunity to extract color space information here, | 65 // FIXME: We have the opportunity to extract color space information here, |
| 66 // though I think it makes sense to wait until we understand how | 66 // though I think it makes sense to wait until we understand how |
| 67 // we want to communicate it to the generator. | 67 // we want to communicate it to the generator. |
| 68 | 68 |
| 69 return new SkImageGeneratorCG(info, autoImageSrc.detach(), data); | 69 return new SkImageGeneratorCG(info, autoImageSrc.release(), data); |
| 70 } | 70 } |
| 71 | 71 |
| 72 SkImageGeneratorCG::SkImageGeneratorCG(const SkImageInfo& info, const void* imag
eSrc, SkData* data) | 72 SkImageGeneratorCG::SkImageGeneratorCG(const SkImageInfo& info, const void* imag
eSrc, SkData* data) |
| 73 : INHERITED(info) | 73 : INHERITED(info) |
| 74 , fImageSrc(imageSrc) | 74 , fImageSrc(imageSrc) |
| 75 , fData(SkRef(data)) | 75 , fData(SkRef(data)) |
| 76 {} | 76 {} |
| 77 | 77 |
| 78 SkData* SkImageGeneratorCG::onRefEncodedData(SK_REFENCODEDDATA_CTXPARAM) { | 78 SkData* SkImageGeneratorCG::onRefEncodedData(SK_REFENCODEDDATA_CTXPARAM) { |
| 79 return SkRef(fData.get()); | 79 return SkRef(fData.get()); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 // kGray_8_SkColorType | 113 // kGray_8_SkColorType |
| 114 // kIndex_8_SkColorType | 114 // kIndex_8_SkColorType |
| 115 // Additionally, it would be interesting to compare the performance | 115 // Additionally, it would be interesting to compare the performance |
| 116 // of SkSwizzler with CG's built in swizzler. | 116 // of SkSwizzler with CG's built in swizzler. |
| 117 if (!SkCopyPixelsFromCGImage(info, rowBytes, pixels, image)) { | 117 if (!SkCopyPixelsFromCGImage(info, rowBytes, pixels, image)) { |
| 118 return false; | 118 return false; |
| 119 } | 119 } |
| 120 | 120 |
| 121 return true; | 121 return true; |
| 122 } | 122 } |
| OLD | NEW |