non-linear blending first steps

Code:
  - Add a non-linear blending bit and makeNonlinearBlending()
    to SkColorSpace
  - remove enough F16=linear checks to make it possible to
    create surfaces and encode pngs with nonlinear F16

Testing:
  - add "esrgb" software config to DM, run it
  - add "srgbnl" software config, run it
  - deemphasize importance of "srgb" config on bots
  - update unit tests to reflect relaxed F16 constraints
  - add a new unit test file with _really_ basic tests,
    and a new unit test that's not working yet

Bug: skia:7942

Change-Id: I8ac042bdf9f3d791765393b68fd9256375184d83
Reviewed-on: https://skia-review.googlesource.com/127325
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Mike Klein <mtklein@chromium.org>
This commit is contained in:
Mike Klein 2018-05-10 11:29:15 -04:00
parent 024615e975
commit ce4cf72e34
38 changed files with 151 additions and 55 deletions

View File

@ -903,6 +903,7 @@ static Sink* create_sink(const GrContextOptions& grCtxOptions, const SkCommandLi
if (FLAGS_cpu) {
auto srgbColorSpace = SkColorSpace::MakeSRGB();
auto srgbLinearColorSpace = SkColorSpace::MakeSRGBLinear();
auto esrgb = SkColorSpace::MakeSRGB()->makeNonlinearBlending();
SINK("g8", RasterSink, kGray_8_SkColorType);
SINK("565", RasterSink, kRGB_565_SkColorType);
@ -915,6 +916,8 @@ static Sink* create_sink(const GrContextOptions& grCtxOptions, const SkCommandLi
SINK("1010102", RasterSink, kRGBA_1010102_SkColorType);
SINK("101010x", RasterSink, kRGB_101010x_SkColorType);
SINK("f16", RasterSink, kRGBA_F16_SkColorType, srgbLinearColorSpace);
SINK("esrgb", RasterSink, kRGBA_F16_SkColorType, esrgb);
SINK("srgbnl", RasterSink, kRGBA_8888_SkColorType, esrgb);
SINK("t8888", ThreadedSink, kN32_SkColorType);
SINK("pdf", PDFSink, false, SK_ScalarDefaultRasterDPI);
SINK("skp", SKPSink);

View File

@ -166,6 +166,7 @@ protected:
canvas->imageInfo().refColorSpace());
}
surf = SkSurface::MakeRaster(info);
SkASSERT(surf);
}
canvas->scale(5.f, 5.f);
canvas->translate(67.f, 10.f);

View File

@ -141,6 +141,7 @@ tests_sources = [
"$_tests/MessageBusTest.cpp",
"$_tests/MetaDataTest.cpp",
"$_tests/MipMapTest.cpp",
"$_tests/NonlinearBlendingTest.cpp",
"$_tests/OnceTest.cpp",
"$_tests/OSPathTest.cpp",
"$_tests/OverAlignedTest.cpp",

View File

@ -259,6 +259,9 @@ public:
*/
const SkData* profileData() const { return this->onProfileData(); }
virtual bool nonlinearBlending() const { return false; }
virtual sk_sp<SkColorSpace> makeNonlinearBlending() const { return nullptr; }
private:
virtual const SkMatrix44* onToXYZD50() const = 0;
virtual uint32_t onToXYZD50Hash() const = 0;

View File

@ -115,11 +115,6 @@ static inline bool SkImageInfoIsValidCommon(const SkImageInfo& info) {
return false;
}
if (kRGBA_F16_SkColorType == info.colorType() &&
(info.colorSpace() && (!info.colorSpace()->gammaIsLinear()))) {
return false;
}
return true;
}

View File

