OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 // We just need the size of the image, so we have to temporarily create an | 140 // We just need the size of the image, so we have to temporarily create an |
141 // ImageDecoder. Since we only need the size, the premul and gamma settings | 141 // ImageDecoder. Since we only need the size, the premul and gamma settings |
142 // don't really matter. | 142 // don't really matter. |
143 std::unique_ptr<ImageDecoder> decoder = ImageDecoder::create( | 143 std::unique_ptr<ImageDecoder> decoder = ImageDecoder::create( |
144 segmentReader, true, ImageDecoder::AlphaPremultiplied, | 144 segmentReader, true, ImageDecoder::AlphaPremultiplied, |
145 ImageDecoder::ColorSpaceApplied); | 145 ImageDecoder::ColorSpaceApplied); |
146 if (!decoder || !decoder->isSizeAvailable()) | 146 if (!decoder || !decoder->isSizeAvailable()) |
147 return nullptr; | 147 return nullptr; |
148 | 148 |
149 const IntSize size = decoder->size(); | 149 const IntSize size = decoder->size(); |
150 const SkImageInfo info = | 150 const SkImageInfo info = SkImageInfo::MakeN32( |
151 SkImageInfo::MakeN32Premul(size.width(), size.height()); | 151 size.width(), size.height(), kPremul_SkAlphaType, decoder->colorSpace()); |
152 | 152 |
153 RefPtr<ImageFrameGenerator> frame = ImageFrameGenerator::create( | 153 RefPtr<ImageFrameGenerator> frame = ImageFrameGenerator::create( |
154 SkISize::Make(size.width(), size.height()), false); | 154 SkISize::Make(size.width(), size.height()), decoder->colorSpace(), false); |
155 if (!frame) | 155 if (!frame) |
156 return nullptr; | 156 return nullptr; |
157 | 157 |
158 return new DecodingImageGenerator(frame, info, segmentReader.release(), true, | 158 return new DecodingImageGenerator(frame, info, segmentReader.release(), true, |
159 0); | 159 0); |
160 } | 160 } |
161 | 161 |
162 } // namespace blink | 162 } // namespace blink |
OLD | NEW |