36 lines
1.2 KiB
C++
36 lines
1.2 KiB
C++
#include "image_builder.hpp"
|
|
|
|
namespace pdfengine {
|
|
|
|
std::shared_ptr<const ImageObject> ImageBuilder::build(const ResolvedImageDescriptor& descriptor,
|
|
ImagePixelBuffer decodedPixels,
|
|
ImageDiagnostics diagnostics,
|
|
ImageStatistics statistics) {
|
|
ImageId id = generateNextImageId();
|
|
|
|
if (statistics.memoryBytes == 0) {
|
|
statistics.width = descriptor.geometry.width;
|
|
statistics.height = descriptor.geometry.height;
|
|
statistics.memoryBytes = decodedPixels.size();
|
|
statistics.compressedBytes = descriptor.originalStream.size();
|
|
statistics.decodedBytes = decodedPixels.size();
|
|
statistics.hasAlpha = descriptor.colorProfile.hasAlpha;
|
|
statistics.hasMask = descriptor.mask.hasMask();
|
|
}
|
|
|
|
return std::make_shared<const ImageObject>(
|
|
id,
|
|
descriptor.resourceName,
|
|
descriptor.geometry,
|
|
descriptor.encoding,
|
|
descriptor.colorProfile,
|
|
std::move(decodedPixels),
|
|
descriptor.mask,
|
|
descriptor.originalStream,
|
|
diagnostics,
|
|
statistics
|
|
);
|
|
}
|
|
|
|
} // namespace pdfengine
|