From 2d6d3250dcb304c8ad081dedc8eef6ea48fd669d Mon Sep 17 00:00:00 2001 From: Eino-Ville Talvala Date: Thu, 15 Nov 2018 16:07:46 -0800 Subject: Initial commit of libimage_io Image_io is a library for manipulating image files, especially XMP metadata within them. Test: m libimage_io Bug: 109735087 Bug: 119211681 Change-Id: I657f307be0459fe40154806c7cd388b97bcb0ea5 --- includes/image_io/base/data_segment_data_source.h | 30 +++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 includes/image_io/base/data_segment_data_source.h (limited to 'includes/image_io/base/data_segment_data_source.h') diff --git a/includes/image_io/base/data_segment_data_source.h b/includes/image_io/base/data_segment_data_source.h new file mode 100644 index 0000000..6ef6c3e --- /dev/null +++ b/includes/image_io/base/data_segment_data_source.h @@ -0,0 +1,30 @@ +#ifndef IMAGE_IO_BASE_DATA_SEGMENT_DATA_SOURCE_H_ // NOLINT +#define IMAGE_IO_BASE_DATA_SEGMENT_DATA_SOURCE_H_ // NOLINT + +#include "image_io/base/data_source.h" + +namespace photos_editing_formats { +namespace image_io { + +/// DataSegmentDataSource is an implementation of DataSource that provides +/// access to requested DataSegment instances from a single (possibly large) +/// in-memory DataSegment. +class DataSegmentDataSource : public DataSource { + public: + explicit DataSegmentDataSource( + const std::shared_ptr& shared_data_segment) + : shared_data_segment_(shared_data_segment) {} + void Reset() override; + std::shared_ptr GetDataSegment(size_t begin, + size_t min_size) override; + TransferDataResult TransferData(const DataRange& data_range, size_t best_size, + DataDestination* data_destination) override; + + private: + std::shared_ptr shared_data_segment_; +}; + +} // namespace image_io +} // namespace photos_editing_formats + +#endif // IMAGE_IO_BASE_DATA_SEGMENT_DATA_SOURCE_H_ // NOLINT -- cgit v1.2.3