Flutter Engine
The Flutter Engine
Functions | Variables
GifTest.cpp File Reference
#include "include/codec/SkAndroidCodec.h"
#include "include/codec/SkCodec.h"
#include "include/core/SkBitmap.h"
#include "include/core/SkColor.h"
#include "include/core/SkColorType.h"
#include "include/core/SkData.h"
#include "include/core/SkImage.h"
#include "include/core/SkImageInfo.h"
#include "include/core/SkRect.h"
#include "include/core/SkRefCnt.h"
#include "include/core/SkStream.h"
#include "include/core/SkString.h"
#include "include/core/SkTypes.h"
#include "include/core/SkUnPreMultiply.h"
#include "tests/CodecPriv.h"
#include "tests/Test.h"
#include "tools/Resources.h"
#include <cstring>
#include <initializer_list>
#include <memory>
#include <utility>
#include <vector>

Go to the source code of this file.

Functions

static void test_gif_data_no_colormap (skiatest::Reporter *r, void *data, size_t size)
 
static void test_gif_data (skiatest::Reporter *r, void *data, size_t size)
 
static void test_gif_data_dims (skiatest::Reporter *r, void *data, size_t size, int width, int height)
 
static void test_interlaced_gif_data (skiatest::Reporter *r, void *data, size_t size)
 
static void test_gif_data_short (skiatest::Reporter *r, void *data, size_t size)
 
 DEF_TEST (Gif, reporter)
 
 DEF_TEST (Codec_GifInterlacedTruncated, r)
 
 DEF_TEST (Gif_Sampled, r)
 
 DEF_TEST (Codec_GifTruncated, r)
 
 DEF_TEST (Codec_GifTruncated2, r)
 
 DEF_TEST (Codec_GifTruncated3, r)
 
 DEF_TEST (Codec_gif_out_of_palette, r)
 
 DEF_TEST (Codec_AnimatedTransparentGif, r)
 
 DEF_TEST (Codec_xOffsetTooBig, r)
 

Variables

static unsigned char gGIFData []
 
static unsigned char gGIFDataNoColormap []
 
static unsigned char gInterlacedGIF []
 

Function Documentation

◆ DEF_TEST() [1/9]

DEF_TEST ( Codec_AnimatedTransparentGif  ,
 
)

Definition at line 466 of file GifTest.cpp.

