Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
SkJpegSegmentScanner Class Reference

#include <SkJpegSegmentScan.h>

Public Member Functions

 SkJpegSegmentScanner (uint8_t stopMarker=kJpegMarkerEndOfImage)
 
bool isDone () const
 
bool hadError () const
 
void onBytes (const void *data, size_t size)
 
const std::vector< SkJpegSegment > & getSegments () const
 

Static Public Member Functions

static sk_sp< SkDataGetParameters (const SkData *scannedData, const SkJpegSegment &segment)
 

Detailed Description

Definition at line 39 of file SkJpegSegmentScan.h.

Constructor & Destructor Documentation

◆ SkJpegSegmentScanner()

SkJpegSegmentScanner::SkJpegSegmentScanner ( uint8_t  stopMarker = kJpegMarkerEndOfImage)

Definition at line 22 of file SkJpegSegmentScan.cpp.

22: fStopMarker(stopMarker) {}

Member Function Documentation

◆ GetParameters()

sk_sp< SkData > SkJpegSegmentScanner::GetParameters ( const SkData scannedData,
const SkJpegSegment segment 
)
static

Definition at line 26 of file SkJpegSegmentScan.cpp.

27 {
28 return SkData::MakeSubset(
29 scannedData,
32}
static constexpr size_t kJpegSegmentParameterLengthSize
static constexpr size_t kJpegMarkerCodeSize
static sk_sp< SkData > MakeSubset(const SkData *src, size_t offset, size_t length)
Definition SkData.cpp:173
uint16_t parameterLength

◆ getSegments()

const std::vector< SkJpegSegment > & SkJpegSegmentScanner::getSegments ( ) const

Definition at line 24 of file SkJpegSegmentScan.cpp.

24{ return fSegments; }

◆ hadError()

bool SkJpegSegmentScanner::hadError ( ) const
inline

Definition at line 44 of file SkJpegSegmentScan.h.

44{ return fState == State::kError; }

◆ isDone()

bool SkJpegSegmentScanner::isDone ( ) const
inline

Definition at line 43 of file SkJpegSegmentScan.h.

43{ return fState == State::kDone; }

◆ onBytes()

void SkJpegSegmentScanner::onBytes ( const void *  data,
size_t  size 
)

Definition at line 34 of file SkJpegSegmentScan.cpp.

34 {
35 const uint8_t* bytes = reinterpret_cast<const uint8_t*>(data);
36 size_t bytesRemaining = size;
37
38 while (bytesRemaining > 0) {
39 // Process the data byte-by-byte, unless we are in kSegmentParam or kEntropyCodedData, in
40 // which case, perform some optimizations to avoid examining every byte.
41 size_t bytesToMoveForward = 0;
42 switch (fState) {
43 case State::kSegmentParam: {
44 // Skip forward through payloads.
45 SkASSERT(fSegmentParamBytesRemaining > 0);
46 bytesToMoveForward = std::min(fSegmentParamBytesRemaining, bytesRemaining);
47 fSegmentParamBytesRemaining -= bytesToMoveForward;
48 if (fSegmentParamBytesRemaining == 0) {
49 fState = State::kEntropyCodedData;
50 }
51 break;
52 }
53 case State::kEntropyCodedData: {
54 // Skip through entropy-coded data, only looking at sentinel characters.
55 const uint8_t* sentinel =
56 reinterpret_cast<const uint8_t*>(memchr(bytes, 0xFF, bytesRemaining));
57 if (sentinel) {
58 bytesToMoveForward = (sentinel - bytes) + 1;
59 fState = State::kEntropyCodedDataSentinel;
60 } else {
61 bytesToMoveForward = bytesRemaining;
62 }
63 break;
64 }
65 case State::kDone:
66 // Skip all data after we have hit our stop marker.
67 bytesToMoveForward = bytesRemaining;
68 break;
69 default: {
70 onByte(*bytes);
71 bytesToMoveForward = 1;
72 break;
73 }
74 }
75 SkASSERT(bytesToMoveForward > 0);
76 fOffset += bytesToMoveForward;
77 bytes += bytesToMoveForward;
78 bytesRemaining -= bytesToMoveForward;
79 }
80}
#define SkASSERT(cond)
Definition SkAssert.h:116
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot data
Definition switches.h:41
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition switches.h:259

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