Lines Matching refs:image

134 static void test_encode(skiatest::Reporter* reporter, SkImage* image) {  in test_encode()  argument
136 SkAutoTUnref<SkData> origEncoded(image->encode()); in test_encode()
142 assert_equal(reporter, image, nullptr, decoded); in test_encode()
148 assert_equal(reporter, image, &ir, decoded); in test_encode()
152 SkAutoTUnref<SkImage> image(create_image()); in DEF_TEST() local
153 test_encode(reporter, image); in DEF_TEST()
158 SkAutoTUnref<SkImage> image(create_gpu_image(context)); in DEF_GPUTEST_FOR_RENDERING_CONTEXTS() local
159 test_encode(reporter, image); in DEF_GPUTEST_FOR_RENDERING_CONTEXTS()
195 SkAutoTUnref<SkImage> image(create_image()); in DEF_TEST() local
196 SkAutoTUnref<SkData> encoded(image->encode(&serializer)); in DEF_TEST()
209 SkAutoTUnref<SkImage> image(surface->newImageSnapshot()); in DEF_TEST() local
210 REPORTER_ASSERT(reporter, image); in DEF_TEST()
214 canvas->drawImage(image, 0, 0); in DEF_TEST()
248 SkAutoTUnref<SkImage> image(SkImage::NewRasterCopy(srcInfo, indices, srcRowBytes, ctable)); in DEF_TEST() local
256 image->readPixels(dstInfo, pixels, dstRowBytes, 0, 0); in DEF_TEST()
324 SkAutoTUnref<SkImage> image(SkImage::NewFromBitmap(bm)); in DEF_TEST() local
327 const bool sharedID = (image->uniqueID() == bm.getGenerationID()); in DEF_TEST()
330 const bool peekSuccess = image->peekPixels(&pmap); in DEF_TEST()
333 const bool lazy = image->isLazyGenerated(); in DEF_TEST()
353 SkAutoTUnref<SkImage> image(create_gpu_image(context)); in DEF_GPUTEST_FOR_NATIVE_CONTEXT() local
354 const uint32_t uniqueID = image->uniqueID(); in DEF_GPUTEST_FOR_NATIVE_CONTEXT()
365 surface->getCanvas()->drawImage(image, 0, 0); in DEF_GPUTEST_FOR_NATIVE_CONTEXT()
379 image.reset(nullptr); in DEF_GPUTEST_FOR_NATIVE_CONTEXT()
410 SkAutoTUnref<SkImage> image(factory()); in DEF_GPUTEST_FOR_NATIVE_CONTEXT() local
411 if (!image) { in DEF_GPUTEST_FOR_NATIVE_CONTEXT()
415 GrTexture* origTexture = as_IB(image)->peekTexture(); in DEF_GPUTEST_FOR_NATIVE_CONTEXT()
417 SkAutoTUnref<SkImage> texImage(image->newTextureImage(context)); in DEF_GPUTEST_FOR_NATIVE_CONTEXT()
435 if (image->width() != texImage->width() || image->height() != texImage->height()) { in DEF_GPUTEST_FOR_NATIVE_CONTEXT()
438 if (image->isOpaque() != texImage->isOpaque()) { in DEF_GPUTEST_FOR_NATIVE_CONTEXT()
479 SkImage* image = SkImage::NewRasterData(info, data, rowBytes); in DEF_TEST() local
481 image->unref(); in DEF_TEST()
495 static void test_read_pixels(skiatest::Reporter* reporter, SkImage* image) { in test_read_pixels() argument
506 REPORTER_ASSERT(reporter, !image->readPixels(info, pixels, rowBytes, 0, 0)); in test_read_pixels()
510 REPORTER_ASSERT(reporter, !image->readPixels(info, pixels, rowBytes, -w, 0)); in test_read_pixels()
511 REPORTER_ASSERT(reporter, !image->readPixels(info, pixels, rowBytes, 0, -h)); in test_read_pixels()
512 REPORTER_ASSERT(reporter, !image->readPixels(info, pixels, rowBytes, image->width(), 0)); in test_read_pixels()
513 REPORTER_ASSERT(reporter, !image->readPixels(info, pixels, rowBytes, 0, image->height())); in test_read_pixels()
517 REPORTER_ASSERT(reporter, image->readPixels(info, pixels, rowBytes, 0, 0)); in test_read_pixels()
522 REPORTER_ASSERT(reporter, image->readPixels(info, pixels, rowBytes, in test_read_pixels()
523 image->width() - w, image->height() - h)); in test_read_pixels()
528 REPORTER_ASSERT(reporter, image->readPixels(info, pixels, rowBytes, -1, -1)); in test_read_pixels()
534 REPORTER_ASSERT(reporter, image->readPixels(info, pixels, rowBytes, in test_read_pixels()
535 image->width() - 1, image->height() - 1)); in test_read_pixels()
540 SkAutoTUnref<SkImage> image(create_image()); in DEF_TEST() local
541 test_read_pixels(reporter, image); in DEF_TEST()
543 image.reset(create_data_image()); in DEF_TEST()
544 test_read_pixels(reporter, image); in DEF_TEST()
547 image.reset(create_rasterproc_image(&dataHolder)); in DEF_TEST()
548 test_read_pixels(reporter, image); in DEF_TEST()
549 image.reset(); in DEF_TEST()
552 image.reset(create_codec_image()); in DEF_TEST()
553 test_read_pixels(reporter, image); in DEF_TEST()
557 SkAutoTUnref<SkImage> image(create_gpu_image(context)); in DEF_GPUTEST_FOR_RENDERING_CONTEXTS() local
558 test_read_pixels(reporter, image); in DEF_GPUTEST_FOR_RENDERING_CONTEXTS()
562 static void check_legacy_bitmap(skiatest::Reporter* reporter, const SkImage* image, in check_legacy_bitmap() argument
564 REPORTER_ASSERT(reporter, image->width() == bitmap.width()); in check_legacy_bitmap()
565 REPORTER_ASSERT(reporter, image->height() == bitmap.height()); in check_legacy_bitmap()
566 REPORTER_ASSERT(reporter, image->isOpaque() == bitmap.isOpaque()); in check_legacy_bitmap()
577 REPORTER_ASSERT(reporter, image->readPixels(info, &imageColor, sizeof(SkPMColor), 0, 0)); in check_legacy_bitmap()
581 static void test_legacy_bitmap(skiatest::Reporter* reporter, const SkImage* image, SkImage::LegacyB… in test_legacy_bitmap() argument
583 REPORTER_ASSERT(reporter, image->asLegacyBitmap(&bitmap, mode)); in test_legacy_bitmap()
584 check_legacy_bitmap(reporter, image, bitmap, mode); in test_legacy_bitmap()
588 REPORTER_ASSERT(reporter, bitmap.extractSubset(&tmp, SkIRect::MakeWH(image->width() / 2, in test_legacy_bitmap()
589 image->height() / 2))); in test_legacy_bitmap()
603 SkAutoTUnref<SkImage> image(create_image()); in DEF_TEST() local
604 test_legacy_bitmap(reporter, image, mode); in DEF_TEST()
606 image.reset(create_data_image()); in DEF_TEST()
607 test_legacy_bitmap(reporter, image, mode); in DEF_TEST()
610 image.reset(create_rasterproc_image(&dataHolder)); in DEF_TEST()
611 test_legacy_bitmap(reporter, image, mode); in DEF_TEST()
612 image.reset(); in DEF_TEST()
615 image.reset(create_codec_image()); in DEF_TEST()
616 test_legacy_bitmap(reporter, image, mode); in DEF_TEST()
626 SkAutoTUnref<SkImage> image(create_gpu_image(context)); in DEF_GPUTEST_FOR_RENDERING_CONTEXTS() local
627 test_legacy_bitmap(reporter, image, mode); in DEF_GPUTEST_FOR_RENDERING_CONTEXTS()
632 static void test_peek(skiatest::Reporter* reporter, SkImage* image, bool expectPeekSuccess) { in test_peek() argument
635 const void* addr = image->peekPixels(&info, &rowBytes); in test_peek()
649 SkAutoTUnref<SkImage> image(create_image()); in DEF_TEST() local
650 test_peek(reporter, image, true); in DEF_TEST()
652 image.reset(create_data_image()); in DEF_TEST()
653 test_peek(reporter, image, true); in DEF_TEST()
656 image.reset(create_rasterproc_image(&dataHolder)); in DEF_TEST()
657 test_peek(reporter, image, true); in DEF_TEST()
658 image.reset(); in DEF_TEST()
661 image.reset(create_codec_image()); in DEF_TEST()
662 test_peek(reporter, image, false); in DEF_TEST()
666 SkAutoTUnref<SkImage> image(create_gpu_image(context)); in DEF_GPUTEST_FOR_RENDERING_CONTEXTS() local
667 test_peek(reporter, image, false); in DEF_GPUTEST_FOR_RENDERING_CONTEXTS()
679 static void check_image_color(skiatest::Reporter* reporter, SkImage* image, SkPMColor expected) { in check_image_color() argument
682 REPORTER_ASSERT(reporter, image->readPixels(info, &pixel, sizeof(pixel), 0, 0)); in check_image_color()