466 {
467 const char* path = "images/gif-transparent-index.gif";
469 if (!data) {
470 ERRORF(r, "failed to find %s", path);
471 return;
472 }
473
474 auto codec = SkCodec::MakeFromData(std::move(data));
475 if (!codec) {
476 ERRORF(r, "Could not create codec from %s", path);
477 return;
478 }
479
480 SkImageInfo info = codec->getInfo();
481 if ((info.width() != 4) || (info.height() != 2) || (codec->getFrameInfo().size() != 2)) {
482 ERRORF(r, "Unexpected image info");
483 return;
484 }
485
486 for (bool use565 : { false, true }) {
487 SkBitmap bm;
488 bm.allocPixels(use565 ? info.makeColorType(kRGB_565_SkColorType) : info);
489
490 for (int i = 0; i < 2; i++) {
492 options.fFrameIndex = i;
493 options.fPriorFrame = (i > 0) ? (i - 1) : SkCodec::kNoFrame;
494 auto result = codec->getPixels(bm.pixmap(), &options);
495 REPORTER_ASSERT(r, result == SkCodec::kSuccess, "Failed to decode frame %i", i);
496
497 // Per above: the first frame is full of various red pixels.
498 SkColor expectedPixels[2][4] = {
499 { 0xFF800000, 0xFF900000, 0xFFA00000, 0xFFB00000 },
500 { 0xFFC00000, 0xFFD00000, 0xFFE00000, 0xFFF00000 },
501 };
502 if (use565) {
503 // For kRGB_565_SkColorType, copy the red channel's high 3 bits
504 // to its low 3 bits.
505 expectedPixels[0][0] = 0xFF840000;
506 expectedPixels[0][1] = 0xFF940000;
507 expectedPixels[0][2] = 0xFFA50000;
508 expectedPixels[0][3] = 0xFFB50000;
509 expectedPixels[1][0] = 0xFFC60000;
510 expectedPixels[1][1] = 0xFFD60000;
511 expectedPixels[1][2] = 0xFFE70000;
512 expectedPixels[1][3] = 0xFFF70000;
513 }
514 if (i > 0) {
515 // Per above: the second frame overlays a 3x1 rectangle at (1,
516 // 1): light blue, transparent, dark blue.
517 //
518 // Again, for kRGB_565_SkColorType, copy the blue channel's
519 // high 3 bits to its low 3 bits.
520 expectedPixels[1][1] = use565 ? 0xFF0000FF : 0xFF0000FF;
521 expectedPixels[1][3] = use565 ? 0xFF000052 : 0xFF000055;
522 }
523
524 for (int y = 0; y < 2; y++) {
525 for (int x = 0; x < 4; x++) {
526 auto expected = expectedPixels[y][x];
527 auto actual = bm.getColor(x, y);
528 REPORTER_ASSERT(r, actual == expected,
529 "use565 %i, frame %i, pixel (%i,%i) "
530 "mismatch! expected: %x actual: %x",
531 (int)use565, i, x, y, expected, actual);
532 }
533 }
534 }
535 }
536}
const char * options
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition: DM.cpp:213
sk_sp< SkData > GetResourceAsData(const char *resource)
Definition: Resources.cpp:42
@ kRGB_565_SkColorType
pixel with 5 bits red, 6 bits green, 5 bits blue, in 16-bit word
Definition: SkColorType.h:22
uint32_t SkColor
Definition: SkColor.h:37
#define REPORTER_ASSERT(r, cond,...)
Definition: Test.h:286
#define ERRORF(r,...)
Definition: Test.h:293
void allocPixels(const SkImageInfo &info, size_t rowBytes)
Definition: SkBitmap.cpp:258
SkColor getColor(int x, int y) const
Definition: SkBitmap.h:874
const SkPixmap & pixmap() const
Definition: SkBitmap.h:133
static std::unique_ptr< SkCodec > MakeFromData(sk_sp< SkData >, SkSpan< const SkCodecs::Decoder > decoders, SkPngChunkReader *=nullptr)
Definition: SkCodec.cpp:241
@ kSuccess
Definition: SkCodec.h:80
static constexpr int kNoFrame
Definition: SkCodec.h:650
GAsyncResult * result
double y
double x
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
Definition: switches.h:57
std::shared_ptr< const fml::Mapping > data
Definition: texture_gles.cc:63

◆ DEF_TEST() [2/9]

DEF_TEST ( Codec_gif_out_of_palette  ,
 
)

Definition at line 418 of file GifTest.cpp.

