Revert "Disable F16-nullptr sources"

Manual revert: failing ui rendering cts tests

Bug: b/62482405
Change-Id: I652ec8dce482d303437835a27c50a22248afd955
Reviewed-on: https://skia-review.googlesource.com/19360
Reviewed-by: Matt Sarett <msarett@google.com>
Commit-Queue: Matt Sarett <msarett@google.com>
This commit is contained in:
Matt Sarett 2017-06-09 15:05:12 -04:00 committed by Skia Commit-Bot
parent b58194a90e
commit 69d1469654
4 changed files with 19 additions and 17 deletions

View File

@ -303,23 +303,25 @@ sk_sp<SkImage> SkImage::MakeFromRaster(const SkPixmap& pmap, RasterReleaseProc p
return sk_make_sp<SkImage_Raster>(pmap.info(), std::move(data), pmap.rowBytes(), pmap.ctable());
}
sk_sp<SkImage> SkMakeImageFromRasterBitmapPriv(const SkBitmap& bm, SkCopyPixelsMode cpm) {
if (kAlways_SkCopyPixelsMode == cpm || (!bm.isImmutable() && kNever_SkCopyPixelsMode != cpm)) {
SkPixmap pmap;
SkAssertResult(bm.peekPixels(&pmap));
return SkImage::MakeRasterCopy(pmap);
sk_sp<SkImage> SkMakeImageFromRasterBitmap(const SkBitmap& bm, SkCopyPixelsMode cpm) {
bool hasColorTable = false;
if (kIndex_8_SkColorType == bm.colorType()) {
hasColorTable = bm.getColorTable() != nullptr;
}
return sk_make_sp<SkImage_Raster>(bm, kNever_SkCopyPixelsMode == cpm);
}
sk_sp<SkImage> SkMakeImageFromRasterBitmap(const SkBitmap& bm, SkCopyPixelsMode cpm) {
if (!SkImageInfoIsValidAllowNumericalCS(bm.info()) || !bm.getPixels() ||
bm.rowBytes() < bm.info().minRowBytes()) {
if (!SkImage_Raster::ValidArgs(bm.info(), bm.rowBytes(), hasColorTable, nullptr)) {
return nullptr;
}
return SkMakeImageFromRasterBitmapPriv(bm, cpm);
if (kAlways_SkCopyPixelsMode == cpm || (!bm.isImmutable() && kNever_SkCopyPixelsMode != cpm)) {
SkPixmap pmap;
if (bm.getPixels() && bm.peekPixels(&pmap)) {
return SkImage::MakeRasterCopy(pmap);
}
} else {
return sk_make_sp<SkImage_Raster>(bm, kNever_SkCopyPixelsMode == cpm);
}
return sk_sp<SkImage>();
}
sk_sp<SkImage> SkMakeImageInColorSpace(const SkBitmap& bm, sk_sp<SkColorSpace> dstCS, uint32_t id) {
@ -337,7 +339,7 @@ sk_sp<SkImage> SkMakeImageInColorSpace(const SkBitmap& bm, sk_sp<SkColorSpace> d
// For the Android use case, this is very likely to be true.
if (SkColorSpace::Equals(srcCS.get(), dstCS.get())) {
SkASSERT(0 == id || bm.getGenerationID() == id);
return SkMakeImageFromRasterBitmapPriv(bm, kNever_SkCopyPixelsMode);
return SkMakeImageFromRasterBitmap(bm, kNever_SkCopyPixelsMode);
}
return SkImage::MakeFromGenerator(SkColorSpaceXformImageGenerator::Make(

View File

@ -175,7 +175,7 @@ void SkSurface_Gpu::onPrepareForExternalIO() {
bool SkSurface_Gpu::Valid(const SkImageInfo& info) {
switch (info.colorType()) {
case kRGBA_F16_SkColorType:
return info.colorSpace() && info.colorSpace()->gammaIsLinear();
return !info.colorSpace() || info.colorSpace()->gammaIsLinear();
case kRGBA_8888_SkColorType:
case kBGRA_8888_SkColorType:
return !info.colorSpace() || info.colorSpace()->gammaCloseToSRGB();
@ -187,7 +187,7 @@ bool SkSurface_Gpu::Valid(const SkImageInfo& info) {
bool SkSurface_Gpu::Valid(GrContext* context, GrPixelConfig config, SkColorSpace* colorSpace) {
switch (config) {
case kRGBA_half_GrPixelConfig:
return colorSpace && colorSpace->gammaIsLinear();
return !colorSpace || colorSpace->gammaIsLinear();
case kSRGBA_8888_GrPixelConfig:
case kSBGRA_8888_GrPixelConfig:
return context->caps()->srgbSupport() && colorSpace && colorSpace->gammaCloseToSRGB();

View File

@ -63,7 +63,7 @@ bool SkSurfaceValidateRasterInfo(const SkImageInfo& info, size_t rowBytes) {
shift = 2;
break;
case kRGBA_F16_SkColorType:
if (!info.colorSpace() || !info.colorSpace()->gammaIsLinear()) {
if (info.colorSpace() && !info.colorSpace()->gammaIsLinear()) {
return false;
}
shift = 3;

View File

@ -837,7 +837,7 @@ static void test_surface_creation_and_snapshot_with_color_space(
{ kN32_SkColorType, srgbColorSpace, true, "N32-srgb" },
{ kN32_SkColorType, adobeColorSpace, true, "N32-adobe" },
{ kN32_SkColorType, oddColorSpace, false, "N32-odd" },
{ kRGBA_F16_SkColorType, nullptr, false, "F16-nullptr" },
{ kRGBA_F16_SkColorType, nullptr, true, "F16-nullptr" },
{ kRGBA_F16_SkColorType, linearColorSpace, true, "F16-linear" },
{ kRGBA_F16_SkColorType, srgbColorSpace, false, "F16-srgb" },
{ kRGBA_F16_SkColorType, adobeColorSpace, false, "F16-adobe" },