Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 "SkCodecPriv.h" | 8 #include "SkCodecPriv.h" |
| 9 #include "SkWebpCodec.h" | 9 #include "SkWebpCodec.h" |
| 10 #include "SkTemplates.h" | 10 #include "SkTemplates.h" |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 101 // FIXME (msarett): | 101 // FIXME (msarett): |
| 102 // Temporary strategy for getting ICC profiles from webps. Once the increme ntal decoding | 102 // Temporary strategy for getting ICC profiles from webps. Once the increme ntal decoding |
| 103 // API lands, we will use the WebPDemuxer to manage the entire decode. | 103 // API lands, we will use the WebPDemuxer to manage the entire decode. |
| 104 sk_sp<SkColorSpace> colorSpace = nullptr; | 104 sk_sp<SkColorSpace> colorSpace = nullptr; |
| 105 const void* memory = stream->getMemoryBase(); | 105 const void* memory = stream->getMemoryBase(); |
| 106 if (memory) { | 106 if (memory) { |
| 107 WebPData data = { (const uint8_t*) memory, stream->getLength() }; | 107 WebPData data = { (const uint8_t*) memory, stream->getLength() }; |
| 108 WebPDemuxState state; | 108 WebPDemuxState state; |
| 109 SkAutoTCallVProc<WebPDemuxer, WebPDemuxDelete> demux(WebPDemuxPartial(&d ata, &state)); | 109 SkAutoTCallVProc<WebPDemuxer, WebPDemuxDelete> demux(WebPDemuxPartial(&d ata, &state)); |
| 110 | 110 |
| 111 WebPChunkIterator chunkIterator; | 111 WebPChunkIterator chunkIterator; |
|
bungeman-skia
2016/08/24 21:39:49
Now that we've established webp has done a silly t
| |
| 112 SkAutoTCallVProc<WebPChunkIterator, WebPDemuxReleaseChunkIterator> autoC I(&chunkIterator); | 112 sk_at_scope_end(WebPDemuxReleaseChunkIterator(&chunkIterator)); |
| 113 if (demux && WebPDemuxGetChunk(demux, "ICCP", 1, &chunkIterator)) { | 113 if (demux && WebPDemuxGetChunk(demux, "ICCP", 1, &chunkIterator)) { |
|
bungeman-skia
2016/08/24 15:18:17
Is it valid to call WebPDemuxReleaseChunkIterator
mtklein
2016/08/24 16:52:58
Gonna have to leave this one to Matt.
I don't thin
msarett
2016/08/24 17:01:25
I'm following the same pattern as chromium here.
h
| |
| 114 colorSpace = SkColorSpace::NewICC(chunkIterator.chunk.bytes, chunkIt erator.chunk.size); | 114 colorSpace = SkColorSpace::NewICC(chunkIterator.chunk.bytes, chunkIt erator.chunk.size); |
| 115 } | 115 } |
| 116 } | 116 } |
| 117 | 117 |
| 118 if (!colorSpace) { | 118 if (!colorSpace) { |
| 119 colorSpace = SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named); | 119 colorSpace = SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named); |
| 120 } | 120 } |
| 121 | 121 |
| 122 SkEncodedInfo info = SkEncodedInfo::Make(color, alpha, 8); | 122 SkEncodedInfo info = SkEncodedInfo::Make(color, alpha, 8); |
| 123 return new SkWebpCodec(features.width, features.height, info, colorSpace, | 123 return new SkWebpCodec(features.width, features.height, info, colorSpace, |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 286 default: | 286 default: |
| 287 return kInvalidInput; | 287 return kInvalidInput; |
| 288 } | 288 } |
| 289 } | 289 } |
| 290 } | 290 } |
| 291 | 291 |
| 292 SkWebpCodec::SkWebpCodec(int width, int height, const SkEncodedInfo& info, | 292 SkWebpCodec::SkWebpCodec(int width, int height, const SkEncodedInfo& info, |
| 293 sk_sp<SkColorSpace> colorSpace, SkStream* stream) | 293 sk_sp<SkColorSpace> colorSpace, SkStream* stream) |
| 294 : INHERITED(width, height, info, stream, colorSpace) | 294 : INHERITED(width, height, info, stream, colorSpace) |
| 295 {} | 295 {} |
| OLD | NEW |