418 {
419 if (GetResourcePath().isEmpty()) {
420 return;
421 }
422
423 const char* path = "images/out-of-palette.gif";
425 if (!data) {
426 ERRORF(r, "failed to find %s", path);
427 return;
428 }
429
430 auto codec = SkCodec::MakeFromData(std::move(data));
431 if (!codec) {
432 ERRORF(r, "Could not create codec from %s", path);
433 return;
434 }
435
436 SkBitmap bm;
437 bm.allocPixels(codec->getInfo());
438 auto result = codec->getPixels(bm.pixmap());
439 REPORTER_ASSERT(r, result == SkCodec::kSuccess, "Failed to decode %s with error %s",
441
442 struct {
443 int x;
444 int y;
445 SkColor expected;
446 } pixels[] = {
447 { 0, 0, SK_ColorBLACK },
448 { 1, 0, SK_ColorWHITE },
449 { 0, 1, SK_ColorTRANSPARENT },
450 { 1, 1, SK_ColorTRANSPARENT },
451 };
452 for (auto& pixel : pixels) {
453 auto actual = bm.getColor(pixel.x, pixel.y);
454 REPORTER_ASSERT(r, actual == pixel.expected,
455 "pixel (%i,%i) mismatch! expected: %x actual: %x",
456 pixel.x, pixel.y, pixel.expected, actual);
457 }
458}
SkString GetResourcePath(const char *resource)
Definition: Resources.cpp:23
constexpr SkColor SK_ColorTRANSPARENT
Definition: SkColor.h:99
constexpr SkColor SK_ColorBLACK
Definition: SkColor.h:103
constexpr SkColor SK_ColorWHITE
Definition: SkColor.h:122
static const char * ResultToString(Result)
Definition: SkCodec.cpp:880

◆ DEF_TEST() [3/9]

DEF_TEST ( Codec_GifInterlacedTruncated  ,
 
)

Definition at line 213 of file GifTest.cpp.

213 {
214 // Check that gInterlacedGIF is exactly 102 bytes long, and that the final
215 // 30 bytes, in the half-open range [72, 102), consists of 0x1b (indicating
216 // a block of 27 bytes), then those 27 bytes, then 0x00 (end of the blocks)
217 // then 0x3b (end of the GIF).
218 if ((sizeof(gInterlacedGIF) != 102) ||
219 (gInterlacedGIF[72] != 0x1b) ||
220 (gInterlacedGIF[100] != 0x00) ||
221 (gInterlacedGIF[101] != 0x3b)) {
222 ERRORF(r, "Invalid gInterlacedGIF data");
223 return;
224 }
225
226 // We want to test the GIF codec's output on some (but not all) of the
227 // LZW-compressed data. As is, there is only one block of LZW-compressed
228 // data, 27 bytes long. Wuffs can output partial results from a partial
229 // block, but some other GIF implementations output intermediate rows only
230 // on block boundaries, so truncating to a prefix of gInterlacedGIF isn't
231 // enough. We also have to modify the block size down from 0x1b so that the
232 // edited version still contains a complete block. In this case, it's a
233 // block of 10 bytes.
234 unsigned char data[83];
235 memcpy(data, gInterlacedGIF, sizeof(data));
236 data[72] = sizeof(data) - 73;
237
238 // Just like test_interlaced_gif_data, check that we get a 9x9 image.
239 SkBitmap bm;
240 bool imageDecodeSuccess = decode_memory(data, sizeof(data), &bm);
241 REPORTER_ASSERT(r, imageDecodeSuccess);
242 REPORTER_ASSERT(r, bm.width() == 9);
243 REPORTER_ASSERT(r, bm.height() == 9);
244
245 // For an interlaced, non-transparent image, we thicken or replicate the
246 // rows of earlier interlace passes so that, when e.g. decoding a GIF
247 // sourced from a slow network connection, we show a richer intermediate
248 // image while waiting for the complete image. This replication is
249 // sometimes described as a "Haeberli inspired technique".
250 //
251 // For a 9 pixel high image, interlacing shuffles the row order to be: 0,
252 // 8, 4, 2, 6, 1, 3, 5, 7. Even though truncating to 10 bytes of
253 // LZW-compressed data only explicitly contains completed rows 0 and 8, we
254 // still expect row 7 to be set, due to replication, and therefore not
255 // transparent black (zero).
256 REPORTER_ASSERT(r, bm.getColor(0, 7) != 0);
257}
bool decode_memory(const void *mem, size_t size, SkBitmap *bm)
Definition: CodecPriv.h:21
static unsigned char gInterlacedGIF[]
Definition: GifTest.cpp:57
int width() const
Definition: SkBitmap.h:149
int height() const
Definition: SkBitmap.h:158

◆ DEF_TEST() [4/9]

DEF_TEST ( Codec_GifTruncated  ,
 
)

Definition at line 286 of file GifTest.cpp.

286 {
287 sk_sp<SkData> data(GetResourceAsData("images/test640x479.gif"));
288 if (!data) {
289 return;
290 }
291
292 // This is right before the header for the first image.
293 data = SkData::MakeSubset(data.get(), 0, 446);
294 std::unique_ptr<SkCodec> codec(SkCodec::MakeFromData(data));
295 REPORTER_ASSERT(r, !codec);
296}
static sk_sp< SkData > MakeSubset(const SkData *src, size_t offset, size_t length)
Definition: SkData.cpp:173

◆ DEF_TEST() [5/9]

DEF_TEST ( Codec_GifTruncated2  ,
 
)

Definition at line 323 of file GifTest.cpp.

323 {
324 // Truncate box.gif at 21, 22 and 23 bytes.
325 //
326 // See also Codec_GifTruncated3 in this file, below.
327 //
328 // See also Codec_trunc in CodecAnimTest.cpp for this magic 23.
329 //
330 // See also Codec_GifPreMap in CodecPartialTest.cpp for this magic 23.
331 for (int i = 21; i < 24; i++) {
332 sk_sp<SkData> data(GetResourceAsData("images/box.gif"));
333 if (!data) {
334 return;
335 }
336
337 data = SkData::MakeSubset(data.get(), 0, i);
338 std::unique_ptr<SkCodec> codec(SkCodec::MakeFromData(data));
339
340 if (i <= 21) {
341 if (codec) {
342 ERRORF(r, "Invalid data gave non-nullptr codec");
343 }
344 return;
345 }
346
347 if (!codec) {
348 ERRORF(r, "Failed to create codec with partial data (truncated at %d)", i);
349 return;
350 }
351
352 // The input is truncated in the Image Descriptor, before the local
353 // color table, and before (21) or after (22, 23) the first frame's
354 // XYWH (left / top / width / height) can be decoded. A detailed
355 // breakdown of those 23 bytes is in a comment above this function.
356 //
357 // At 21 bytes, the MakeFromStream factory method returns a nullptr
358 // SkCodec*, because creating a SkCodec requires knowing the image width
359 // and height (as its constructor takes an SkEncodedInfo argument), and
360 // specifically for GIF, decoding the image width and height requires
361 // decoding the first frame's XYWH, as per
362 // https://raw.githubusercontent.com/google/wuffs/master/test/data/artificial/gif-frame-out-of-bounds.gif.make-artificial.txt
363 //
364 // At 22 or 23 bytes, the first frame is complete enough that we can
365 // fill in all of a SkCodec::FrameInfo's fields (other than
366 // fFullyReceived). Specifically, we can fill in fRequiredFrame and
367 // fAlphaType, even though we haven't yet decoded the frame's RGB
368 // palette entries, as we do know the frame rectangle and that every
369 // palette entry is fully opaque, due to the lack of a Graphic Control
370 // Extension before the Image Descriptor.
371 REPORTER_ASSERT(r, codec->getFrameCount() == 1);
372 }
373}

◆ DEF_TEST() [6/9]

DEF_TEST ( Codec_GifTruncated3  ,
 
)

Definition at line 379 of file GifTest.cpp.

379 {
380 sk_sp<SkData> data(GetResourceAsData("images/box.gif"));
381 if (!data) {
382 return;
383 }
384
385 data = SkData::MakeSubset(data.get(), 0, 23);
387
388 if (!image) {
389 ERRORF(r, "Missing image");
390 return;
391 }
392
393 REPORTER_ASSERT(r, image->width() == 200);
394 REPORTER_ASSERT(r, image->height() == 55);
395
396 SkBitmap bm;
397 if (!bm.tryAllocPixels(SkImageInfo::MakeN32Premul(200, 55))) {
398 ERRORF(r, "Failed to allocate pixels");
399 return;
400 }
401
403 REPORTER_ASSERT(r, image->readPixels(nullptr,
404 bm.info(),
405 bm.getPixels(),
406 200 * 4,
407 0, 0));
408
409 for (int i = 0; i < image->width(); ++i)
410 for (int j = 0; j < image->height(); ++j) {
412 if (actual != SK_ColorTRANSPARENT) {
413 ERRORF(r, "did not initialize pixels! %i, %i is %x", i, j, actual);
414 }
415 }
416}
void * getPixels() const
Definition: SkBitmap.h:283
const SkImageInfo & info() const
Definition: SkBitmap.h:139
uint32_t * getAddr32(int x, int y) const
Definition: SkBitmap.h:1260
bool tryAllocPixels(const SkImageInfo &info, size_t rowBytes)
Definition: SkBitmap.cpp:271
void eraseColor(SkColor4f) const
Definition: SkBitmap.cpp:442
bool readPixels(GrDirectContext *context, const SkImageInfo &dstInfo, void *dstPixels, size_t dstRowBytes, int srcX, int srcY, CachingHint cachingHint=kAllow_CachingHint) const
Definition: SkImage.cpp:42
int width() const
Definition: SkImage.h:285
int height() const
Definition: SkImage.h:291
static SkColor PMColorToColor(SkPMColor c)
SK_API sk_sp< SkImage > DeferredFromEncodedData(sk_sp< SkData > encoded, std::optional< SkAlphaType > alphaType=std::nullopt)
sk_sp< const SkImage > image
Definition: SkRecords.h:269
static SkImageInfo MakeN32Premul(int width, int height)

◆ DEF_TEST() [7/9]

DEF_TEST ( Codec_xOffsetTooBig  ,
 
)

Definition at line 545 of file GifTest.cpp.

545 {
546 const char* path = "images/xOffsetTooBig.gif";
548 if (!data) {
549 ERRORF(r, "failed to find %s", path);
550 return;
551 }
552
553 auto codec = SkCodec::MakeFromData(std::move(data));
554 if (!codec) {
555 ERRORF(r, "Could not create codec from %s", path);
556 return;
557 }
558
559 REPORTER_ASSERT(r, codec->getFrameCount() == 2);
560
561 auto info = codec->getInfo();
562 REPORTER_ASSERT(r, info.width() == 100 && info.height() == 90);
563
564 SkBitmap bm;
565 bm.allocPixels(info);
566 for (int i = 0; i < 2; i++) {
567 SkCodec::FrameInfo frameInfo;
568 REPORTER_ASSERT(r, codec->getFrameInfo(i, &frameInfo));
569
570 SkIRect expectedRect = i == 0 ? SkIRect{0, 0, 100, 90} : SkIRect{100, 90, 100, 90};
571 REPORTER_ASSERT(r, expectedRect == frameInfo.fFrameRect);
572
574 options.fFrameIndex = i;
575 REPORTER_ASSERT(r, SkCodec::kSuccess == codec->getPixels(bm.pixmap(), &options));
576
577 REPORTER_ASSERT(r, bm.getColor(0, 0) == SK_ColorRED);
578 }
579}
constexpr SkColor SK_ColorRED
Definition: SkColor.h:126
SkIRect fFrameRect
Definition: SkCodec.h:717
Definition: SkRect.h:32

◆ DEF_TEST() [8/9]

DEF_TEST ( Gif  ,
reporter   
)

This test will test the ability of the SkCodec to deal with GIF files which have been mangled somehow. We want to display as much of the GIF as possible.

Definition at line 165 of file GifTest.cpp.

165 {
166 // test perfectly good images.
167 test_gif_data(reporter, static_cast<void *>(gGIFData), sizeof(gGIFData));
169 sizeof(gInterlacedGIF));
170
171 unsigned char badData[sizeof(gGIFData)];
172
173 memcpy(badData, gGIFData, sizeof(gGIFData));
174 badData[6] = 0x01; // image too wide
175 test_gif_data(reporter, static_cast<void *>(badData), sizeof(gGIFData));
176 // "libgif warning [image too wide, expanding output to size]"
177
178 memcpy(badData, gGIFData, sizeof(gGIFData));
179 badData[8] = 0x01; // image too tall
180 test_gif_data(reporter, static_cast<void *>(badData), sizeof(gGIFData));
181 // "libgif warning [image too tall, expanding output to size]"
182
183 memcpy(badData, gGIFData, sizeof(gGIFData));
184 badData[62] = 0x01; // image shifted right
185 test_gif_data_dims(reporter, static_cast<void *>(badData), sizeof(gGIFData), 4, 3);
186
187 memcpy(badData, gGIFData, sizeof(gGIFData));
188 badData[64] = 0x01; // image shifted down
189 test_gif_data_dims(reporter, static_cast<void *>(badData), sizeof(gGIFData), 3, 4);
190
191 memcpy(badData, gGIFData, sizeof(gGIFData));
192 badData[62] = 0xff; // image shifted right
193 badData[63] = 0xff;
194 test_gif_data_dims(reporter, static_cast<void *>(badData), sizeof(gGIFData), 3 + 0xFFFF, 3);
195
196 memcpy(badData, gGIFData, sizeof(gGIFData));
197 badData[64] = 0xff; // image shifted down
198 badData[65] = 0xff;
199 test_gif_data_dims(reporter, static_cast<void *>(badData), sizeof(gGIFData), 3, 3 + 0xFFFF);
200
202 sizeof(gGIFDataNoColormap));
203
204 // test short Gif. 80 is missing a few bytes.
205 test_gif_data_short(reporter, static_cast<void *>(gGIFData), 80);
206 // "libgif warning [DGifGetLine]"
207
209 100); // 100 is missing a few bytes
210 // "libgif warning [interlace DGifGetLine]"
211}
reporter
Definition: FontMgrTest.cpp:39
static unsigned char gGIFDataNoColormap[]
Definition: GifTest.cpp:42
static void test_gif_data_no_colormap(skiatest::Reporter *r, void *data, size_t size)
Definition: GifTest.cpp:68
static void test_interlaced_gif_data(skiatest::Reporter *r, void *data, size_t size)
Definition: GifTest.cpp:109
static void test_gif_data(skiatest::Reporter *r, void *data, size_t size)
Definition: GifTest.cpp:81
static unsigned char gGIFData[]
Definition: GifTest.cpp:32
static void test_gif_data_short(skiatest::Reporter *r, void *data, size_t size)
Definition: GifTest.cpp:141
static void test_gif_data_dims(skiatest::Reporter *r, void *data, size_t size, int width, int height)
Definition: GifTest.cpp:100

