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

Unified Diff: third_party/WebKit/Source/platform/graphics/skia/SkiaUtils.h

Issue 2878333004: Use SkJpegEncoder in WebKit platform (Closed)
Patch Set: Created 3 years, 7 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: third_party/WebKit/Source/platform/graphics/skia/SkiaUtils.h
diff --git a/third_party/WebKit/Source/platform/graphics/skia/SkiaUtils.h b/third_party/WebKit/Source/platform/graphics/skia/SkiaUtils.h
index 93b6db0ed310969cf73d21617e8c7a3e4bb87678..db84ecbf0a4e343f75558dc19e6fd26f06e578ce 100644
--- a/third_party/WebKit/Source/platform/graphics/skia/SkiaUtils.h
+++ b/third_party/WebKit/Source/platform/graphics/skia/SkiaUtils.h
@@ -143,6 +143,25 @@ inline PaintCanvas::SrcRectConstraint WebCoreClampingModeToSkiaRectConstraint(
: PaintCanvas::kFast_SrcRectConstraint;
}
+class VectorWStream : public SkWStream {
+ public:
+ VectorWStream(Vector<unsigned char>* dst) : dst_(dst) {
+ DCHECK(dst_);
+ DCHECK_EQ(0UL, dst->size());
+ }
+
+ bool write(const void* buffer, size_t size) override {
+ dst_->Append((const unsigned char*)buffer, size);
+ return true;
+ }
+
+ size_t bytesWritten() const override { return dst_->size(); }
+
+ private:
+ // Does not own
+ Vector<unsigned char>* dst_;
+};
+
// Skia's smart pointer APIs are preferable over their legacy raw pointer
// counterparts.
//

Powered by Google App Engine
This is Rietveld 408576698