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

Unified Diff: src/codec/SkWebpCodec.h

Issue 1044433002: Add SkWebpCodec, for decoding .webp images. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix conversion from float to int. Created 5 years, 6 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
« no previous file with comments | « src/codec/SkCodec.cpp ('k') | src/codec/SkWebpCodec.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/codec/SkWebpCodec.h
diff --git a/src/codec/SkWebpCodec.h b/src/codec/SkWebpCodec.h
new file mode 100644
index 0000000000000000000000000000000000000000..9ea6a94ecb953215c1d3974480601ee3683633b4
--- /dev/null
+++ b/src/codec/SkWebpCodec.h
@@ -0,0 +1,38 @@
+/*
+ * 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 SkWebpCodec_DEFINED
+#define SkWebpCodec_DEFINED
+
+#include "SkCodec.h"
+#include "SkEncodedFormat.h"
+#include "SkImageInfo.h"
+#include "SkTypes.h"
+
+class SkStream;
+
+class SkWebpCodec final : public SkCodec {
+public:
+ // Assumes IsWebp was called and returned true.
+ static SkCodec* NewFromStream(SkStream*);
+ static bool IsWebp(SkStream*);
+protected:
+ Result onGetPixels(const SkImageInfo&, void*, size_t, const Options&, SkPMColor*, int*)
+ override;
+ SkEncodedFormat onGetEncodedFormat() const override { return kWEBP_SkEncodedFormat; }
+
+ bool onReallyHasAlpha() const override {
+ return this->getInfo().alphaType() != kOpaque_SkAlphaType;
+ }
+
+ SkISize onGetScaledDimensions(float desiredScale) const override;
+private:
+ SkWebpCodec(const SkImageInfo&, SkStream*);
+
+ typedef SkCodec INHERITED;
+};
+#endif // SkWebpCodec_DEFINED
« no previous file with comments | « src/codec/SkCodec.cpp ('k') | src/codec/SkWebpCodec.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698