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

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

Issue 1076923002: SkJpegCodec (Closed) Base URL: https://skia.googlesource.com/skia.git@gif-real
Patch Set: SkJpegCodec Created 5 years, 8 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
OLDNEW
(Empty)
1 /*
2 * Copyright 2015 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #include "SkJpegAutoClean.h"
9 #include "SkJpegUtility.h"
10
11 JpegAutoClean::JpegAutoClean(jpeg_decompress_struct* jpegInfo, bool init)
12 : fJpegInfo(jpegInfo)
13 , fInit(init)
14 {}
15
16 JpegAutoClean::~JpegAutoClean() {
17 free();
scroggo 2015/04/10 17:19:05 nit: this->free()
msarett 2015/04/13 20:54:04 Done.
18 }
19
20 void JpegAutoClean::setInit(bool init) {
21 fInit = init;
22 }
23
24 jpeg_decompress_struct* JpegAutoClean::get() {
scroggo 2015/04/10 17:19:05 Down below I think I suggest that you do not call
msarett 2015/04/13 20:54:04 I added three operators and removed about one mill
25 return fJpegInfo.get();
26 }
27
28 jpeg_decompress_struct* JpegAutoClean::detach() {
29 fInit = false;
30 return fJpegInfo.detach();
31 }
32
33 void JpegAutoClean::reset(jpeg_decompress_struct* jpegInfo) {
34 free();
35 fJpegInfo.reset(jpegInfo);
36 }
37
38 void JpegAutoClean::free() {
39 if (NULL != fJpegInfo.get() && fInit) {
40 SkDELETE_ARRAY(((skjpeg_source_mgr*) fJpegInfo.get()->src)->fBuffer);
41 SkDELETE(fJpegInfo.get()->src);
42 SkDELETE(fJpegInfo.get()->err);
43 jpeg_destroy_decompress(fJpegInfo.get());
44 }
45 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698