Flutter Engine
The Flutter Engine
third_party
skia
tests
BRDTest.cpp
Go to the documentation of this file.
1
/*
2
* Copyright 2020 Google LLC
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
// Make sure SkUserConfig.h is included so #defines are available on
9
// Android.
10
#include "
include/core/SkTypes.h
"
11
#ifdef SK_ENABLE_ANDROID_UTILS
12
#include "
client_utils/android/BitmapRegionDecoder.h
"
13
#include "
include/codec/SkAndroidCodec.h
"
14
#include "
include/codec/SkCodec.h
"
15
#include "
tests/Test.h
"
16
#include "
tools/Resources.h
"
17
18
DEF_TEST
(BRD_types, r) {
19
static
const
struct
{
20
const
char
*
name
;
21
bool
supported;
22
}
gRec
[] = {
23
{
"images/arrow.png"
,
true
},
24
{
"images/box.gif"
,
false
},
25
{
"images/baby_tux.webp"
,
true
},
26
{
"images/brickwork-texture.jpg"
,
true
},
27
{
"images/color_wheel.ico"
,
false
},
28
#ifdef SK_CODEC_DECODES_RAW
29
{
"images/sample_1mp.dng"
,
false
},
30
#endif
31
{
"images/mandrill.wbmp"
,
false
},
32
{
"images/randPixels.bmp"
,
false
},
33
};
34
35
for
(
const
auto
& rec :
gRec
) {
36
auto
data
=
GetResourceAsData
(rec.name);
37
if
(!
data
)
return
;
38
39
REPORTER_ASSERT
(r,
SkCodec::MakeFromData
(
data
) !=
nullptr
);
40
REPORTER_ASSERT
(r,
SkAndroidCodec::MakeFromData
(
data
) !=
nullptr
);
41
42
auto
brd =
android::skia::BitmapRegionDecoder::Make
(
data
);
43
if
(rec.supported) {
44
if
(!brd)
ERRORF
(r,
"Failed to create BRD from %s"
, rec.name);
45
}
else
{
46
if
(brd)
ERRORF
(r,
"Should *not* create BRD from %s"
, rec.name);
47
}
48
}
49
}
50
#endif
// SK_ENABLE_ANDROID_UTILS
BitmapRegionDecoder.h
gRec
static const struct @223 gRec[]
GetResourceAsData
sk_sp< SkData > GetResourceAsData(const char *resource)
Definition:
Resources.cpp:42
Resources.h
SkAndroidCodec.h
SkCodec.h
SkTypes.h
Test.h
DEF_TEST
#define DEF_TEST(name, reporter)
Definition:
Test.h:312
REPORTER_ASSERT
#define REPORTER_ASSERT(r, cond,...)
Definition:
Test.h:286
ERRORF
#define ERRORF(r,...)
Definition:
Test.h:293
SkAndroidCodec::MakeFromData
static std::unique_ptr< SkAndroidCodec > MakeFromData(sk_sp< SkData >, SkPngChunkReader *=nullptr)
Definition:
SkAndroidCodec.cpp:250
SkCodec::MakeFromData
static std::unique_ptr< SkCodec > MakeFromData(sk_sp< SkData >, SkSpan< const SkCodecs::Decoder > decoders, SkPngChunkReader *=nullptr)
Definition:
SkCodec.cpp:241
android::skia::BitmapRegionDecoder::Make
static std::unique_ptr< BitmapRegionDecoder > Make(sk_sp< SkData > data)
Definition:
BitmapRegionDecoder.cpp:17
flutter::name
DEF_SWITCHES_START aot vmservice shared library name
Definition:
switches.h:32
data
std::shared_ptr< const fml::Mapping > data
Definition:
texture_gles.cc:63
Generated on Sun Jun 23 2024 21:56:37 for Flutter Engine by
1.9.4