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

Unified Diff: ui/gfx/codec/jpeg_codec.cc

Issue 2944633002: Use SkPngEncoder in gfx jpeg_codec (Closed)
Patch Set: Cast Created 3 years, 5 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 | « ui/gfx/codec/BUILD.gn ('k') | ui/gfx/codec/png_codec.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/codec/jpeg_codec.cc
diff --git a/ui/gfx/codec/jpeg_codec.cc b/ui/gfx/codec/jpeg_codec.cc
index e4ce6857fce0d1aceb29895b302c25465d666522..5ff77d782b8b5f7a6b162c328ea9d34df246aa77 100644
--- a/ui/gfx/codec/jpeg_codec.cc
+++ b/ui/gfx/codec/jpeg_codec.cc
@@ -11,8 +11,8 @@
#include "base/logging.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "third_party/skia/include/core/SkColorPriv.h"
-#include "third_party/skia/include/core/SkStream.h"
#include "third_party/skia/include/encode/SkJpegEncoder.h"
+#include "ui/gfx/codec/vector_wstream.h"
extern "C" {
#if defined(USE_SYSTEM_LIBJPEG)
@@ -47,29 +47,6 @@ void ErrorExit(jpeg_common_struct* cinfo) {
// Encoder ---------------------------------------------------------------------
-namespace {
-
-class VectorWStream : public SkWStream {
- public:
- VectorWStream(std::vector<unsigned char>* dst) : dst_(dst) {
- DCHECK(dst_);
- DCHECK_EQ(0UL, dst_->size());
- }
-
- bool write(const void* buffer, size_t size) override {
- const unsigned char* ptr = reinterpret_cast<const unsigned char*>(buffer);
- dst_->insert(dst_->end(), ptr, ptr + size);
- return true;
- }
-
- size_t bytesWritten() const override { return dst_->size(); }
-
- private:
- // Does not have ownership.
- std::vector<unsigned char>* dst_;
-};
-};
-
bool JPEGCodec::Encode(const SkPixmap& src,
int quality,
std::vector<unsigned char>* output) {
« no previous file with comments | « ui/gfx/codec/BUILD.gn ('k') | ui/gfx/codec/png_codec.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698