◆ DEF_TEST() [9/9]

DEF_TEST ( Gif_Sampled  ,
 
)

Definition at line 261 of file GifTest.cpp.

261 {
262 auto data = GetResourceAsData("images/test640x479.gif");
264 if (!data) {
265 return;
266 }
267 std::unique_ptr<SkStreamAsset> stream(new SkMemoryStream(std::move(data)));
268 std::unique_ptr<SkAndroidCodec> codec(SkAndroidCodec::MakeFromStream(std::move(stream)));
269 REPORTER_ASSERT(r, codec);
270 if (!codec) {
271 return;
272 }
273
275 options.fSampleSize = 4;
276
277 SkBitmap bm;
278 bm.allocPixels(codec->getInfo());
279 const SkCodec::Result result = codec->getAndroidPixels(codec->getInfo(), bm.getPixels(),
280 bm.rowBytes(), &options);
282}
static std::unique_ptr< SkAndroidCodec > MakeFromStream(std::unique_ptr< SkStream >, SkPngChunkReader *=nullptr)
size_t rowBytes() const
Definition: SkBitmap.h:238
Result
Definition: SkCodec.h:76

◆ test_gif_data()

static void test_gif_data ( skiatest::Reporter r,
void *  data,
size_t  size 
)
static

Definition at line 81 of file GifTest.cpp.

