7#include "core/fpdfapi/page/cpdf_iccprofile.h"
11#include "core/fpdfapi/parser/cpdf_stream.h"
12#include "core/fxcodec/icc/icc_transform.h"
16bool DetectSRGB(pdfium::span<
const uint8_t> span) {
17 static const char kSRGB[] =
"sRGB IEC61966-2.1";
18 return span.size() == 3144 && memcmp(&span[400], kSRGB, strlen(kSRGB)) == 0;
23CPDF_IccProfile::CPDF_IccProfile(
RetainPtr<
const CPDF_Stream> pStream,
24 pdfium::span<
const uint8_t> span,
25 uint32_t expected_components)
26 : m_bsRGB(DetectSRGB(span)), m_pStream(std::move(pStream)) {
32 auto transform = fxcodec::IccTransform::CreateTransformSRGB(span);
37 uint32_t components = transform->components();
38 if (components != expected_components) {
42 m_nSrcComponents = components;
43 m_Transform = std::move(transform);
49 return m_Transform->IsNormal();
52void CPDF_IccProfile::
Translate(pdfium::span<
const float> pSrcValues,
53 pdfium::span<
float> pDestValues) {
54 m_Transform->Translate(pSrcValues, pDestValues);
58 pdfium::span<
const uint8_t> pSrc,
60 m_Transform->TranslateScanline(pDest, pSrc, pixels);
void TranslateScanline(pdfium::span< uint8_t > pDest, pdfium::span< const uint8_t > pSrc, int pixels)
void Translate(pdfium::span< const float > pSrcValues, pdfium::span< float > pDestValues)
~CPDF_IccProfile() override