Lines Matching +full:image +full:- +full:based
4 * Use of this source code is governed by a BSD-style license that can be
36 "PNGCodecGM. Directories are scanned non-recursively. All files are assumed to be "
40 "One of \"get-all-pixels\", \"incremental\" or \"zero-init\".");
43 "One of \"force-grayscale\", "
44 "\"force-nonnative-premul-color\" or \"get-from-canvas\".");
142 // This GM implements the PNG-related behaviors found in DM's CodecSrc class. It takes a single
143 // image as an argument and applies the same logic as CodecSrc.
149 // Based on CodecSrc::Mode.
157 // Based on CodecSrc::DstColorType.
189 // Based on DM's CodecSrc::CodecSrc().
209 {"source_type", "image"}, in getGoldKeys()
217 // Based on CodecSrc::name().
224 // Based on CodecSrc::size().
231 return decodeResult.codec->dimensions(); in getISize()
234 // Based on CodecSrc::draw().
244 SkImageInfo decodeInfo = codec->getInfo(); in onDraw()
246 canvas->imageInfo().colorType()); in onDraw()
251 SkISize size = codec->dimensions(); in onDraw()
280 switch (codec->getPixels(decodeInfo, pixels.get(), rowBytes, &options)) { in onDraw()
300 codec->startIncrementalDecode(decodeInfo, dst, rowBytes, &options)) { in onDraw()
302 auto result = codec->incrementalDecode(&rowsDecoded); in onDraw()
304 codec->fillIncompleteImage(decodeInfo, in onDraw()
327 // Checks that the canvas color type, destination color and alpha types and input image
329 // image.
331 // Based on DM's get_decode_info() function.
343 *decodeInfo = decodeInfo->makeColorType(kGray_8_SkColorType); in validateCanvasColorTypeAndGetDecodeInfo()
355 *decodeInfo = decodeInfo->makeColorType(kBGRA_8888_SkColorType); in validateCanvasColorTypeAndGetDecodeInfo()
357 *decodeInfo = decodeInfo->makeColorType(kRGBA_8888_SkColorType); in validateCanvasColorTypeAndGetDecodeInfo()
363 kOpaque_SkAlphaType != decodeInfo->alphaType()) { in validateCanvasColorTypeAndGetDecodeInfo()
365 "image \"%s\" has alpha type %s; this is incompatible with with " in validateCanvasColorTypeAndGetDecodeInfo()
368 sk_alpha_type_to_str(decodeInfo->alphaType()), in validateCanvasColorTypeAndGetDecodeInfo()
372 *decodeInfo = decodeInfo->makeColorType(canvasColorType); in validateCanvasColorTypeAndGetDecodeInfo()
379 *decodeInfo = decodeInfo->makeAlphaType(fDstAlphaType); in validateCanvasColorTypeAndGetDecodeInfo()
383 // Based on DM's draw_to_canvas() function.
394 canvas->drawImage(bitmap.asImage(), left, top); in drawToCanvas()
397 // Allows us to test decodes to non-native 8888.
399 // Based on DM's swap_rb_if_necessary function.
418 // Registers GMs with zero or more PNGCodecGM instances for the given image. Returns a non-empty,
419 // human-friendly error message in the case of errors.
421 // Based on DM's push_codec_srcs() function. It only covers "simple" codecs (lines 740-834).
426 // - AndroidCodecSrc
427 // - BRDSrc
428 // - ImageGenSrc
441 decodeResult.codec->getInfo().colorType() != kGray_8_SkColorType) { in registerGMsForImage()
443 "image \"%s\" has color type %s; this is incompatible with the given " in registerGMsForImage()
444 "dstColorType argument: %s (expected image color type: %s)", in registerGMsForImage()
446 sk_color_type_to_str(decodeResult.codec->getInfo().colorType()), in registerGMsForImage()
453 decodeResult.codec->getInfo().alphaType() == kOpaque_SkAlphaType) { in registerGMsForImage()
455 "image \"%s\" has alpha type %s; this is incompatible with the given " in registerGMsForImage()
467 // Returns a non-empty message in the case of errors.
472 {SkString("get-all-pixels"), PNGCodecGM::DecodeMode::kGetAllPixels}, in parse_and_validate_flags()
474 {SkString("zero-init"), PNGCodecGM::DecodeMode::kZeroInit}, in parse_and_validate_flags()
477 "--pngCodecDecodeMode", decodeModeValues, decodeMode); in parse_and_validate_flags()
483 {SkString("get-from-canvas"), PNGCodecGM::DstColorType::kGetFromCanvas}, in parse_and_validate_flags()
484 {SkString("force-grayscale"), PNGCodecGM::DstColorType::kForceGrayscale}, in parse_and_validate_flags()
485 {SkString("force-nonnative-premul-color"), in parse_and_validate_flags()
489 "--pngCodecDstColorType", dstColorTypeValues, dstColorType); in parse_and_validate_flags()
499 "--pngCodecDstAlphaType", dstAlphaTypeValues, dstAlphaType); in parse_and_validate_flags()
507 // Registers one PNGCodecGM instance for each image passed via the --pngCodecGMImages flag, which
508 // can take files and directories. Directories are scanned non-recursively.
510 // Based on DM's gather_srcs() function.
512 DEF_GM_REGISTERER_FN([]() -> std::string { in __anonb277b3f40102()
528 // Register one GM per image. in __anonb277b3f40102()
529 for (const SkString& image : images) { in __anonb277b3f40102() local
531 registerGMsForImage(image.c_str(), decodeMode, dstColorType, dstAlphaType); in __anonb277b3f40102()