Flutter Engine
The Flutter Engine
third_party
skia
src
codec
SkJpegxlCodec.h
Go to the documentation of this file.
1
/*
2
* Copyright 2021 Google Inc.
3
*
4
* Use of this source code is governed by a BSD-style license that can be
5
* found in the LICENSE file.
6
*/
7
8
#ifndef SkJpegxlCodec_DEFINED
9
#define SkJpegxlCodec_DEFINED
10
11
#include "
include/codec/SkEncodedImageFormat.h
"
12
#include "
include/core/SkData.h
"
13
#include "
include/core/SkRefCnt.h
"
14
#include "
src/codec/SkScalingCodec.h
"
15
16
#include <cstddef>
17
#include <memory>
18
19
class
SkCodec
;
20
class
SkFrameHolder
;
21
class
SkJpegxlCodecPriv
;
22
class
SkStream
;
23
struct
SkEncodedInfo
;
24
struct
SkImageInfo
;
25
26
/*
27
*
28
* This class implements the decoding for jpegxl images
29
*
30
*/
31
class
SkJpegxlCodec
:
public
SkScalingCodec
{
32
public
:
33
static
bool
IsJpegxl
(
const
void
*,
size_t
);
34
35
/*
36
* Assumes IsJpegxl was called and returned true
37
* Takes ownership of the stream
38
*/
39
static
std::unique_ptr<SkCodec>
MakeFromStream
(std::unique_ptr<SkStream>,
Result
*);
40
41
protected
:
42
/* TODO(eustas): implement when downscaling is supported. */
43
/* SkISize onGetScaledDimensions(float desiredScale) const override; */
44
45
/* TODO(eustas): implement when up-/down-scaling is supported. */
46
/* bool onDimensionsSupported(const SkISize&) override; */
47
48
SkEncodedImageFormat
onGetEncodedFormat
()
const override
{
49
return
SkEncodedImageFormat::kJPEGXL
;
50
}
51
52
Result
onGetPixels
(
const
SkImageInfo
&
dstInfo
,
void
*
dst
,
size_t
rowBytes,
53
const
Options&
options
,
int
* rowsDecodedPtr)
override
;
54
55
/* TODO(eustas): add support for transcoded JPEG images? */
56
/* bool onQueryYUVAInfo(const SkYUVAPixmapInfo::SupportedDataTypes&,
57
SkYUVAPixmapInfo*) const override; */
58
59
/* TODO(eustas): add support for transcoded JPEG images? */
60
/* Result onGetYUVAPlanes(const SkYUVAPixmaps& yuvaPixmaps) override; */
61
62
/* TODO(eustas): implement when cropped output is supported. */
63
/* bool onGetValidSubset(SkIRect* desiredSubset) const override; */
64
65
bool
onRewind
()
override
;
66
67
/* TODO(eustas): top-down by default; do we need something else? */
68
/* SkScanlineOrder onGetScanlineOrder() const override; */
69
/* int onOutputScanline(int inputScanline) const override; */
70
71
bool
conversionSupported
(
const
SkImageInfo
&,
bool
,
bool
)
override
;
72
73
int
onGetFrameCount
()
override
;
74
75
bool
onGetFrameInfo
(
int
, FrameInfo*)
const override
;
76
77
int
onGetRepetitionCount
()
override
;
78
79
private
:
80
const
SkFrameHolder
* getFrameHolder()
const override
;
81
82
// Result onStartScanlineDecode(
83
// const SkImageInfo& /*dstInfo*/, const Options& /*options*/) override;
84
// Result onStartIncrementalDecode(
85
// const SkImageInfo& /*dstInfo*/, void*, size_t, const Options&) override;
86
// Result onIncrementalDecode(int*) override;
87
// bool onSkipScanlines(int /*countLines*/) override;
88
// int onGetScanlines(void* /*dst*/, int /*countLines*/, size_t /*rowBytes*/) override;
89
// SkSampler* getSampler(bool /*createIfNecessary*/) override;
90
91
// Opaque codec implementation for lightweight header file.
92
std::unique_ptr<SkJpegxlCodecPriv> fCodec;
93
sk_sp<SkData>
fData;
94
95
bool
scanFrames();
96
static
void
imageOutCallback(
97
void
* opaque,
size_t
x
,
size_t
y
,
size_t
num_pixels,
const
void
* pixels);
98
99
SkJpegxlCodec
(std::unique_ptr<SkJpegxlCodecPriv> codec,
100
SkEncodedInfo
&&
info
,
101
std::unique_ptr<SkStream>
stream
,
102
sk_sp<SkData>
data
);
103
104
using
INHERITED =
SkScalingCodec
;
105
};
106
107
#endif
info
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition:
DM.cpp:213
SkData.h
SkEncodedImageFormat.h
SkEncodedImageFormat
SkEncodedImageFormat
Definition:
SkEncodedImageFormat.h:16
SkEncodedImageFormat::kJPEGXL
@ kJPEGXL
SkRefCnt.h
SkScalingCodec.h
SkCodec
Definition:
SkCodec.h:58
SkCodec::dstInfo
const SkImageInfo & dstInfo() const
Definition:
SkCodec.h:878
SkCodec::stream
SkStream * stream()
Definition:
SkCodec.h:865
SkCodec::Result
Result
Definition:
SkCodec.h:76
SkCodec::options
const Options & options() const
Definition:
SkCodec.h:880
SkFrameHolder
Definition:
SkFrameHolder.h:169
SkJpegxlCodecPriv
Definition:
SkJpegxlCodec.cpp:58
SkJpegxlCodec
Definition:
SkJpegxlCodec.h:31
SkJpegxlCodec::onGetPixels
Result onGetPixels(const SkImageInfo &dstInfo, void *dst, size_t rowBytes, const Options &options, int *rowsDecodedPtr) override
Definition:
SkJpegxlCodec.cpp:199
SkJpegxlCodec::onGetRepetitionCount
int onGetRepetitionCount() override
Definition:
SkJpegxlCodec.cpp:426
SkJpegxlCodec::onGetFrameCount
int onGetFrameCount() override
Definition:
SkJpegxlCodec.cpp:403
SkJpegxlCodec::conversionSupported
bool conversionSupported(const SkImageInfo &, bool, bool) override
Definition:
SkJpegxlCodec.cpp:296
SkJpegxlCodec::onGetFrameInfo
bool onGetFrameInfo(int, FrameInfo *) const override
Definition:
SkJpegxlCodec.cpp:415
SkJpegxlCodec::IsJpegxl
static bool IsJpegxl(const void *, size_t)
Definition:
SkJpegxlCodec.cpp:53
SkJpegxlCodec::MakeFromStream
static std::unique_ptr< SkCodec > MakeFromStream(std::unique_ptr< SkStream >, Result *)
Definition:
SkJpegxlCodec.cpp:86
SkJpegxlCodec::onGetEncodedFormat
SkEncodedImageFormat onGetEncodedFormat() const override
Definition:
SkJpegxlCodec.h:48
SkJpegxlCodec::onRewind
bool onRewind() override
Definition:
SkJpegxlCodec.cpp:291
SkScalingCodec
Definition:
SkScalingCodec.h:22
SkScalingCodec::SkScalingCodec
SkScalingCodec(SkEncodedInfo &&info, XformFormat srcFormat, std::unique_ptr< SkStream > stream, SkEncodedOrigin origin=kTopLeft_SkEncodedOrigin)
Definition:
SkScalingCodec.h:24
SkStream
Definition:
SkStream.h:29
sk_sp< SkData >
y
double y
Definition:
mouse-input-test.cc:83
x
double x
Definition:
mouse-input-test.cc:82
gn.cp.dst
dst
Definition:
cp.py:12
SkEncodedInfo
Definition:
SkEncodedInfo.h:25
SkImageInfo
Definition:
SkImageInfo.h:208
data
std::shared_ptr< const fml::Mapping > data
Definition:
texture_gles.cc:63
Generated on Sun Jun 23 2024 21:56:10 for Flutter Engine by
1.9.4