Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(170)

Side by Side Diff: src/codec/SkCodec.cpp

Issue 1809733002: detach -> release (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: (C) Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/codec/SkBmpCodec.cpp ('k') | src/codec/SkGifCodec.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "SkBmpCodec.h" 8 #include "SkBmpCodec.h"
9 #include "SkCodec.h" 9 #include "SkCodec.h"
10 #include "SkCodecPriv.h" 10 #include "SkCodecPriv.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 if (!stream->rewind()) { 81 if (!stream->rewind()) {
82 SkCodecPrintf("Encoded image data could not peek or rewind to determ ine format!\n"); 82 SkCodecPrintf("Encoded image data could not peek or rewind to determ ine format!\n");
83 return nullptr; 83 return nullptr;
84 } 84 }
85 } 85 }
86 86
87 // PNG is special, since we want to be able to supply an SkPngChunkReader. 87 // PNG is special, since we want to be able to supply an SkPngChunkReader.
88 // But this code follows the same pattern as the loop. 88 // But this code follows the same pattern as the loop.
89 #ifdef SK_CODEC_DECODES_PNG 89 #ifdef SK_CODEC_DECODES_PNG
90 if (SkPngCodec::IsPng(buffer, bytesRead)) { 90 if (SkPngCodec::IsPng(buffer, bytesRead)) {
91 return SkPngCodec::NewFromStream(streamDeleter.detach(), chunkReader); 91 return SkPngCodec::NewFromStream(streamDeleter.release(), chunkReader);
92 } else 92 } else
93 #endif 93 #endif
94 { 94 {
95 for (DecoderProc proc : gDecoderProcs) { 95 for (DecoderProc proc : gDecoderProcs) {
96 if (proc.IsFormat(buffer, bytesRead)) { 96 if (proc.IsFormat(buffer, bytesRead)) {
97 return proc.NewFromStream(streamDeleter.detach()); 97 return proc.NewFromStream(streamDeleter.release());
98 } 98 }
99 } 99 }
100 100
101 #ifdef SK_CODEC_DECODES_RAW 101 #ifdef SK_CODEC_DECODES_RAW
102 // Try to treat the input as RAW if all the other checks failed. 102 // Try to treat the input as RAW if all the other checks failed.
103 return SkRawCodec::NewFromStream(streamDeleter.detach()); 103 return SkRawCodec::NewFromStream(streamDeleter.release());
104 #endif 104 #endif
105 } 105 }
106 106
107 return nullptr; 107 return nullptr;
108 } 108 }
109 109
110 SkCodec* SkCodec::NewFromData(SkData* data, SkPngChunkReader* reader) { 110 SkCodec* SkCodec::NewFromData(SkData* data, SkPngChunkReader* reader) {
111 if (!data) { 111 if (!data) {
112 return nullptr; 112 return nullptr;
113 } 113 }
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 SkASSERT(1 == linesRequested || this->getInfo().height() == linesReq uested); 379 SkASSERT(1 == linesRequested || this->getInfo().height() == linesReq uested);
380 const SkImageInfo fillInfo = info.makeWH(fillWidth, 1); 380 const SkImageInfo fillInfo = info.makeWH(fillWidth, 1);
381 for (int srcY = linesDecoded; srcY < linesRequested; srcY++) { 381 for (int srcY = linesDecoded; srcY < linesRequested; srcY++) {
382 fillDst = SkTAddOffset<void>(dst, this->outputScanline(srcY) * r owBytes); 382 fillDst = SkTAddOffset<void>(dst, this->outputScanline(srcY) * r owBytes);
383 fill_proc(fillInfo, fillDst, rowBytes, fillValue, zeroInit, samp ler); 383 fill_proc(fillInfo, fillDst, rowBytes, fillValue, zeroInit, samp ler);
384 } 384 }
385 break; 385 break;
386 } 386 }
387 } 387 }
388 } 388 }
OLDNEW
« no previous file with comments | « src/codec/SkBmpCodec.cpp ('k') | src/codec/SkGifCodec.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698