@ -945,7 +945,7 @@
"--json-output",
"/path/to/tmp/json",
"copy",
"set -x; /data/local/tmp/dm --resourcePath /sdcard/revenge_of_the_skiabot/resources --skps /sdcard/revenge_of_the_skiabot/skps --images /sdcard/revenge_of_the_skiabot/images/dm --colorImages /sdcard/revenge_of_the_skiabot/images/colorspace --nameByHash --properties gitHash abc123 builder Test-Android-Clang-Nexus5x-CPU-Snapdragon808-arm-Release-All-Android_ASAN buildbucket_build_id 123454321 swarming_bot_id skia-bot-123 swarming_task_id 123456 --svgs /sdcard/revenge_of_the_skiabot/svgs --key arch arm compiler Clang configuration Release cpu_or_gpu CPU cpu_or_gpu_value Snapdragon808 extra_config Android_ASAN model Nexus5x os Android --dont_write pdf --nogpu --config 8888 srgb serialize-8888 tiles_rt-8888 pic-8888 --src tests gm image colorImage --blacklist _ test _ GrShape serialize-8888 gm _ bleed_image serialize-8888 gm _ c_gms serialize-8888 gm _ colortype serialize-8888 gm _ colortype_xfermodes serialize-8888 gm _ drawfilter serialize-8888 gm _ fontmgr_bounds_0.75_0 serialize-8888 gm _ fontmgr_bounds_1_-0.25 serialize-8888 gm _ fontmgr_bounds serialize-8888 gm _ fontmgr_match serialize-8888 gm _ fontmgr_iter serialize-8888 gm _ imagemasksubset serialize-8888 gm _ bitmapfilters serialize-8888 gm _ bitmapshaders serialize-8888 gm _ bleed serialize-8888 gm _ bleed_alpha_bmp serialize-8888 gm _ bleed_alpha_bmp_shader serialize-8888 gm _ convex_poly_clip serialize-8888 gm _ extractalpha serialize-8888 gm _ filterbitmap_checkerboard_32_32_g8 serialize-8888 gm _ filterbitmap_image_mandrill_64 serialize-8888 gm _ shadows serialize-8888 gm _ simpleaaclip_aaclip serialize-8888 gm _ composeshader_bitmap serialize-8888 gm _ scaled_tilemodes_npot serialize-8888 gm _ scaled_tilemodes serialize-8888 gm _ typefacerendering_pfaMac serialize-8888 gm _ parsedpaths serialize-8888 gm _ ImageGeneratorExternal_rect serialize-8888 gm _ ImageGeneratorExternal_shader serialize-8888 gm _ shadow_utils serialize-8888 gm _ all_bitmap_configs serialize-8888 gm _ makecolorspace serialize-8888 gm _ analytic_antialias_convex serialize-8888 gm _ bleed_alpha_image serialize-8888 gm _ bleed_alpha_image_shader serialize-8888 gm _ verylargebitmap serialize-8888 gm _ verylarge_picture_image pic-8888 gm _ drawfilter pic-8888 gm _ image-cacherator-from-picture serialize-8888 gm _ image-cacherator-from-picture pic-8888 gm _ image-cacherator-from-raster serialize-8888 gm _ image-cacherator-from-raster pic-8888 gm _ image-cacherator-from-ctable serialize-8888 gm _ image-cacherator-from-ctable pic-8888 gm _ gamut serialize-8888 gm _ gamut pic-8888 gm _ complexclip4_bw serialize-8888 gm _ complexclip4_bw pic-8888 gm _ complexclip4_aa serialize-8888 gm _ complexclip4_aa tiles_rt-8888 gm _ complexclip4_bw tiles_rt-8888 gm _ complexclip4_aa --match ~BadImage --noRAW_threading --nonativeFonts --verbose; echo $? >/data/local/tmp/rc",
"set -x; /data/local/tmp/dm --resourcePath /sdcard/revenge_of_the_skiabot/resources --skps /sdcard/revenge_of_the_skiabot/skps --images /sdcard/revenge_of_the_skiabot/images/dm --colorImages /sdcard/revenge_of_the_skiabot/images/colorspace --nameByHash --properties gitHash abc123 builder Test-Android-Clang-Nexus5x-CPU-Snapdragon808-arm-Release-All-Android_ASAN buildbucket_build_id 123454321 swarming_bot_id skia-bot-123 swarming_task_id 123456 --svgs /sdcard/revenge_of_the_skiabot/svgs --key arch arm compiler Clang configuration Release cpu_or_gpu CPU cpu_or_gpu_value Snapdragon808 extra_config Android_ASAN model Nexus5x os Android --dont_write pdf --nogpu --config 8888 serialize-8888 tiles_rt-8888 pic-8888 --src tests gm image colorImage --blacklist _ test _ GrShape serialize-8888 gm _ bleed_image serialize-8888 gm _ c_gms serialize-8888 gm _ colortype serialize-8888 gm _ colortype_xfermodes serialize-8888 gm _ drawfilter serialize-8888 gm _ fontmgr_bounds_0.75_0 serialize-8888 gm _ fontmgr_bounds_1_-0.25 serialize-8888 gm _ fontmgr_bounds serialize-8888 gm _ fontmgr_match serialize-8888 gm _ fontmgr_iter serialize-8888 gm _ imagemasksubset serialize-8888 gm _ bitmapfilters serialize-8888 gm _ bitmapshaders serialize-8888 gm _ bleed serialize-8888 gm _ bleed_alpha_bmp serialize-8888 gm _ bleed_alpha_bmp_shader serialize-8888 gm _ convex_poly_clip serialize-8888 gm _ extractalpha serialize-8888 gm _ filterbitmap_checkerboard_32_32_g8 serialize-8888 gm _ filterbitmap_image_mandrill_64 serialize-8888 gm _ shadows serialize-8888 gm _ simpleaaclip_aaclip serialize-8888 gm _ composeshader_bitmap serialize-8888 gm _ scaled_tilemodes_npot serialize-8888 gm _ scaled_tilemodes serialize-8888 gm _ typefacerendering_pfaMac serialize-8888 gm _ parsedpaths serialize-8888 gm _ ImageGeneratorExternal_rect serialize-8888 gm _ ImageGeneratorExternal_shader serialize-8888 gm _ shadow_utils serialize-8888 gm _ all_bitmap_configs serialize-8888 gm _ makecolorspace serialize-8888 gm _ analytic_antialias_convex serialize-8888 gm _ bleed_alpha_image serialize-8888 gm _ bleed_alpha_image_shader serialize-8888 gm _ verylargebitmap serialize-8888 gm _ verylarge_picture_image pic-8888 gm _ drawfilter pic-8888 gm _ image-cacherator-from-picture serialize-8888 gm _ image-cacherator-from-picture pic-8888 gm _ image-cacherator-from-raster serialize-8888 gm _ image-cacherator-from-raster pic-8888 gm _ image-cacherator-from-ctable serialize-8888 gm _ image-cacherator-from-ctable pic-8888 gm _ gamut serialize-8888 gm _ gamut pic-8888 gm _ complexclip4_bw serialize-8888 gm _ complexclip4_bw pic-8888 gm _ complexclip4_aa serialize-8888 gm _ complexclip4_aa tiles_rt-8888 gm _ complexclip4_bw tiles_rt-8888 gm _ complexclip4_aa --match ~BadImage --noRAW_threading --nonativeFonts --verbose; echo $? >/data/local/tmp/rc",
"[START_DIR]/tmp/dm.sh"
],
"env": {

View File

@ -750,7 +750,7 @@
"--json-output",
"/path/to/tmp/json",
"copy",
"set -x; /data/local/tmp/dm --resourcePath /sdcard/revenge_of_the_skiabot/resources --skps /sdcard/revenge_of_the_skiabot/skps --images /sdcard/revenge_of_the_skiabot/images/dm --colorImages /sdcard/revenge_of_the_skiabot/images/colorspace --nameByHash --properties gitHash abc123 builder Test-Android-Clang-Nexus7-CPU-Tegra3-arm-Release-All-Android buildbucket_build_id 123454321 swarming_bot_id skia-bot-123 swarming_task_id 123456 --svgs /sdcard/revenge_of_the_skiabot/svgs --key arch arm compiler Clang configuration Release cpu_or_gpu CPU cpu_or_gpu_value Tegra3 extra_config Android model Nexus7 os Android --uninterestingHashesFile /sdcard/revenge_of_the_skiabot/uninteresting_hashes.txt --writePath /sdcard/revenge_of_the_skiabot/dm_out --dont_write pdf --threads 2 --nogpu --config 8888 srgb serialize-8888 tiles_rt-8888 pic-8888 --src tests gm image colorImage --blacklist _ test _ GrShape serialize-8888 gm _ bleed_image serialize-8888 gm _ c_gms serialize-8888 gm _ colortype serialize-8888 gm _ colortype_xfermodes serialize-8888 gm _ drawfilter serialize-8888 gm _ fontmgr_bounds_0.75_0 serialize-8888 gm _ fontmgr_bounds_1_-0.25 serialize-8888 gm _ fontmgr_bounds serialize-8888 gm _ fontmgr_match serialize-8888 gm _ fontmgr_iter serialize-8888 gm _ imagemasksubset serialize-8888 gm _ bitmapfilters serialize-8888 gm _ bitmapshaders serialize-8888 gm _ bleed serialize-8888 gm _ bleed_alpha_bmp serialize-8888 gm _ bleed_alpha_bmp_shader serialize-8888 gm _ convex_poly_clip serialize-8888 gm _ extractalpha serialize-8888 gm _ filterbitmap_checkerboard_32_32_g8 serialize-8888 gm _ filterbitmap_image_mandrill_64 serialize-8888 gm _ shadows serialize-8888 gm _ simpleaaclip_aaclip serialize-8888 gm _ composeshader_bitmap serialize-8888 gm _ scaled_tilemodes_npot serialize-8888 gm _ scaled_tilemodes serialize-8888 gm _ typefacerendering_pfaMac serialize-8888 gm _ parsedpaths serialize-8888 gm _ ImageGeneratorExternal_rect serialize-8888 gm _ ImageGeneratorExternal_shader serialize-8888 gm _ shadow_utils serialize-8888 gm _ all_bitmap_configs serialize-8888 gm _ makecolorspace serialize-8888 gm _ analytic_antialias_convex serialize-8888 gm _ bleed_alpha_image serialize-8888 gm _ bleed_alpha_image_shader serialize-8888 gm _ verylargebitmap serialize-8888 gm _ verylarge_picture_image pic-8888 gm _ drawfilter pic-8888 gm _ image-cacherator-from-picture serialize-8888 gm _ image-cacherator-from-picture pic-8888 gm _ image-cacherator-from-raster serialize-8888 gm _ image-cacherator-from-raster pic-8888 gm _ image-cacherator-from-ctable serialize-8888 gm _ image-cacherator-from-ctable pic-8888 gm _ gamut serialize-8888 gm _ gamut pic-8888 gm _ complexclip4_bw serialize-8888 gm _ complexclip4_bw pic-8888 gm _ complexclip4_aa serialize-8888 gm _ complexclip4_aa tiles_rt-8888 gm _ complexclip4_bw tiles_rt-8888 gm _ complexclip4_aa --nonativeFonts --verbose; echo $? >/data/local/tmp/rc",
"set -x; /data/local/tmp/dm --resourcePath /sdcard/revenge_of_the_skiabot/resources --skps /sdcard/revenge_of_the_skiabot/skps --images /sdcard/revenge_of_the_skiabot/images/dm --colorImages /sdcard/revenge_of_the_skiabot/images/colorspace --nameByHash --properties gitHash abc123 builder Test-Android-Clang-Nexus7-CPU-Tegra3-arm-Release-All-Android buildbucket_build_id 123454321 swarming_bot_id skia-bot-123 swarming_task_id 123456 --svgs /sdcard/revenge_of_the_skiabot/svgs --key arch arm compiler Clang configuration Release cpu_or_gpu CPU cpu_or_gpu_value Tegra3 extra_config Android model Nexus7 os Android --uninterestingHashesFile /sdcard/revenge_of_the_skiabot/uninteresting_hashes.txt --writePath /sdcard/revenge_of_the_skiabot/dm_out --dont_write pdf --threads 2 --nogpu --config 8888 serialize-8888 tiles_rt-8888 pic-8888 --src tests gm image colorImage --blacklist _ test _ GrShape serialize-8888 gm _ bleed_image serialize-8888 gm _ c_gms serialize-8888 gm _ colortype serialize-8888 gm _ colortype_xfermodes serialize-8888 gm _ drawfilter serialize-8888 gm _ fontmgr_bounds_0.75_0 serialize-8888 gm _ fontmgr_bounds_1_-0.25 serialize-8888 gm _ fontmgr_bounds serialize-8888 gm _ fontmgr_match serialize-8888 gm _ fontmgr_iter serialize-8888 gm _ imagemasksubset serialize-8888 gm _ bitmapfilters serialize-8888 gm _ bitmapshaders serialize-8888 gm _ bleed serialize-8888 gm _ bleed_alpha_bmp serialize-8888 gm _ bleed_alpha_bmp_shader serialize-8888 gm _ convex_poly_clip serialize-8888 gm _ extractalpha serialize-8888 gm _ filterbitmap_checkerboard_32_32_g8 serialize-8888 gm _ filterbitmap_image_mandrill_64 serialize-8888 gm _ shadows serialize-8888 gm _ simpleaaclip_aaclip serialize-8888 gm _ composeshader_bitmap serialize-8888 gm _ scaled_tilemodes_npot serialize-8888 gm _ scaled_tilemodes serialize-8888 gm _ typefacerendering_pfaMac serialize-8888 gm _ parsedpaths serialize-8888 gm _ ImageGeneratorExternal_rect serialize-8888 gm _ ImageGeneratorExternal_shader serialize-8888 gm _ shadow_utils serialize-8888 gm _ all_bitmap_configs serialize-8888 gm _ makecolorspace serialize-8888 gm _ analytic_antialias_convex serialize-8888 gm _ bleed_alpha_image serialize-8888 gm _ bleed_alpha_image_shader serialize-8888 gm _ verylargebitmap serialize-8888 gm _ verylarge_picture_image pic-8888 gm _ drawfilter pic-8888 gm _ image-cacherator-from-picture serialize-8888 gm _ image-cacherator-from-picture pic-8888 gm _ image-cacherator-from-raster serialize-8888 gm _ image-cacherator-from-raster pic-8888 gm _ image-cacherator-from-ctable serialize-8888 gm _ image-cacherator-from-ctable pic-8888 gm _ gamut serialize-8888 gm _ gamut pic-8888 gm _ complexclip4_bw serialize-8888 gm _ complexclip4_bw pic-8888 gm _ complexclip4_aa serialize-8888 gm _ complexclip4_aa tiles_rt-8888 gm _ complexclip4_bw tiles_rt-8888 gm _ complexclip4_aa --nonativeFonts --verbose; echo $? >/data/local/tmp/rc",
"[START_DIR]/tmp/dm.sh"
],
"env": {

View File

@ -794,7 +794,7 @@
"--json-output",
"/path/to/tmp/json",
"copy",
"set -x; /data/local/tmp/dm --resourcePath /sdcard/revenge_of_the_skiabot/resources --skps /sdcard/revenge_of_the_skiabot/skps --images /sdcard/revenge_of_the_skiabot/images/dm --colorImages /sdcard/revenge_of_the_skiabot/images/colorspace --nameByHash --properties gitHash abc123 builder Test-Android-Clang-NexusPlayer-CPU-Moorefield-x86-Release-All-Android buildbucket_build_id 123454321 swarming_bot_id skia-bot-123 swarming_task_id 123456 --svgs /sdcard/revenge_of_the_skiabot/svgs --key arch x86 compiler Clang configuration Release cpu_or_gpu CPU cpu_or_gpu_value Moorefield extra_config Android model NexusPlayer os Android --uninterestingHashesFile /sdcard/revenge_of_the_skiabot/uninteresting_hashes.txt --writePath /sdcard/revenge_of_the_skiabot/dm_out --dont_write pdf --ignoreSigInt --nogpu --config 8888 srgb serialize-8888 tiles_rt-8888 pic-8888 --src tests gm image colorImage --blacklist _ test _ GrShape serialize-8888 gm _ bleed_image serialize-8888 gm _ c_gms serialize-8888 gm _ colortype serialize-8888 gm _ colortype_xfermodes serialize-8888 gm _ drawfilter serialize-8888 gm _ fontmgr_bounds_0.75_0 serialize-8888 gm _ fontmgr_bounds_1_-0.25 serialize-8888 gm _ fontmgr_bounds serialize-8888 gm _ fontmgr_match serialize-8888 gm _ fontmgr_iter serialize-8888 gm _ imagemasksubset serialize-8888 gm _ bitmapfilters serialize-8888 gm _ bitmapshaders serialize-8888 gm _ bleed serialize-8888 gm _ bleed_alpha_bmp serialize-8888 gm _ bleed_alpha_bmp_shader serialize-8888 gm _ convex_poly_clip serialize-8888 gm _ extractalpha serialize-8888 gm _ filterbitmap_checkerboard_32_32_g8 serialize-8888 gm _ filterbitmap_image_mandrill_64 serialize-8888 gm _ shadows serialize-8888 gm _ simpleaaclip_aaclip serialize-8888 gm _ composeshader_bitmap serialize-8888 gm _ scaled_tilemodes_npot serialize-8888 gm _ scaled_tilemodes serialize-8888 gm _ typefacerendering_pfaMac serialize-8888 gm _ parsedpaths serialize-8888 gm _ ImageGeneratorExternal_rect serialize-8888 gm _ ImageGeneratorExternal_shader serialize-8888 gm _ shadow_utils serialize-8888 gm _ all_bitmap_configs serialize-8888 gm _ makecolorspace serialize-8888 gm _ analytic_antialias_convex serialize-8888 gm _ bleed_alpha_image serialize-8888 gm _ bleed_alpha_image_shader serialize-8888 gm _ verylargebitmap serialize-8888 gm _ verylarge_picture_image pic-8888 gm _ drawfilter pic-8888 gm _ image-cacherator-from-picture serialize-8888 gm _ image-cacherator-from-picture pic-8888 gm _ image-cacherator-from-raster serialize-8888 gm _ image-cacherator-from-raster pic-8888 gm _ image-cacherator-from-ctable serialize-8888 gm _ image-cacherator-from-ctable pic-8888 gm _ gamut serialize-8888 gm _ gamut pic-8888 gm _ complexclip4_bw serialize-8888 gm _ complexclip4_bw pic-8888 gm _ complexclip4_aa serialize-8888 gm _ complexclip4_aa tiles_rt-8888 gm _ complexclip4_bw tiles_rt-8888 gm _ complexclip4_aa --noRAW_threading --nonativeFonts --verbose; echo $? >/data/local/tmp/rc",
"set -x; /data/local/tmp/dm --resourcePath /sdcard/revenge_of_the_skiabot/resources --skps /sdcard/revenge_of_the_skiabot/skps --images /sdcard/revenge_of_the_skiabot/images/dm --colorImages /sdcard/revenge_of_the_skiabot/images/colorspace --nameByHash --properties gitHash abc123 builder Test-Android-Clang-NexusPlayer-CPU-Moorefield-x86-Release-All-Android buildbucket_build_id 123454321 swarming_bot_id skia-bot-123 swarming_task_id 123456 --svgs /sdcard/revenge_of_the_skiabot/svgs --key arch x86 compiler Clang configuration Release cpu_or_gpu CPU cpu_or_gpu_value Moorefield extra_config Android model NexusPlayer os Android --uninterestingHashesFile /sdcard/revenge_of_the_skiabot/uninteresting_hashes.txt --writePath /sdcard/revenge_of_the_skiabot/dm_out --dont_write pdf --ignoreSigInt --nogpu --config 8888 serialize-8888 tiles_rt-8888 pic-8888 --src tests gm image colorImage --blacklist _ test _ GrShape serialize-8888 gm _ bleed_image serialize-8888 gm _ c_gms serialize-8888 gm _ colortype serialize-8888 gm _ colortype_xfermodes serialize-8888 gm _ drawfilter serialize-8888 gm _ fontmgr_bounds_0.75_0 serialize-8888 gm _ fontmgr_bounds_1_-0.25 serialize-8888 gm _ fontmgr_bounds serialize-8888 gm _ fontmgr_match serialize-8888 gm _ fontmgr_iter serialize-8888 gm _ imagemasksubset serialize-8888 gm _ bitmapfilters serialize-8888 gm _ bitmapshaders serialize-8888 gm _ bleed serialize-8888 gm _ bleed_alpha_bmp serialize-8888 gm _ bleed_alpha_bmp_shader serialize-8888 gm _ convex_poly_clip serialize-8888 gm _ extractalpha serialize-8888 gm _ filterbitmap_checkerboard_32_32_g8 serialize-8888 gm _ filterbitmap_image_mandrill_64 serialize-8888 gm _ shadows serialize-8888 gm _ simpleaaclip_aaclip serialize-8888 gm _ composeshader_bitmap serialize-8888 gm _ scaled_tilemodes_npot serialize-8888 gm _ scaled_tilemodes serialize-8888 gm _ typefacerendering_pfaMac serialize-8888 gm _ parsedpaths serialize-8888 gm _ ImageGeneratorExternal_rect serialize-8888 gm _ ImageGeneratorExternal_shader serialize-8888 gm _ shadow_utils serialize-8888 gm _ all_bitmap_configs serialize-8888 gm _ makecolorspace serialize-8888 gm _ analytic_antialias_convex serialize-8888 gm _ bleed_alpha_image serialize-8888 gm _ bleed_alpha_image_shader serialize-8888 gm _ verylargebitmap serialize-8888 gm _ verylarge_picture_image pic-8888 gm _ drawfilter pic-8888 gm _ image-cacherator-from-picture serialize-8888 gm _ image-cacherator-from-picture pic-8888 gm _ image-cacherator-from-raster serialize-8888 gm _ image-cacherator-from-raster pic-8888 gm _ image-cacherator-from-ctable serialize-8888 gm _ image-cacherator-from-ctable pic-8888 gm _ gamut serialize-8888 gm _ gamut pic-8888 gm _ complexclip4_bw serialize-8888 gm _ complexclip4_bw pic-8888 gm _ complexclip4_aa serialize-8888 gm _ complexclip4_aa tiles_rt-8888 gm _ complexclip4_bw tiles_rt-8888 gm _ complexclip4_aa --noRAW_threading --nonativeFonts --verbose; echo $? >/data/local/tmp/rc",
"[START_DIR]/tmp/dm.sh"
],
"env": {

View File

@ -178,13 +178,15 @@
"--nogpu",
"--config",
"8888",
"srgb",
"pdf",
"g8",
"565",
"f16",
"lite-8888",
"gbr-8888",
"srgb",
"srgbnl",
"esrgb",
"t8888",
"serialize-8888",
"tiles_rt-8888",

View File

@ -177,13 +177,15 @@
"--nogpu",
"--config",
"8888",
"srgb",
"pdf",
"g8",
"565",
"f16",
"lite-8888",
"gbr-8888",
"srgb",
"srgbnl",
"esrgb",
"t8888",
"serialize-8888",
"tiles_rt-8888",

View File

@ -262,13 +262,15 @@
"--nogpu",
"--config",
"8888",
"srgb",
"pdf",
"g8",
"565",
"f16",
"lite-8888",
"gbr-8888",
"srgb",
"srgbnl",
"esrgb",
"serialize-8888",
"tiles_rt-8888",
"pic-8888",

View File

@ -183,13 +183,15 @@
"10",
"--config",
"8888",
"srgb",
"pdf",
"g8",
"565",
"f16",
"lite-8888",
"gbr-8888",
"srgb",
"srgbnl",
"esrgb",
"serialize-8888",
"tiles_rt-8888",
"pic-8888",

View File

@ -260,7 +260,6 @@
"--nogpu",
"--config",
"8888",
"srgb",
"--src",
"gm",
"image",

View File

@ -178,13 +178,15 @@
"--nogpu",
"--config",
"8888",
"srgb",
"pdf",
"g8",
"565",
"f16",
"lite-8888",
"gbr-8888",
"srgb",
"srgbnl",
"esrgb",
"t8888",
"serialize-8888",
"tiles_rt-8888",

View File

@ -260,13 +260,15 @@
"--nogpu",
"--config",
"8888",
"srgb",
"pdf",
"g8",
"565",
"f16",
"lite-8888",
"gbr-8888",
"srgb",
"srgbnl",
"esrgb",
"serialize-8888",
"tiles_rt-8888",
"pic-8888",

View File

@ -258,13 +258,15 @@
"--nogpu",
"--config",
"8888",
"srgb",
"pdf",
"g8",
"565",
"f16",
"lite-8888",
"gbr-8888",
"srgb",
"srgbnl",
"esrgb",
"serialize-8888",
"tiles_rt-8888",
"pic-8888",

View File

@ -253,7 +253,6 @@
"--nogpu",
"--config",
"8888",
"srgb",
"pdf",
"serialize-8888",
"tiles_rt-8888",

View File

@ -255,7 +255,6 @@
"--nogpu",
"--config",
"8888",
"srgb",
"pdf",
"serialize-8888",
"tiles_rt-8888",

View File

@ -258,13 +258,15 @@
"--nogpu",
"--config",
"8888",
"srgb",
"pdf",
"g8",
"565",
"f16",
"lite-8888",
"gbr-8888",
"srgb",
"srgbnl",
"esrgb",
"serialize-8888",
"tiles_rt-8888",
"pic-8888",

View File

@ -259,13 +259,15 @@
"--nogpu",
"--config",
"8888",
"srgb",
"pdf",
"g8",
"565",
"f16",
"lite-8888",
"gbr-8888",
"srgb",
"srgbnl",
"esrgb",
"serialize-8888",
"tiles_rt-8888",
"pic-8888",

View File

@ -92,7 +92,7 @@ def dm_flags(api, bot):
# These are the canonical configs that we would ideally run on all bots. We
# may opt out or substitute some below for specific bots
configs.extend(['8888', 'srgb', 'pdf'])
configs.extend(['8888', 'pdf'])
# Runs out of memory on Android bots. Everyone else seems fine.
if 'Android' in bot:
@ -104,6 +104,9 @@ def dm_flags(api, bot):
configs.extend(['f16'])
configs.extend(['lite-8888']) # Experimental display list.
configs.extend(['gbr-8888'])
configs.extend(['srgb'])
configs.extend(['srgbnl'])
configs.extend(['esrgb'])
if 'SAN' in bot:
configs.extend(['t8888'])
@ -115,7 +118,7 @@ def dm_flags(api, bot):
# This bot only differs from vanilla CPU bots in 8888 config.
if 'SK_FORCE_RASTER_PIPELINE_BLITTER' in bot:
configs = ['8888', 'srgb']
configs = ['8888']
if 'FSAA' in bot or 'FAAA' in bot or 'FDAA' in bot:
# Scan converters shouldn't really be sensitive to different color

View File

@ -169,7 +169,7 @@ bool SkCodec::conversionSupported(const SkImageInfo& dst, SkColorType srcColor,
case kBGRA_8888_SkColorType:
return true;
case kRGBA_F16_SkColorType:
return dst.colorSpace() && dst.colorSpace()->gammaIsLinear();
return dst.colorSpace();
case kRGB_565_SkColorType:
return srcIsOpaque;
case kGray_8_SkColorType:

View File

@ -192,10 +192,6 @@ bool SkHeifCodec::setOutputColorFormat(const SkImageInfo& dstInfo) {
case kRGBA_F16_SkColorType:
SkASSERT(this->colorXform());
if (!dstInfo.colorSpace()->gammaIsLinear()) {
return false;
}
return fHeifDecoder->setOutputColor(kHeifColorFormat_RGBA_8888);
default:

View File

@ -433,11 +433,6 @@ bool SkJpegCodec::setOutputColorSpace(const SkImageInfo& dstInfo) {
break;
case kRGBA_F16_SkColorType:
SkASSERT(this->colorXform());
if (!dstInfo.colorSpace()->gammaIsLinear()) {
return false;
}
fDecoderMgr->dinfo()->out_color_space = JCS_EXT_RGBA;
break;
default:

View File

@ -29,7 +29,7 @@ static inline bool valid_color_type(const SkImageInfo& dstInfo) {
case kRGB_565_SkColorType:
return true;
case kRGBA_F16_SkColorType:
return dstInfo.colorSpace() && dstInfo.colorSpace()->gammaIsLinear();
return dstInfo.colorSpace();
default:
return false;
}

View File

@ -500,6 +500,10 @@ bool SkColorSpace::Equals(const SkColorSpace* src, const SkColorSpace* dst) {
return false;
}
if (src->nonlinearBlending() != dst->nonlinearBlending()) {
return false;
}
const SkData* srcData = src->onProfileData();
const SkData* dstData = dst->onProfileData();
if (srcData || dstData) {

View File

@ -119,3 +119,13 @@ void SkColorSpace_XYZ::toDstGammaTables(const uint8_t* tables[3], sk_sp<SkData>*
tables[1] = fToDstGammaTables[1];
tables[2] = fToDstGammaTables[2];
}
sk_sp<SkColorSpace> SkColorSpace_XYZ::makeNonlinearBlending() const {
if (this->nonlinearBlending()) {
return sk_ref_sp(const_cast<SkColorSpace_XYZ*>(this));
}
auto cs = sk_make_sp<SkColorSpace_XYZ>(fGammaNamed, fGammas, fToXYZD50, fProfileData);
cs->fNonlinearBlending = true;
return cs;
}

View File

@ -23,12 +23,14 @@ public:
bool onGammaCloseToSRGB() const override;
bool onGammaIsLinear() const override;
bool onIsNumericalTransferFn(SkColorSpaceTransferFn* coeffs) const override;
bool nonlinearBlending() const override { return fNonlinearBlending; }
const SkData* onProfileData() const override { return fProfileData.get(); }
sk_sp<SkColorSpace> makeLinearGamma() const override;
sk_sp<SkColorSpace> makeSRGBGamma() const override;
sk_sp<SkColorSpace> makeColorSpin() const override;
sk_sp<SkColorSpace> makeNonlinearBlending() const override;
SkGammaNamed onGammaNamed() const override { return fGammaNamed; }
@ -56,6 +58,8 @@ private:
mutable const uint8_t* fToDstGammaTables[3];
mutable SkOnce fToDstGammaOnce;
bool fNonlinearBlending = false;
friend class SkColorSpace;
friend class ColorSpaceXformTest;
};

View File

@ -23,10 +23,6 @@ SkPictureImageGenerator::Make(const SkISize& size, sk_sp<SkPicture> picture, con
return nullptr;
}
if (SkImage::BitDepth::kF16 == bitDepth && (!colorSpace || !colorSpace->gammaIsLinear())) {
return nullptr;
}
if (colorSpace && (!colorSpace->gammaCloseToSRGB() && !colorSpace->gammaIsLinear())) {
return nullptr;
}

View File

@ -300,6 +300,7 @@ GrPixelConfig GrRenderableConfigForColorSpace(const SkColorSpace* colorSpace) {
if (!colorSpace) {
return kRGBA_8888_GrPixelConfig;
} else if (colorSpace->gammaIsLinear()) {
// TODO
return kRGBA_half_GrPixelConfig;
} else if (colorSpace->gammaCloseToSRGB()) {
return kSRGBA_8888_GrPixelConfig;

View File

@ -271,7 +271,7 @@ bool SkSurface_Gpu::onDraw(const SkDeferredDisplayList* ddl) {
bool SkSurface_Gpu::Valid(const SkImageInfo& info) {
switch (info.colorType()) {
case kRGBA_F16_SkColorType:
return (!info.colorSpace()) || info.colorSpace()->gammaIsLinear();
return true;
case kRGBA_8888_SkColorType:
case kBGRA_8888_SkColorType:
return !info.colorSpace() || info.colorSpace()->gammaCloseToSRGB();
@ -283,7 +283,7 @@ bool SkSurface_Gpu::Valid(const SkImageInfo& info) {
bool SkSurface_Gpu::Valid(const GrCaps* caps, GrPixelConfig config, SkColorSpace* colorSpace) {
switch (config) {
case kRGBA_half_GrPixelConfig:
return (!colorSpace) || colorSpace->gammaIsLinear();
return true;
case kSRGBA_8888_GrPixelConfig:
case kSBGRA_8888_GrPixelConfig:
return caps->srgbSupport() && colorSpace && colorSpace->gammaCloseToSRGB();

View File

@ -68,9 +68,6 @@ bool SkSurfaceValidateRasterInfo(const SkImageInfo& info, size_t rowBytes) {
}
break;
case kRGBA_F16_SkColorType:
if (info.colorSpace() && (!info.colorSpace()->gammaIsLinear())) {
return false;
}
break;
default:
return false;

View File

@ -118,7 +118,7 @@ bool SkJpegEncoderMgr::setParams(const SkImageInfo& srcInfo, const SkJpegEncoder
numComponents = 1;
break;
case kRGBA_F16_SkColorType:
if (!srcInfo.colorSpace() || !srcInfo.colorSpace()->gammaIsLinear() ||
if (!srcInfo.colorSpace() ||
SkTransferFunctionBehavior::kRespect != options.fBlendBehavior) {
return false;
}

View File

@ -106,7 +106,7 @@ bool SkPngEncoderMgr::setHeader(const SkImageInfo& srcInfo, const SkPngEncoder::
int bitDepth = 8;
switch (srcInfo.colorType()) {
case kRGBA_F16_SkColorType:
SkASSERT(srcInfo.colorSpace() && srcInfo.colorSpace()->gammaIsLinear());
SkASSERT(srcInfo.colorSpace());
sigBit.red = 16;
sigBit.green = 16;
sigBit.blue = 16;

View File

@ -88,10 +88,6 @@ static transform_scanline_proc choose_proc(const SkImageInfo& info,
case kGray_8_SkColorType:
return transform_scanline_gray;
case kRGBA_F16_SkColorType:
if (!info.colorSpace() || !info.colorSpace()->gammaIsLinear()) {
return nullptr;
}
switch (info.alphaType()) {
case kOpaque_SkAlphaType:
case kUnpremul_SkAlphaType:

View File

@ -1144,22 +1144,22 @@ static void test_conversion_possible(skiatest::Reporter* r, const char* path,
SkBitmap bm;
bm.allocPixels(infoF16);
SkCodec::Result result = codec->getPixels(infoF16, bm.getPixels(), bm.rowBytes());
REPORTER_ASSERT(r, SkCodec::kInvalidConversion == result);
REPORTER_ASSERT(r, SkCodec::kSuccess == result);
result = codec->startScanlineDecode(infoF16);
if (supportsScanlineDecoder) {
REPORTER_ASSERT(r, SkCodec::kInvalidConversion == result);
REPORTER_ASSERT(r, SkCodec::kSuccess == result);
} else {
REPORTER_ASSERT(r, SkCodec::kUnimplemented == result
|| SkCodec::kInvalidConversion == result);
|| SkCodec::kSuccess == result);
}
result = codec->startIncrementalDecode(infoF16, bm.getPixels(), bm.rowBytes());
if (supportsIncrementalDecoder) {
REPORTER_ASSERT(r, SkCodec::kInvalidConversion == result);
REPORTER_ASSERT(r, SkCodec::kSuccess == result);
} else {
REPORTER_ASSERT(r, SkCodec::kUnimplemented == result
|| SkCodec::kInvalidConversion == result);
|| SkCodec::kSuccess == result);
}
infoF16 = infoF16.makeColorSpace(infoF16.colorSpace()->makeLinearGamma());

View File

@ -0,0 +1,76 @@
/*
* Copyright 2018 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "Test.h"
#include "SkHalf.h"
#include "SkSurface.h"
#include "SkCanvas.h"
DEF_TEST(NonlinearBlending, r) {
// First check our familiar basics with linear F16.
{
auto info = SkImageInfo::Make(1,1, kRGBA_F16_SkColorType, kPremul_SkAlphaType,
SkColorSpace::MakeSRGBLinear());
auto surface = SkSurface::MakeRaster(info);
surface->getCanvas()->clear(0xff808080);
uint64_t pix;
REPORTER_ASSERT(r, surface->readPixels(info, &pix, sizeof(pix),0,0));
// 0x80 in sRGB is ≈ 0.22 linear.
REPORTER_ASSERT(r, SkHalfToFloat(pix & 0xffff) < 0.25f);
}
// Test that we support sRGB-encoded F16. This is somewhat new.
{
auto info = SkImageInfo::Make(1,1, kRGBA_F16_SkColorType, kPremul_SkAlphaType,
SkColorSpace::MakeSRGB());
auto surface = SkSurface::MakeRaster(info);
surface->getCanvas()->clear(0xff808080);
uint64_t pix;
REPORTER_ASSERT(r, surface->readPixels(info, &pix, sizeof(pix),0,0));
// 0x80 sRGB is ≈ 0.501.
REPORTER_ASSERT(r, SkHalfToFloat(pix & 0xffff) >= 0.5f);
}
// Since we're only clear()ing, this should work the same as the last block.
{
auto info = SkImageInfo::Make(1,1, kRGBA_F16_SkColorType, kPremul_SkAlphaType,
SkColorSpace::MakeSRGB()->makeNonlinearBlending());
auto surface = SkSurface::MakeRaster(info);
surface->getCanvas()->clear(0xff808080);
uint64_t pix;
REPORTER_ASSERT(r, surface->readPixels(info, &pix, sizeof(pix),0,0));
// 0x80 sRGB is ≈ 0.501.
REPORTER_ASSERT(r, SkHalfToFloat(pix & 0xffff) >= 0.5f);
}
// This won't work until we actually support color spaces with non-linear blending.
if (0) {
auto info = SkImageInfo::Make(1,1, kRGBA_F16_SkColorType, kPremul_SkAlphaType,
SkColorSpace::MakeSRGB()->makeNonlinearBlending());
auto surface = SkSurface::MakeRaster(info);
surface->getCanvas()->clear(SK_ColorWHITE);
SkPaint p;
p.setColor(0x80000000);
surface->getCanvas()->drawPaint(p);
uint64_t pix;
REPORTER_ASSERT(r, surface->readPixels(info, &pix, sizeof(pix),0,0));
// 0x80 sRGB is ≈ 0.501. A likely failure here is ~0.75, linear blending.
REPORTER_ASSERT(r, SkHalfToFloat(pix & 0xffff) >= 0.45f &&
SkHalfToFloat(pix & 0xffff) <= 0.55f);
}
}

View File

@ -951,8 +951,8 @@ static void test_surface_creation_and_snapshot_with_color_space(
{ kN32_SkColorType, oddColorSpace, false, "N32-odd" },
{ kRGBA_F16_SkColorType, nullptr, true, "F16-nullptr" },
{ kRGBA_F16_SkColorType, linearColorSpace, true, "F16-linear" },
{ kRGBA_F16_SkColorType, srgbColorSpace, false, "F16-srgb" },
{ kRGBA_F16_SkColorType, oddColorSpace, false, "F16-odd" },
{ kRGBA_F16_SkColorType, srgbColorSpace, true, "F16-srgb" },
{ kRGBA_F16_SkColorType, oddColorSpace, true, "F16-odd" },
{ kRGB_565_SkColorType, srgbColorSpace, false, "565-srgb" },
{ kAlpha_8_SkColorType, srgbColorSpace, false, "A8-srgb" },
{ kRGBA_1010102_SkColorType, nullptr, true, "1010102-nullptr" },