81 {
82 SkBitmap bm;
83 bool imageDecodeSuccess = decode_memory(data, size, &bm);
84 REPORTER_ASSERT(r, imageDecodeSuccess);
85 REPORTER_ASSERT(r, bm.width() == 3);
86 REPORTER_ASSERT(r, bm.height() == 3);
87 REPORTER_ASSERT(r, !(bm.empty()));
88 if (!(bm.empty())) {
89 REPORTER_ASSERT(r, bm.getColor(0, 0) == 0xffff0000);
90 REPORTER_ASSERT(r, bm.getColor(1, 0) == 0xffffff00);
91 REPORTER_ASSERT(r, bm.getColor(2, 0) == 0xff00ffff);
92 REPORTER_ASSERT(r, bm.getColor(0, 1) == 0xff808080);
93 REPORTER_ASSERT(r, bm.getColor(1, 1) == 0xff000000);
94 REPORTER_ASSERT(r, bm.getColor(2, 1) == 0xff00ff00);
95 REPORTER_ASSERT(r, bm.getColor(0, 2) == 0xffffffff);
96 REPORTER_ASSERT(r, bm.getColor(1, 2) == 0xffff00ff);
97 REPORTER_ASSERT(r, bm.getColor(2, 2) == 0xff0000ff);
98 }
99}
bool empty() const
Definition: SkBitmap.h:210
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

