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

Unified Diff: components/suggestions/jpeg/jpeg_image_encoder.h

Issue 630073002: [Suggestions] Create ImageEncoder, to abstract away image encode/decode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: gn fix Created 6 years, 2 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: components/suggestions/jpeg/jpeg_image_encoder.h
diff --git a/components/suggestions/jpeg/jpeg_image_encoder.h b/components/suggestions/jpeg/jpeg_image_encoder.h
new file mode 100644
index 0000000000000000000000000000000000000000..09f3975cc88222555e4a5a5aba652d66d9ee936b
--- /dev/null
+++ b/components/suggestions/jpeg/jpeg_image_encoder.h
@@ -0,0 +1,37 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef COMPONENTS_SUGGESTIONS_JPEG_JPEG_IMAGE_ENCODER_H_
+#define COMPONENTS_SUGGESTIONS_JPEG_JPEG_IMAGE_ENCODER_H_
+
+#include <vector>
+
+#include "base/macros.h"
+#include "components/suggestions/image_encoder.h"
+
+class SkBitmap;
+
+namespace suggestions {
+
+// A class used to encode/decode images using the JPEG codec.
+class JpegImageEncoder : public ImageEncoder {
+ public:
+ JpegImageEncoder() {}
+ virtual ~JpegImageEncoder() {}
+
+ // From encoded bytes to SkBitmap. Caller owns the returned pointer.
+ virtual SkBitmap* DecodeImage(
+ const std::vector<unsigned char>& encoded_data) OVERRIDE;
+
+ // From SkBitmap to the vector of encoded bytes, |dst|.
+ virtual bool EncodeImage(const SkBitmap& bitmap,
+ std::vector<unsigned char>* dest) OVERRIDE;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(JpegImageEncoder);
+};
+
+} // namespace suggestions
+
+#endif // COMPONENTS_SUGGESTIONS_JPEG_JPEG_IMAGE_ENCODER_H_

Powered by Google App Engine
This is Rietveld 408576698