Add CodecZeroInit test to DMSrcSink
This should not cause any diffs on Gold. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1577853004 Review URL: https://codereview.chromium.org/1577853004
This commit is contained in:
parent
f33e7a3959
commit
bb25b53249
@ -232,6 +232,9 @@ static void push_codec_src(Path path, CodecSrc::Mode mode, CodecSrc::DstColorTyp
|
||||
case CodecSrc::kCodec_Mode:
|
||||
folder.append("codec");
|
||||
break;
|
||||
case CodecSrc::kCodecZeroInit_Mode:
|
||||
folder.append("codec_zero_init");
|
||||
break;
|
||||
case CodecSrc::kScanline_Mode:
|
||||
folder.append("scanline");
|
||||
break;
|
||||
@ -311,8 +314,8 @@ static void push_codec_srcs(Path path) {
|
||||
// SkJpegCodec natively supports scaling to: 0.125, 0.25, 0.375, 0.5, 0.625, 0.75, 0.875
|
||||
const float nativeScales[] = { 0.125f, 0.25f, 0.375f, 0.5f, 0.625f, 0.750f, 0.875f, 1.0f };
|
||||
|
||||
const CodecSrc::Mode nativeModes[] = { CodecSrc::kCodec_Mode, CodecSrc::kScanline_Mode,
|
||||
CodecSrc::kStripe_Mode, CodecSrc::kSubset_Mode };
|
||||
const CodecSrc::Mode nativeModes[] = { CodecSrc::kCodec_Mode, CodecSrc::kCodecZeroInit_Mode,
|
||||
CodecSrc::kScanline_Mode, CodecSrc::kStripe_Mode, CodecSrc::kSubset_Mode };
|
||||
|
||||
CodecSrc::DstColorType colorTypes[3];
|
||||
uint32_t numColorTypes;
|
||||
|
@ -316,14 +316,22 @@ Error CodecSrc::draw(SkCanvas* canvas) const {
|
||||
}
|
||||
|
||||
SkBitmap bitmap;
|
||||
if (!bitmap.tryAllocPixels(decodeInfo, nullptr, colorTable.get())) {
|
||||
SkPixelRefFactory* factory = nullptr;
|
||||
SkMallocPixelRef::ZeroedPRFactory zeroFactory;
|
||||
SkCodec::Options options;
|
||||
if (kCodecZeroInit_Mode == fMode) {
|
||||
factory = &zeroFactory;
|
||||
options.fZeroInitialized = SkCodec::kYes_ZeroInitialized;
|
||||
}
|
||||
if (!bitmap.tryAllocPixels(decodeInfo, factory, colorTable.get())) {
|
||||
return SkStringPrintf("Image(%s) is too large (%d x %d)", fPath.c_str(),
|
||||
decodeInfo.width(), decodeInfo.height());
|
||||
}
|
||||
|
||||
switch (fMode) {
|
||||
case kCodecZeroInit_Mode:
|
||||
case kCodec_Mode: {
|
||||
switch (codec->getPixels(decodeInfo, bitmap.getPixels(), bitmap.rowBytes(), nullptr,
|
||||
switch (codec->getPixels(decodeInfo, bitmap.getPixels(), bitmap.rowBytes(), &options,
|
||||
colorPtr, colorCountPtr)) {
|
||||
case SkCodec::kSuccess:
|
||||
// We consider incomplete to be valid, since we should still decode what is
|
||||
|
@ -104,6 +104,10 @@ class CodecSrc : public Src {
|
||||
public:
|
||||
enum Mode {
|
||||
kCodec_Mode,
|
||||
// We choose to test only one mode with zero initialized memory.
|
||||
// This will exercise all of the interesting cases in SkSwizzler
|
||||
// without doubling the size of our test suite.
|
||||
kCodecZeroInit_Mode,
|
||||
kScanline_Mode,
|
||||
kStripe_Mode, // Tests the skipping of scanlines
|
||||
kSubset_Mode, // For codecs that support subsets directly.
|
||||
|
Loading…
Reference in New Issue
Block a user