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. |
// |