◆ test_gif_data_dims()

static void test_gif_data_dims ( skiatest::Reporter r,
void *  data,
size_t  size,
int  width,
int  height 
)
static

Definition at line 100 of file GifTest.cpp.

101 {
102 SkBitmap bm;
103 bool imageDecodeSuccess = decode_memory(data, size, &bm);
104 REPORTER_ASSERT(r, imageDecodeSuccess);
105 REPORTER_ASSERT(r, bm.width() == width);
106 REPORTER_ASSERT(r, bm.height() == height);
107 REPORTER_ASSERT(r, !(bm.empty()));
108}
int32_t height
int32_t width

◆ test_gif_data_no_colormap()

static void test_gif_data_no_colormap ( skiatest::Reporter r,
void *  data,
size_t  size 
)
static

Definition at line 68 of file GifTest.cpp.

70 {
71 SkBitmap bm;
72 bool imageDecodeSuccess = decode_memory(data, size, &bm);
73 REPORTER_ASSERT(r, imageDecodeSuccess);
74 REPORTER_ASSERT(r, bm.width() == 1);
75 REPORTER_ASSERT(r, bm.height() == 1);
76 REPORTER_ASSERT(r, !(bm.empty()));
77 if (!(bm.empty())) {
78 REPORTER_ASSERT(r, bm.getColor(0, 0) == 0x00000000);
79 }
80}

◆ test_gif_data_short()

static void test_gif_data_short ( skiatest::Reporter r,
void *  data,
size_t  size 
)
static

Definition at line 141 of file GifTest.cpp.

143 {
144 SkBitmap bm;
145 bool imageDecodeSuccess = decode_memory(data, size, &bm);
146 REPORTER_ASSERT(r, imageDecodeSuccess);
147 REPORTER_ASSERT(r, bm.width() == 3);
148 REPORTER_ASSERT(r, bm.height() == 3);
149 REPORTER_ASSERT(r, !(bm.empty()));
150 if (!(bm.empty())) {
151 REPORTER_ASSERT(r, bm.getColor(0, 0) == 0xffff0000);
152 REPORTER_ASSERT(r, bm.getColor(1, 0) == 0xffffff00);
153 REPORTER_ASSERT(r, bm.getColor(2, 0) == 0xff00ffff);
154 REPORTER_ASSERT(r, bm.getColor(0, 1) == 0xff808080);
155 REPORTER_ASSERT(r, bm.getColor(1, 1) == 0xff000000);
156 REPORTER_ASSERT(r, bm.getColor(2, 1) == 0xff00ff00);
157 }
158}

◆ test_interlaced_gif_data()

static void test_interlaced_gif_data ( skiatest::Reporter r,
void *  data,
size_t  size 
)
static

Definition at line 109 of file GifTest.cpp.

111 {
112 SkBitmap bm;
113 bool imageDecodeSuccess = decode_memory(data, size, &bm);
114 REPORTER_ASSERT(r, imageDecodeSuccess);
115 REPORTER_ASSERT(r, bm.width() == 9);
116 REPORTER_ASSERT(r, bm.height() == 9);
117 REPORTER_ASSERT(r, !(bm.empty()));
118 if (!(bm.empty())) {
119 REPORTER_ASSERT(r, bm.getColor(0, 0) == 0xffff0000);
120 REPORTER_ASSERT(r, bm.getColor(1, 0) == 0xffffff00);
121 REPORTER_ASSERT(r, bm.getColor(2, 0) == 0xff00ffff);
122
123 REPORTER_ASSERT(r, bm.getColor(0, 2) == 0xffffffff);
124 REPORTER_ASSERT(r, bm.getColor(1, 2) == 0xffff00ff);
125 REPORTER_ASSERT(r, bm.getColor(2, 2) == 0xff0000ff);
126
127 REPORTER_ASSERT(r, bm.getColor(0, 4) == 0xff808080);
128 REPORTER_ASSERT(r, bm.getColor(1, 4) == 0xff000000);
129 REPORTER_ASSERT(r, bm.getColor(2, 4) == 0xff00ff00);
130
131 REPORTER_ASSERT(r, bm.getColor(0, 6) == 0xffff0000);
132 REPORTER_ASSERT(r, bm.getColor(1, 6) == 0xffffff00);
133 REPORTER_ASSERT(r, bm.getColor(2, 6) == 0xff00ffff);
134
135 REPORTER_ASSERT(r, bm.getColor(0, 8) == 0xffffffff);
136 REPORTER_ASSERT(r, bm.getColor(1, 8) == 0xffff00ff);
137 REPORTER_ASSERT(r, bm.getColor(2, 8) == 0xff0000ff);
138 }
139}

Variable Documentation

◆ gGIFData

unsigned char gGIFData[]
static
Initial value:
= {
0x47, 0x49, 0x46, 0x38, 0x37, 0x61, 0x03, 0x00, 0x03, 0x00, 0xe3, 0x08,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0x00,
0xff, 0x80, 0x80, 0x80, 0x00, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0x2c, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x00, 0x04,
0x07, 0x50, 0x1c, 0x43, 0x40, 0x41, 0x23, 0x44, 0x00, 0x3b
}

Definition at line 32 of file GifTest.cpp.

◆ gGIFDataNoColormap

unsigned char gGIFDataNoColormap[]
static
Initial value:
= {
0x47, 0x49, 0x46, 0x38, 0x39, 0x61,
0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
0x21, 0xf9, 0x04, 0x01, 0x0a, 0x00, 0x01, 0x00,
0x2c, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00,
0x02, 0x02, 0x4c, 0x01, 0x00,
0x3b
}

Definition at line 42 of file GifTest.cpp.

◆ gInterlacedGIF

unsigned char gInterlacedGIF[]
static
Initial value:
= {
0x47, 0x49, 0x46, 0x38, 0x37, 0x61, 0x09, 0x00, 0x09, 0x00, 0xe3, 0x08, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0x00, 0xff, 0x80,
0x80, 0x80, 0x00, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x2c, 0x00, 0x00, 0x00,
0x00, 0x09, 0x00, 0x09, 0x00, 0x40, 0x04, 0x1b, 0x50, 0x1c, 0x23, 0xe9, 0x44,
0x23, 0x60, 0x9d, 0x09, 0x28, 0x1e, 0xf8, 0x6d, 0x64, 0x56, 0x9d, 0x53, 0xa8,
0x7e, 0xa8, 0x65, 0x94, 0x5c, 0xb0, 0x8a, 0x45, 0x04, 0x00, 0x3b
}

Definition at line 57 of file GifTest.cpp.