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

Unified Diff: src/codec/SkJpegAutoClean.h

Issue 1076923002: SkJpegCodec (Closed) Base URL: https://skia.googlesource.com/skia.git@gif-real
Patch Set: JpegAutoClean is easier to use, Scaling is tested 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 side-by-side diff with in-line comments
Download patch
Index: src/codec/SkJpegAutoClean.h
diff --git a/src/codec/SkJpegAutoClean.h b/src/codec/SkJpegAutoClean.h
new file mode 100644
index 0000000000000000000000000000000000000000..04aebdf48567278e993be892915425c64c60a6e4
--- /dev/null
+++ b/src/codec/SkJpegAutoClean.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2015 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef SkJpegAutoClean_DEFINED
+#define SkJpegAutoClean_DEFINED
+
+#include "SkJpegUtility.h"
+#include "SkTemplates.h"
+
+// stdio is needed for jpeglib
+#include <stdio.h>
+#include "jpeglib.h"
+
+/*
+ * This object automatically cleans up memory after a jpeg decode
+ */
+class JpegAutoClean : SkNoncopyable {
+public:
+
+ /*
+ * Takes ownership of all thre input pointers.
scroggo 2015/04/14 13:10:32 three*
msarett 2015/04/14 19:30:36 Acknowledged.
+ */
+ JpegAutoClean(jpeg_decompress_struct* dinfo,
+ skjpeg_source_mgr* srcMgr,
+ skjpeg_error_mgr* errMgr);
+
+ /*
+ * Calls destroy on jpeg_decompress_struct.
+ * Owned pointers will be delted automatically.
scroggo 2015/04/14 13:10:32 deleted*
msarett 2015/04/14 19:30:36 Acknowledged.
+ */
+ ~JpegAutoClean();
+
+ /*
+ * Get the decompress info struct.
+ */
+ jpeg_decompress_struct* dinfo();
+
+private:
+
+ SkAutoTDelete<jpeg_decompress_struct> fDInfo;
scroggo 2015/04/14 13:10:32 Do these all need to be passed in? What if you mak
msarett 2015/04/14 19:30:36 Done.
+ SkAutoTDelete<skjpeg_source_mgr> fSrcMgr;
+ SkAutoTDelete<skjpeg_error_mgr> fErrorMgr;
+};
+
+#endif

Powered by Google App Engine
This is Rietveld 408576698