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

Unified Diff: skia/ext/skia_encode_image.cc

Issue 2527833002: Implement SkEncodeImage() (Closed)
Patch Set: 2016-11-28 (Monday) 17:33:22 EST Created 4 years, 1 month 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: skia/ext/skia_encode_image.cc
diff --git a/skia/ext/skia_encode_image.cc b/skia/ext/skia_encode_image.cc
new file mode 100644
index 0000000000000000000000000000000000000000..13e3ff0f8a99b66c8d0e9b687156019c8a093e6e
--- /dev/null
+++ b/skia/ext/skia_encode_image.cc
@@ -0,0 +1,20 @@
+// Copyright (c) 2016 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.
+
+#include "skia/ext/skia_encode_image.h"
+
+#include "third_party/skia/include/core/SkImageEncoder.h"
+
+static skia::ImageEncoder g_image_encoder = nullptr;
+
+void skia::SetEmageEncoder(skia::ImageEncoder image_encoder) {
+ g_image_encoder = image_encoder;
+}
+
+bool SkEncodeImage(SkWStream* stream,
+ const SkPixmap& pixmap,
+ SkEncodedImageFormat format,
+ int quality) {
+ return g_image_encoder && g_image_encoder(stream, pixmap, format, quality);
+}

Powered by Google App Engine
This is Rietveld 408576698