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

Side by Side Diff: src/codec/SkJpegCodec.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/SkIcoCodec.cpp ('k') | src/codec/SkPngCodec.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 "SkCodec.h" 8 #include "SkCodec.h"
9 #include "SkMSAN.h" 9 #include "SkMSAN.h"
10 #include "SkJpegCodec.h" 10 #include "SkJpegCodec.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 return decoderMgr->returnFalse("read_header"); 48 return decoderMgr->returnFalse("read_header");
49 } 49 }
50 50
51 if (nullptr != codecOut) { 51 if (nullptr != codecOut) {
52 // Recommend the color type to decode to 52 // Recommend the color type to decode to
53 const SkColorType colorType = decoderMgr->getColorType(); 53 const SkColorType colorType = decoderMgr->getColorType();
54 54
55 // Create image info object and the codec 55 // Create image info object and the codec
56 const SkImageInfo& imageInfo = SkImageInfo::Make(decoderMgr->dinfo()->im age_width, 56 const SkImageInfo& imageInfo = SkImageInfo::Make(decoderMgr->dinfo()->im age_width,
57 decoderMgr->dinfo()->image_height, colorType, kOpaque_SkAlphaTyp e); 57 decoderMgr->dinfo()->image_height, colorType, kOpaque_SkAlphaTyp e);
58 *codecOut = new SkJpegCodec(imageInfo, stream, decoderMgr.detach()); 58 *codecOut = new SkJpegCodec(imageInfo, stream, decoderMgr.release());
59 } else { 59 } else {
60 SkASSERT(nullptr != decoderMgrOut); 60 SkASSERT(nullptr != decoderMgrOut);
61 *decoderMgrOut = decoderMgr.detach(); 61 *decoderMgrOut = decoderMgr.release();
62 } 62 }
63 return true; 63 return true;
64 } 64 }
65 65
66 SkCodec* SkJpegCodec::NewFromStream(SkStream* stream) { 66 SkCodec* SkJpegCodec::NewFromStream(SkStream* stream) {
67 SkAutoTDelete<SkStream> streamDeleter(stream); 67 SkAutoTDelete<SkStream> streamDeleter(stream);
68 SkCodec* codec = nullptr; 68 SkCodec* codec = nullptr;
69 if (ReadHeader(stream, &codec, nullptr)) { 69 if (ReadHeader(stream, &codec, nullptr)) {
70 // Codec has taken ownership of the stream, we do not need to delete it 70 // Codec has taken ownership of the stream, we do not need to delete it
71 SkASSERT(codec); 71 SkASSERT(codec);
72 streamDeleter.detach(); 72 streamDeleter.release();
73 return codec; 73 return codec;
74 } 74 }
75 return nullptr; 75 return nullptr;
76 } 76 }
77 77
78 SkJpegCodec::SkJpegCodec(const SkImageInfo& srcInfo, SkStream* stream, 78 SkJpegCodec::SkJpegCodec(const SkImageInfo& srcInfo, SkStream* stream,
79 JpegDecoderMgr* decoderMgr) 79 JpegDecoderMgr* decoderMgr)
80 : INHERITED(srcInfo, stream) 80 : INHERITED(srcInfo, stream)
81 , fDecoderMgr(decoderMgr) 81 , fDecoderMgr(decoderMgr)
82 , fReadyState(decoderMgr->dinfo()->global_state) 82 , fReadyState(decoderMgr->dinfo()->global_state)
(...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after
729 729
730 JDIMENSION linesRead = jpeg_read_raw_data(dinfo, yuv, numRowsPerBlock); 730 JDIMENSION linesRead = jpeg_read_raw_data(dinfo, yuv, numRowsPerBlock);
731 if (linesRead < remainingRows) { 731 if (linesRead < remainingRows) {
732 // FIXME: Handle incomplete YUV decodes without signalling an error. 732 // FIXME: Handle incomplete YUV decodes without signalling an error.
733 return kInvalidInput; 733 return kInvalidInput;
734 } 734 }
735 } 735 }
736 736
737 return kSuccess; 737 return kSuccess;
738 } 738 }
OLDNEW
« no previous file with comments | « src/codec/SkIcoCodec.cpp ('k') | src/codec/SkPngCodec.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698