Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
third_party
skia
src
codec
SkJpegPriv.h
Go to the documentation of this file.
1
/*
2
* Copyright 2017 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
9
#ifndef SkJpegPriv_DEFINED
10
#define SkJpegPriv_DEFINED
11
12
#include "
include/codec/SkEncodedOrigin.h
"
13
#include "
include/core/SkStream.h
"
14
#include "
include/private/base/SkTArray.h
"
15
16
#include <setjmp.h>
17
// stdio is needed for jpeglib
18
#include <
stdio.h
>
19
20
extern
"C"
{
21
#include "jpeglib.h"
// NO_G3_REWRITE
22
#include "jerror.h"
// NO_G3_REWRITE
23
}
24
25
/*
26
* Error handling struct
27
*/
28
struct
skjpeg_error_mgr
: jpeg_error_mgr {
29
class
AutoPushJmpBuf
{
30
public
:
31
AutoPushJmpBuf
(
skjpeg_error_mgr
* mgr) : fMgr(mgr) { fMgr->
push
(&fJmpBuf); }
32
~AutoPushJmpBuf
() { fMgr->
pop
(&fJmpBuf); }
33
operator
jmp_buf&() {
return
fJmpBuf; }
34
35
private
:
36
skjpeg_error_mgr
*
const
fMgr;
37
jmp_buf fJmpBuf;
38
};
39
40
void
push
(jmp_buf* j) {
41
SkASSERT
(
fStack
[3] ==
nullptr
);
// if we assert here, the stack has overflowed
42
fStack
[3] =
fStack
[2];
43
fStack
[2] =
fStack
[1];
44
fStack
[1] =
fStack
[0];
45
fStack
[0] = j;
46
}
47
48
void
pop
(jmp_buf* j) {
49
SkASSERT
(
fStack
[0] == j);
// if we assert here, the pushes and pops were unbalanced
50
fStack
[0] =
fStack
[1];
51
fStack
[1] =
fStack
[2];
52
fStack
[2] =
fStack
[3];
53
fStack
[3] =
nullptr
;
54
}
55
56
jmp_buf*
fStack
[4] = {};
57
};
58
59
#endif
SkASSERT
#define SkASSERT(cond)
Definition
SkAssert.h:116
SkEncodedOrigin.h
SkStream.h
SkTArray.h
skjpeg_error_mgr::AutoPushJmpBuf
Definition
SkJpegPriv.h:29
skjpeg_error_mgr::AutoPushJmpBuf::AutoPushJmpBuf
AutoPushJmpBuf(skjpeg_error_mgr *mgr)
Definition
SkJpegPriv.h:31
skjpeg_error_mgr::AutoPushJmpBuf::~AutoPushJmpBuf
~AutoPushJmpBuf()
Definition
SkJpegPriv.h:32
stdio.h
skjpeg_error_mgr
Definition
SkJpegPriv.h:28
skjpeg_error_mgr::push
void push(jmp_buf *j)
Definition
SkJpegPriv.h:40
skjpeg_error_mgr::pop
void pop(jmp_buf *j)
Definition
SkJpegPriv.h:48
skjpeg_error_mgr::fStack
jmp_buf * fStack[4]
Definition
SkJpegPriv.h:56
Generated on Fri Apr 26 2024 06:16:33 for Flutter Engine by
1.9.8