| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef UI_GFX_VECTOR_WSTREAM_CODEC_H_ |
| 6 #define UI_GFX_VECTOR_WSTREAM_CODEC_H_ |
| 7 |
| 8 #include <stddef.h> |
| 9 |
| 10 #include <vector> |
| 11 |
| 12 #include "base/logging.h" |
| 13 #include "third_party/skia/include/core/SkStream.h" |
| 14 |
| 15 namespace gfx { |
| 16 |
| 17 class VectorWStream : public SkWStream { |
| 18 public: |
| 19 // We do not take ownership of dst |
| 20 VectorWStream(std::vector<unsigned char>* dst) : dst_(dst) { |
| 21 DCHECK(dst_); |
| 22 DCHECK_EQ(0UL, dst_->size()); |
| 23 } |
| 24 |
| 25 bool write(const void* buffer, size_t size) override; |
| 26 |
| 27 size_t bytesWritten() const override; |
| 28 |
| 29 private: |
| 30 // Does not have ownership. |
| 31 std::vector<unsigned char>* dst_; |
| 32 }; |
| 33 |
| 34 } // namespace gfx |
| 35 |
| 36 #endif // UI_GFX_VECTOR_WSTREAM_H_ |
| OLD | NEW |