Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | List of all members
SkJpegMetadataDecoderImpl Class Reference
Inheritance diagram for SkJpegMetadataDecoderImpl:
SkJpegMetadataDecoder

Public Member Functions

 SkJpegMetadataDecoderImpl (SkJpegMarkerList markerList)
 
sk_sp< SkDatagetExifMetadata (bool copyData) const override
 
sk_sp< SkDatagetICCProfileData (bool copyData) const override
 
bool mightHaveGainmapImage () const override
 
bool findGainmapImage (sk_sp< SkData > baseImageData, sk_sp< SkData > &outGainmapImageData, SkGainmapInfo &outGainmapInfo) override
 
- Public Member Functions inherited from SkJpegMetadataDecoder
 SkJpegMetadataDecoder ()
 
virtual ~SkJpegMetadataDecoder ()
 
 SkJpegMetadataDecoder (const SkJpegMetadataDecoder &)=delete
 
SkJpegMetadataDecoderoperator= (const SkJpegMetadataDecoder &)=delete
 

Additional Inherited Members

- Static Public Member Functions inherited from SkJpegMetadataDecoder
static std::unique_ptr< SkJpegMetadataDecoderMake (std::vector< Segment > headerSegments)
 

Detailed Description

Definition at line 1318 of file SkJpegCodec.cpp.

Constructor & Destructor Documentation

◆ SkJpegMetadataDecoderImpl()

SkJpegMetadataDecoderImpl::SkJpegMetadataDecoderImpl ( SkJpegMarkerList  markerList)
inline

Definition at line 1320 of file SkJpegCodec.cpp.

1320: fMarkerList(std::move(markerList)) {}

Member Function Documentation

◆ findGainmapImage()

bool SkJpegMetadataDecoderImpl::findGainmapImage ( sk_sp< SkData baseImageData,
sk_sp< SkData > &  outGainmapImagedata,
SkGainmapInfo outGainmapInfo 
)
inlineoverridevirtual

Given a JPEG encoded image |baseImageData|, return in |outGainmapImageData| the JPEG encoded gainmap image and return in |outGainmapInfo| its gainmap rendering parameters. Return true if both output variables were successfully populated, otherwise return false.

Implements SkJpegMetadataDecoder.

Definition at line 1351 of file SkJpegCodec.cpp.

1353 {
1354#ifdef SK_CODEC_DECODES_JPEG_GAINMAPS
1355 auto baseImageStream = SkMemoryStream::Make(baseImageData);
1356 auto sourceMgr = SkJpegSourceMgr::Make(baseImageStream.get());
1357 SkGainmapInfo gainmapInfo;
1358 std::unique_ptr<SkStream> gainmapImageStream;
1359 if (!get_gainmap_info(fMarkerList, sourceMgr.get(), &gainmapInfo, &gainmapImageStream)) {
1360 return false;
1361 }
1362
1363 // TODO(https://crbug.com/1404000): The function |get_gainmap_info| will always return an
1364 // SkStream that is backed by an SkData. Change it to return that SkData, to avoid this
1365 // re-extraction of the SkData.
1366 SkASSERT(gainmapImageStream->getMemoryBase());
1367 outGainmapImageData = SkData::MakeWithCopy(gainmapImageStream->getMemoryBase(),
1368 gainmapImageStream->getLength());
1369 outGainmapInfo = gainmapInfo;
1370 return true;
1371#else
1372 return false;
1373#endif
1374 }
#define SkASSERT(cond)
Definition SkAssert.h:116
static sk_sp< SkData > MakeWithCopy(const void *data, size_t length)
Definition SkData.cpp:111
static std::unique_ptr< SkJpegSourceMgr > Make(SkStream *stream, size_t bufferSize=1024)
static std::unique_ptr< SkMemoryStream > Make(sk_sp< SkData > data)
Definition SkStream.cpp:314

◆ getExifMetadata()

sk_sp< SkData > SkJpegMetadataDecoderImpl::getExifMetadata ( bool  copyData) const
inlineoverridevirtual

Return the Exif data attached to the image (if any) and nullptr otherwise. If |copyData| is false, then the returned SkData may directly reference the data provided when this object was created.

Implements SkJpegMetadataDecoder.

Definition at line 1322 of file SkJpegCodec.cpp.

1322 {
1323 return read_metadata(fMarkerList,
1325 kExifSig,
1326 sizeof(kExifSig),
1327 /*signaturePadding=*/1,
1328 /*bytesInIndex=*/0,
1329 copyData);
1330 }
static sk_sp< SkData > read_metadata(const SkJpegMarkerList &markerList, const uint32_t targetMarker, const uint8_t *signature, size_t signatureSize, size_t signaturePadding, size_t bytesInIndex, bool alwaysCopyData)
static constexpr uint32_t kExifMarker
constexpr uint8_t kExifSig[]

◆ getICCProfileData()

sk_sp< SkData > SkJpegMetadataDecoderImpl::getICCProfileData ( bool  copyData) const
inlineoverridevirtual

Return the ICC profile of the image if any, and nullptr otherwise. If |copyData| is false, then the returned SkData may directly reference the data provided when this object was created.

Implements SkJpegMetadataDecoder.

Definition at line 1332 of file SkJpegCodec.cpp.

1332 {
1333 return read_metadata(fMarkerList,
1334 kICCMarker,
1335 kICCSig,
1336 sizeof(kICCSig),
1337 /*signaturePadding=*/0,
1339 copyData);
1340 }
static constexpr uint8_t kICCSig[]
static constexpr uint32_t kICCMarker
static constexpr uint32_t kICCMarkerIndexSize

◆ mightHaveGainmapImage()

bool SkJpegMetadataDecoderImpl::mightHaveGainmapImage ( ) const
inlineoverridevirtual

Return true if there is a possibility that this image contains a gainmap image.

Implements SkJpegMetadataDecoder.

Definition at line 1342 of file SkJpegCodec.cpp.

1342 {
1343#ifdef SK_CODEC_DECODES_JPEG_GAINMAPS
1344 // All supported gainmap formats require MPF. Reject images that do not have MPF.
1345 return find_mp_params(fMarkerList, nullptr, nullptr) != nullptr;
1346#else
1347 return false;
1348#endif
1349 }

The documentation for this class was generated from the following file: