Lines Matching +full:image +full:- +full:based
4 * Use of this source code is governed by a BSD-style license that can be
110 REPORTER_ASSERT(r, codec->getFrameCount() == 1); in AssertSingleGreenFrame()
111 REPORTER_ASSERT(r, codec->getRepetitionCount() == 0); in AssertSingleGreenFrame()
114 REPORTER_ASSERT(r, codec->getFrameInfo(0, &info)); in AssertSingleGreenFrame()
120 auto [image, result] = codec->getImage(); in AssertSingleGreenFrame()
123 REPORTER_ASSERT(r, image); in AssertSingleGreenFrame()
125 image->width() == expectedWidth, in AssertSingleGreenFrame()
127 image->width(), in AssertSingleGreenFrame()
130 image->height() == expectedHeight, in AssertSingleGreenFrame()
132 image->height(), in AssertSingleGreenFrame()
136 REPORTER_ASSERT(r, image->peekPixels(&pixmap)); in AssertSingleGreenFrame()
143 int frameCount = codec->getFrameCount(); in DecodeLastFrame()
144 sk_sp<SkImage> image; in DecodeLastFrame() local
148 REPORTER_ASSERT(r, codec->getFrameInfo(i, &info)); in DecodeLastFrame()
153 if (!image) { in DecodeLastFrame()
154 std::tie(image, result) = codec->getImage(); in DecodeLastFrame()
161 REPORTER_ASSERT(r, image->peekPixels(&pixmap)); in DecodeLastFrame()
167 options.fPriorFrame = i - 1; in DecodeLastFrame()
169 result = codec->getPixels(pixmap, &options); in DecodeLastFrame()
177 return image; in DecodeLastFrame()
197 int actualRepetitionCount = codec->getRepetitionCount(); in AssertAnimationRepetitionCount()
205 // Test based on
206 // https://philip.html5.org/tests/apng/tests.html#trivial-static-image
208 AssertSingleGreenFrame(r, 128, 64, "images/apng-test-suite--basic--trivial-static-image.png"); in DEF_TEST()
211 // Test based on
212 …https://philip.html5.org/tests/apng/tests.html#trivial-animated-image-one-frame-using-default-image
214 AssertSingleGreenFrame(r, 128, 64, "images/apng-test-suite--basic--using-default-image.png"); in DEF_TEST()
217 // Test based on
218 …tps://philip.html5.org/tests/apng/tests.html#trivial-animated-image-one-frame-ignoring-default-ima…
222 // the IDAT chunk is *not* part of the animation (i.e. APNG-aware decoders
224 // with non-APNG-aware decoders (e.g. with `SkPngCodec`), because the `IDAT`
225 // chunk represents a red image (the `fdAT` chunk represents a green image).
227 AssertSingleGreenFrame(r, 128, 64, "images/apng-test-suite--basic--ignoring-default-image.png"); in DEF_TEST()
230 // Test based on
231 // https://philip.html5.org/tests/apng/tests.html#apng-dispose-op-none-basic
236 // the complete image resource is available (i.e. a lower frame count should
244 // `SkCodecAnimation::Blend` - without this the final frame in this test will
248 SkPngRustDecoderDecode(r, "images/apng-test-suite--dispose-ops--none-basic.png"); in DEF_TEST()
253 REPORTER_ASSERT(r, codec->getFrameCount() == 3); in DEF_TEST()
254 REPORTER_ASSERT(r, codec->getRepetitionCount() == 0); in DEF_TEST()
258 REPORTER_ASSERT(r, codec->getFrameInfo(0, &info[0])); in DEF_TEST()
259 REPORTER_ASSERT(r, codec->getFrameInfo(1, &info[1])); in DEF_TEST()
260 REPORTER_ASSERT(r, codec->getFrameInfo(2, &info[2])); in DEF_TEST()
270 // Spot-check frame metadata. in DEF_TEST()
280 auto [image, result] = codec->getImage(); in DEF_TEST()
282 REPORTER_ASSERT(r, image); in DEF_TEST()
283 REPORTER_ASSERT(r, image->width() == 128, "width %d != 128", image->width()); in DEF_TEST()
284 REPORTER_ASSERT(r, image->height() == 64, "height %d != 64", image->height()); in DEF_TEST()
286 REPORTER_ASSERT(r, image->peekPixels(&pixmap)); in DEF_TEST()
295 REPORTER_ASSERT_SUCCESSFUL_CODEC_RESULT(r, codec->getPixels(pixmap, &options)); in DEF_TEST()
301 REPORTER_ASSERT_SUCCESSFUL_CODEC_RESULT(r, codec->getPixels(pixmap, &options)); in DEF_TEST()
311 // frame - no longer positioned correctly for decoding the 1st frame.
314 const char* path = "images/apng-test-suite--dispose-ops--none-basic.png"; in DEF_TEST()
320 size_t fullLength = data->size(); in DEF_TEST()
322 // Initially expose roughly middle of `IDAT` chunk (in this image `fcTL` is in DEF_TEST()
324 // the animated image). in DEF_TEST()
337 if (!bitmap.tryAllocN32Pixels(codec->dimensions().width(), codec->dimensions().height())) { in DEF_TEST()
342 // Try to provoke the codec to consume the currently-available part of the in DEF_TEST()
346 int frameCount = codec->getFrameCount(); in DEF_TEST()
350 retainedStream->addNewData(fullLength); in DEF_TEST()
353 sk_sp<SkImage> image; in DEF_TEST() local
354 std::tie(image, result) = codec->getImage(); in DEF_TEST()
356 REPORTER_ASSERT(r, image); in DEF_TEST()
357 REPORTER_ASSERT(r, image->width() == 128, "width %d != 128", image->width()); in DEF_TEST()
358 REPORTER_ASSERT(r, image->height() == 64, "height %d != 64", image->height()); in DEF_TEST()
360 REPORTER_ASSERT(r, image->peekPixels(&pixmap)); in DEF_TEST()
371 const char* path = "images/apng-test-suite--dispose-ops--none-basic.png"; in DEF_TEST()
377 size_t fullLength = data->size(); in DEF_TEST()
391 if (!bitmap.tryAllocN32Pixels(codec->dimensions().width(), codec->dimensions().height())) { in DEF_TEST()
398 // by the codec during a partially-successful `incrementalDecode`. in DEF_TEST()
407 // Decode partially-available, incomplete image. in DEF_TEST()
413 result = codec->startIncrementalDecode(bitmap.pixmap().info(), in DEF_TEST()
418 int rowsDecoded = -1; in DEF_TEST()
419 result = codec->incrementalDecode(&rowsDecoded); in DEF_TEST()
428 retainedStream->addNewData(fullLength); in DEF_TEST()
437 int frameCount = codec->getFrameCount(); in DEF_TEST()
441 rowsDecoded = -1; in DEF_TEST()
442 result = codec->incrementalDecode(&rowsDecoded); in DEF_TEST()
444 REPORTER_ASSERT(r, rowsDecoded == -1); // Not set when `kSuccess`. in DEF_TEST()
451 // Test based on
452 // https://philip.html5.org/tests/apng/tests.html#apng-blend-op-source-on-solid-colour
455 SkPngRustDecoderDecode(r, "images/apng-test-suite--blend-ops--source-on-solid.png"); in DEF_TEST()
459 sk_sp<SkImage> image = DecodeLastFrame(r, codec.get()); in DEF_TEST() local
460 if (!image) { in DEF_TEST()
465 REPORTER_ASSERT(r, image->peekPixels(&pixmap)); in DEF_TEST()
469 REPORTER_ASSERT(r, codec->getFrameInfo(1, &info)); in DEF_TEST()
474 // Test based on
475 // https://philip.html5.org/tests/apng/tests.html#apng-blend-op-source-on-nearly-transparent-colour
477 sk_sp<SkImage> image = DecodeLastFrame( in DEF_TEST() local
478 r, "images/apng-test-suite--blend-ops--source-on-nearly-transparent.png"); in DEF_TEST()
479 if (!image) { in DEF_TEST()
484 REPORTER_ASSERT(r, image->peekPixels(&pixmap)); in DEF_TEST()
493 // Test based on
494 // https://philip.html5.org/tests/apng/tests.html#apng-blend-op-over-on-solid-and-transparent-colou…
496 sk_sp<SkImage> image = DecodeLastFrame( in DEF_TEST() local
497 r, "images/apng-test-suite--blend-ops--over-on-solid-and-transparent.png"); in DEF_TEST()
498 if (!image) { in DEF_TEST()
503 REPORTER_ASSERT(r, image->peekPixels(&pixmap)); in DEF_TEST()
507 // Test based on
508 …https://philip.html5.org/tests/apng/tests.html#apng-blend-op-over-repeatedly-with-nearly-transpare…
510 sk_sp<SkImage> image = in DEF_TEST() local
511 DecodeLastFrame(r, "images/apng-test-suite--blend-ops--over-repeatedly.png"); in DEF_TEST()
512 if (!image) { in DEF_TEST()
517 REPORTER_ASSERT(r, image->peekPixels(&pixmap)); in DEF_TEST()
521 // Test based on
522 // https://philip.html5.org/tests/apng/tests.html#apng-dispose-op-none-in-region
524 sk_sp<SkImage> image = in DEF_TEST() local
525 DecodeLastFrame(r, "images/apng-test-suite--regions--dispose-op-none.png"); in DEF_TEST()
526 if (!image) { in DEF_TEST()
532 // * The image (and the first frame) is 128x64 in DEF_TEST()
536 REPORTER_ASSERT(r, image->peekPixels(&pixmap)); in DEF_TEST()
544 // Test based on
545 // https://philip.html5.org/tests/apng/tests.html#num-plays-0
548 r, SkCodec::kRepetitionCountInfinite, "images/apng-test-suite--num-plays--0.png"); in DEF_TEST()
551 // Test based on
552 // https://philip.html5.org/tests/apng/tests.html#num-plays-1
554 AssertAnimationRepetitionCount(r, 0, "images/apng-test-suite--num-plays--1.png"); in DEF_TEST()
557 // Test based on
558 // https://philip.html5.org/tests/apng/tests.html#num-plays-2
560 AssertAnimationRepetitionCount(r, 1, "images/apng-test-suite--num-plays--2.png"); in DEF_TEST()
563 // Test based on
564 // https://philip.html5.org/tests/apng/tests.html#num-frames-outside-valid-range
570 // `num_frames` shall be "limited to the range 0 to (2^31)-1"
573 r, "images/apng-test-suite--invalid--num-frames-outside-valid-range.png"); in DEF_TEST()
578 // Calling `codec->getFrameCount` exercises the code used to discover and in DEF_TEST()
581 // `SkASSERT(fFrameAtCurrentStreamPosition < this->getRawFrameCount())` in DEF_TEST()
587 REPORTER_ASSERT(r, codec->getFrameCount() == 1); in DEF_TEST()
592 SkPngRustDecoderDecode(r, "images/apng-test-suite--basic--ignoring-default-image.png"); in DEF_TEST()
596 REPORTER_ASSERT(r, codec->getFrameCount() == 1); in DEF_TEST()
603 codec->dimensions(), kBGRA_10101010_XR_SkColorType, kPremul_SkAlphaType); in DEF_TEST()
605 auto [image, result] = codec->getImage(dstInfo); in DEF_TEST()
607 REPORTER_ASSERT(r, !image); in DEF_TEST()
624 REPORTER_ASSERT(r, codec->hasHighBitDepthEncodedData() == test.fEncodedWith16bits); in DEF_TEST()
635 const skcms_ICCProfile* profile = codec->getICCProfile(); in DEF_TEST()
641 REPORTER_ASSERT(r, skcms_TransferFunction_isPQish(&profile->trc[0].parametric)); in DEF_TEST()