aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/encode/SkEncoder.h
diff options
context:
space:
mode:
authorGravatar Matt Sarett <msarett@google.com>2017-05-08 17:31:00 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-05-09 17:46:30 +0000
commit94fd06f074016e3ca6a82b88dfdc0ec61d24e67e (patch)
treef46f54e2d8066a749c29e277da2e38c3e6fc4cca /include/encode/SkEncoder.h
parent6dfcecad33c949e775a3fd0a58637721ab5e295e (diff)
Move SkPngEncoder into public API
Bug: 713862 Change-Id: I45068ed39affe41ffe0f29bf42c5ea1d9b0247ba Reviewed-on: https://skia-review.googlesource.com/15897 Reviewed-by: Mike Reed <reed@google.com> Reviewed-by: Mike Klein <mtklein@chromium.org> Reviewed-by: Leon Scroggins <scroggo@google.com> Commit-Queue: Matt Sarett <msarett@google.com>
Diffstat (limited to 'include/encode/SkEncoder.h')
-rw-r--r--include/encode/SkEncoder.h41
1 files changed, 41 insertions, 0 deletions
diff --git a/include/encode/SkEncoder.h b/include/encode/SkEncoder.h
new file mode 100644
index 0000000000..d1b99fd5af
--- /dev/null
+++ b/include/encode/SkEncoder.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2017 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef SkEncoder_DEFINED
+#define SkEncoder_DEFINED
+
+#include "SkPixmap.h"
+#include "../private/SkTemplates.h"
+
+class SkEncoder : SkNoncopyable {
+public:
+
+ /**
+ * Encode |numRows| rows of input. If the caller requests more rows than are remaining
+ * in the src, this will encode all of the remaining rows. |numRows| must be greater
+ * than zero.
+ */
+ bool encodeRows(int numRows);
+
+ virtual ~SkEncoder() {}
+
+protected:
+
+ virtual bool onEncodeRows(int numRows) = 0;
+
+ SkEncoder(const SkPixmap& src, size_t storageBytes)
+ : fSrc(src)
+ , fCurrRow(0)
+ , fStorage(storageBytes)
+ {}
+
+ const SkPixmap& fSrc;
+ int fCurrRow;
+ SkAutoTMalloc<uint8_t> fStorage;
+};
+
+#endif