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:
parent
024615e975
commit
ce4cf72e34
@ -903,6 +903,7 @@ static Sink* create_sink(const GrContextOptions& grCtxOptions, const SkCommandLi
|
|||||||
if (FLAGS_cpu) {
|
if (FLAGS_cpu) {
|
||||||
auto srgbColorSpace = SkColorSpace::MakeSRGB();
|
auto srgbColorSpace = SkColorSpace::MakeSRGB();
|
||||||
auto srgbLinearColorSpace = SkColorSpace::MakeSRGBLinear();
|
auto srgbLinearColorSpace = SkColorSpace::MakeSRGBLinear();
|
||||||
|
auto esrgb = SkColorSpace::MakeSRGB()->makeNonlinearBlending();
|
||||||
|
|
||||||
SINK("g8", RasterSink, kGray_8_SkColorType);
|
SINK("g8", RasterSink, kGray_8_SkColorType);
|
||||||
SINK("565", RasterSink, kRGB_565_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("1010102", RasterSink, kRGBA_1010102_SkColorType);
|
||||||
SINK("101010x", RasterSink, kRGB_101010x_SkColorType);
|
SINK("101010x", RasterSink, kRGB_101010x_SkColorType);
|
||||||
SINK("f16", RasterSink, kRGBA_F16_SkColorType, srgbLinearColorSpace);
|
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("t8888", ThreadedSink, kN32_SkColorType);
|
||||||
SINK("pdf", PDFSink, false, SK_ScalarDefaultRasterDPI);
|
SINK("pdf", PDFSink, false, SK_ScalarDefaultRasterDPI);
|
||||||
SINK("skp", SKPSink);
|
SINK("skp", SKPSink);
|
||||||
|
@ -166,6 +166,7 @@ protected:
|
|||||||
canvas->imageInfo().refColorSpace());
|
canvas->imageInfo().refColorSpace());
|
||||||
}
|
}
|
||||||
surf = SkSurface::MakeRaster(info);
|
surf = SkSurface::MakeRaster(info);
|
||||||
|
SkASSERT(surf);
|
||||||
}
|
}
|
||||||
canvas->scale(5.f, 5.f);
|
canvas->scale(5.f, 5.f);
|
||||||
canvas->translate(67.f, 10.f);
|
canvas->translate(67.f, 10.f);
|
||||||
|
@ -141,6 +141,7 @@ tests_sources = [
|
|||||||
"$_tests/MessageBusTest.cpp",
|
"$_tests/MessageBusTest.cpp",
|
||||||
"$_tests/MetaDataTest.cpp",
|
"$_tests/MetaDataTest.cpp",
|
||||||
"$_tests/MipMapTest.cpp",
|
"$_tests/MipMapTest.cpp",
|
||||||
|
"$_tests/NonlinearBlendingTest.cpp",
|
||||||
"$_tests/OnceTest.cpp",
|
"$_tests/OnceTest.cpp",
|
||||||
"$_tests/OSPathTest.cpp",
|
"$_tests/OSPathTest.cpp",
|
||||||
"$_tests/OverAlignedTest.cpp",
|
"$_tests/OverAlignedTest.cpp",
|
||||||
|
@ -259,6 +259,9 @@ public:
|
|||||||
*/
|
*/
|
||||||
const SkData* profileData() const { return this->onProfileData(); }
|
const SkData* profileData() const { return this->onProfileData(); }
|
||||||
|
|
||||||
|
virtual bool nonlinearBlending() const { return false; }
|
||||||
|
virtual sk_sp<SkColorSpace> makeNonlinearBlending() const { return nullptr; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual const SkMatrix44* onToXYZD50() const = 0;
|
virtual const SkMatrix44* onToXYZD50() const = 0;
|
||||||
virtual uint32_t onToXYZD50Hash() const = 0;
|
virtual uint32_t onToXYZD50Hash() const = 0;
|
||||||
|
@ -115,11 +115,6 @@ static inline bool SkImageInfoIsValidCommon(const SkImageInfo& info) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (kRGBA_F16_SkColorType == info.colorType() &&
|
|
||||||
(info.colorSpace() && (!info.colorSpace()->gammaIsLinear()))) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -945,7 +945,7 @@
|
|||||||
"--json-output",
|
"--json-output",
|
||||||
"/path/to/tmp/json",
|
"/path/to/tmp/json",
|
||||||
"copy",
|
"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"
|
"[START_DIR]/tmp/dm.sh"
|
||||||
],
|
],
|
||||||
"env": {
|
"env": {
|
||||||
|
@ -750,7 +750,7 @@
|
|||||||
"--json-output",
|
"--json-output",
|
||||||
"/path/to/tmp/json",
|
"/path/to/tmp/json",
|
||||||
"copy",
|
"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"
|
"[START_DIR]/tmp/dm.sh"
|
||||||
],
|
],
|
||||||
"env": {
|
"env": {
|
||||||
|
@ -794,7 +794,7 @@
|
|||||||
"--json-output",
|
"--json-output",
|
||||||
"/path/to/tmp/json",
|
"/path/to/tmp/json",
|
||||||
"copy",
|
"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"
|
"[START_DIR]/tmp/dm.sh"
|
||||||
],
|
],
|
||||||
"env": {
|
"env": {
|
||||||
|
@ -178,13 +178,15 @@
|
|||||||
"--nogpu",
|
"--nogpu",
|
||||||
"--config",
|
"--config",
|
||||||
"8888",
|
"8888",
|
||||||
"srgb",
|
|
||||||
"pdf",
|
"pdf",
|
||||||
"g8",
|
"g8",
|
||||||
"565",
|
"565",
|
||||||
"f16",
|
"f16",
|
||||||
"lite-8888",
|
"lite-8888",
|
||||||
"gbr-8888",
|
"gbr-8888",
|
||||||
|
"srgb",
|
||||||
|
"srgbnl",
|
||||||
|
"esrgb",
|
||||||
"t8888",
|
"t8888",
|
||||||
"serialize-8888",
|
"serialize-8888",
|
||||||
"tiles_rt-8888",
|
"tiles_rt-8888",
|
||||||
|
@ -177,13 +177,15 @@
|
|||||||
"--nogpu",
|
"--nogpu",
|
||||||
"--config",
|
"--config",
|
||||||
"8888",
|
"8888",
|
||||||
"srgb",
|
|
||||||
"pdf",
|
"pdf",
|
||||||
"g8",
|
"g8",
|
||||||
"565",
|
"565",
|
||||||
"f16",
|
"f16",
|
||||||
"lite-8888",
|
"lite-8888",
|
||||||
"gbr-8888",
|
"gbr-8888",
|
||||||
|
"srgb",
|
||||||
|
"srgbnl",
|
||||||
|
"esrgb",
|
||||||
"t8888",
|
"t8888",
|
||||||
"serialize-8888",
|
"serialize-8888",
|
||||||
"tiles_rt-8888",
|
"tiles_rt-8888",
|
||||||
|
@ -262,13 +262,15 @@
|
|||||||
"--nogpu",
|
"--nogpu",
|
||||||
"--config",
|
"--config",
|
||||||
"8888",
|
"8888",
|
||||||
"srgb",
|
|
||||||
"pdf",
|
"pdf",
|
||||||
"g8",
|
"g8",
|
||||||
"565",
|
"565",
|
||||||
"f16",
|
"f16",
|
||||||
"lite-8888",
|
"lite-8888",
|
||||||
"gbr-8888",
|
"gbr-8888",
|
||||||
|
"srgb",
|
||||||
|
"srgbnl",
|
||||||
|
"esrgb",
|
||||||
"serialize-8888",
|
"serialize-8888",
|
||||||
"tiles_rt-8888",
|
"tiles_rt-8888",
|
||||||
"pic-8888",
|
"pic-8888",
|
||||||
|
@ -183,13 +183,15 @@
|
|||||||
"10",
|
"10",
|
||||||
"--config",
|
"--config",
|
||||||
"8888",
|
"8888",
|
||||||
"srgb",
|
|
||||||
"pdf",
|
"pdf",
|
||||||
"g8",
|
"g8",
|
||||||
"565",
|
"565",
|
||||||
"f16",
|
"f16",
|
||||||
"lite-8888",
|
"lite-8888",
|
||||||
"gbr-8888",
|
"gbr-8888",
|
||||||
|
"srgb",
|
||||||
|
"srgbnl",
|
||||||
|
"esrgb",
|
||||||
"serialize-8888",
|
"serialize-8888",
|
||||||
"tiles_rt-8888",
|
"tiles_rt-8888",
|
||||||
"pic-8888",
|
"pic-8888",
|
||||||
|
@ -260,7 +260,6 @@
|
|||||||
"--nogpu",
|
"--nogpu",
|
||||||
"--config",
|
"--config",
|
||||||
"8888",
|
"8888",
|
||||||
"srgb",
|
|
||||||
"--src",
|
"--src",
|
||||||
"gm",
|
"gm",
|
||||||
"image",
|
"image",
|
||||||
|
@ -178,13 +178,15 @@
|
|||||||
"--nogpu",
|
"--nogpu",
|
||||||
"--config",
|
"--config",
|
||||||
"8888",
|
"8888",
|
||||||
"srgb",
|
|
||||||
"pdf",
|
"pdf",
|
||||||
"g8",
|
"g8",
|
||||||
"565",
|
"565",
|
||||||
"f16",
|
"f16",
|
||||||
"lite-8888",
|
"lite-8888",
|
||||||
"gbr-8888",
|
"gbr-8888",
|
||||||
|
"srgb",
|
||||||
|
"srgbnl",
|
||||||
|
"esrgb",
|
||||||
"t8888",
|
"t8888",
|
||||||
"serialize-8888",
|
"serialize-8888",
|
||||||
"tiles_rt-8888",
|
"tiles_rt-8888",
|
||||||
|
@ -260,13 +260,15 @@
|
|||||||
"--nogpu",
|
"--nogpu",
|
||||||
"--config",
|
"--config",
|
||||||
"8888",
|
"8888",
|
||||||
"srgb",
|
|
||||||
"pdf",
|
"pdf",
|
||||||
"g8",
|
"g8",
|
||||||
"565",
|
"565",
|
||||||
"f16",
|
"f16",
|
||||||
"lite-8888",
|
"lite-8888",
|
||||||
"gbr-8888",
|
"gbr-8888",
|
||||||
|
"srgb",
|
||||||
|
"srgbnl",
|
||||||
|
"esrgb",
|
||||||
"serialize-8888",
|
"serialize-8888",
|
||||||
"tiles_rt-8888",
|
"tiles_rt-8888",
|
||||||
"pic-8888",
|
"pic-8888",
|
||||||
|
@ -258,13 +258,15 @@
|
|||||||
"--nogpu",
|
"--nogpu",
|
||||||
"--config",
|
"--config",
|
||||||
"8888",
|
"8888",
|
||||||
"srgb",
|
|
||||||
"pdf",
|
"pdf",
|
||||||
"g8",
|
"g8",
|
||||||
"565",
|
"565",
|
||||||
"f16",
|
"f16",
|
||||||
"lite-8888",
|
"lite-8888",
|
||||||
"gbr-8888",
|
"gbr-8888",
|
||||||
|
"srgb",
|
||||||
|
"srgbnl",
|
||||||
|
"esrgb",
|
||||||
"serialize-8888",
|
"serialize-8888",
|
||||||
"tiles_rt-8888",
|
"tiles_rt-8888",
|
||||||
"pic-8888",
|
"pic-8888",
|
||||||
|
@ -253,7 +253,6 @@
|
|||||||
"--nogpu",
|
"--nogpu",
|
||||||
"--config",
|
"--config",
|
||||||
"8888",
|
"8888",
|
||||||
"srgb",
|
|
||||||
"pdf",
|
"pdf",
|
||||||
"serialize-8888",
|
"serialize-8888",
|
||||||
"tiles_rt-8888",
|
"tiles_rt-8888",
|
||||||
|
@ -255,7 +255,6 @@
|
|||||||
"--nogpu",
|
"--nogpu",
|
||||||
"--config",
|
"--config",
|
||||||
"8888",
|
"8888",
|
||||||
"srgb",
|
|
||||||
"pdf",
|
"pdf",
|
||||||
"serialize-8888",
|
"serialize-8888",
|
||||||
"tiles_rt-8888",
|
"tiles_rt-8888",
|
||||||
|
@ -258,13 +258,15 @@
|
|||||||
"--nogpu",
|
"--nogpu",
|
||||||
"--config",
|
"--config",
|
||||||
"8888",
|
"8888",
|
||||||
"srgb",
|
|
||||||
"pdf",
|
"pdf",
|
||||||
"g8",
|
"g8",
|
||||||
"565",
|
"565",
|
||||||
"f16",
|
"f16",
|
||||||
"lite-8888",
|
"lite-8888",
|
||||||
"gbr-8888",
|
"gbr-8888",
|
||||||
|
"srgb",
|
||||||
|
"srgbnl",
|
||||||
|
"esrgb",
|
||||||
"serialize-8888",
|
"serialize-8888",
|
||||||
"tiles_rt-8888",
|
"tiles_rt-8888",
|
||||||
"pic-8888",
|
"pic-8888",
|
||||||
|
@ -259,13 +259,15 @@
|
|||||||
"--nogpu",
|
"--nogpu",
|
||||||
"--config",
|
"--config",
|
||||||
"8888",
|
"8888",
|
||||||
"srgb",
|
|
||||||
"pdf",
|
"pdf",
|
||||||
"g8",
|
"g8",
|
||||||
"565",
|
"565",
|
||||||
"f16",
|
"f16",
|
||||||
"lite-8888",
|
"lite-8888",
|
||||||
"gbr-8888",
|
"gbr-8888",
|
||||||
|
"srgb",
|
||||||
|
"srgbnl",
|
||||||
|
"esrgb",
|
||||||
"serialize-8888",
|
"serialize-8888",
|
||||||
"tiles_rt-8888",
|
"tiles_rt-8888",
|
||||||
"pic-8888",
|
"pic-8888",
|
||||||
|
@ -92,7 +92,7 @@ def dm_flags(api, bot):
|
|||||||
|
|
||||||
# These are the canonical configs that we would ideally run on all bots. We
|
# These are the canonical configs that we would ideally run on all bots. We
|
||||||
# may opt out or substitute some below for specific bots
|
# 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.
|
# Runs out of memory on Android bots. Everyone else seems fine.
|
||||||
if 'Android' in bot:
|
if 'Android' in bot:
|
||||||
@ -104,6 +104,9 @@ def dm_flags(api, bot):
|
|||||||
configs.extend(['f16'])
|
configs.extend(['f16'])
|
||||||
configs.extend(['lite-8888']) # Experimental display list.
|
configs.extend(['lite-8888']) # Experimental display list.
|
||||||
configs.extend(['gbr-8888'])
|
configs.extend(['gbr-8888'])
|
||||||
|
configs.extend(['srgb'])
|
||||||
|
configs.extend(['srgbnl'])
|
||||||
|
configs.extend(['esrgb'])
|
||||||
|
|
||||||
if 'SAN' in bot:
|
if 'SAN' in bot:
|
||||||
configs.extend(['t8888'])
|
configs.extend(['t8888'])
|
||||||
@ -115,7 +118,7 @@ def dm_flags(api, bot):
|
|||||||
|
|
||||||
# This bot only differs from vanilla CPU bots in 8888 config.
|
# This bot only differs from vanilla CPU bots in 8888 config.
|
||||||
if 'SK_FORCE_RASTER_PIPELINE_BLITTER' in bot:
|
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:
|
if 'FSAA' in bot or 'FAAA' in bot or 'FDAA' in bot:
|
||||||
# Scan converters shouldn't really be sensitive to different color
|
# Scan converters shouldn't really be sensitive to different color
|
||||||
|
@ -169,7 +169,7 @@ bool SkCodec::conversionSupported(const SkImageInfo& dst, SkColorType srcColor,
|
|||||||
case kBGRA_8888_SkColorType:
|
case kBGRA_8888_SkColorType:
|
||||||
return true;
|
return true;
|
||||||
case kRGBA_F16_SkColorType:
|
case kRGBA_F16_SkColorType:
|
||||||
return dst.colorSpace() && dst.colorSpace()->gammaIsLinear();
|
return dst.colorSpace();
|
||||||
case kRGB_565_SkColorType:
|
case kRGB_565_SkColorType:
|
||||||
return srcIsOpaque;
|
return srcIsOpaque;
|
||||||
case kGray_8_SkColorType:
|
case kGray_8_SkColorType:
|
||||||
|
@ -192,10 +192,6 @@ bool SkHeifCodec::setOutputColorFormat(const SkImageInfo& dstInfo) {
|
|||||||
|
|
||||||
case kRGBA_F16_SkColorType:
|
case kRGBA_F16_SkColorType:
|
||||||
SkASSERT(this->colorXform());
|
SkASSERT(this->colorXform());
|
||||||
|
|
||||||
if (!dstInfo.colorSpace()->gammaIsLinear()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return fHeifDecoder->setOutputColor(kHeifColorFormat_RGBA_8888);
|
return fHeifDecoder->setOutputColor(kHeifColorFormat_RGBA_8888);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -433,11 +433,6 @@ bool SkJpegCodec::setOutputColorSpace(const SkImageInfo& dstInfo) {
|
|||||||
break;
|
break;
|
||||||
case kRGBA_F16_SkColorType:
|
case kRGBA_F16_SkColorType:
|
||||||
SkASSERT(this->colorXform());
|
SkASSERT(this->colorXform());
|
||||||
|
|
||||||
if (!dstInfo.colorSpace()->gammaIsLinear()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
fDecoderMgr->dinfo()->out_color_space = JCS_EXT_RGBA;
|
fDecoderMgr->dinfo()->out_color_space = JCS_EXT_RGBA;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -29,7 +29,7 @@ static inline bool valid_color_type(const SkImageInfo& dstInfo) {
|
|||||||
case kRGB_565_SkColorType:
|
case kRGB_565_SkColorType:
|
||||||
return true;
|
return true;
|
||||||
case kRGBA_F16_SkColorType:
|
case kRGBA_F16_SkColorType:
|
||||||
return dstInfo.colorSpace() && dstInfo.colorSpace()->gammaIsLinear();
|
return dstInfo.colorSpace();
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -500,6 +500,10 @@ bool SkColorSpace::Equals(const SkColorSpace* src, const SkColorSpace* dst) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (src->nonlinearBlending() != dst->nonlinearBlending()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
const SkData* srcData = src->onProfileData();
|
const SkData* srcData = src->onProfileData();
|
||||||
const SkData* dstData = dst->onProfileData();
|
const SkData* dstData = dst->onProfileData();
|
||||||
if (srcData || dstData) {
|
if (srcData || dstData) {
|
||||||
|
@ -119,3 +119,13 @@ void SkColorSpace_XYZ::toDstGammaTables(const uint8_t* tables[3], sk_sp<SkData>*
|
|||||||
tables[1] = fToDstGammaTables[1];
|
tables[1] = fToDstGammaTables[1];
|
||||||
tables[2] = fToDstGammaTables[2];
|
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;
|
||||||
|
}
|
||||||
|
@ -23,12 +23,14 @@ public:
|
|||||||
bool onGammaCloseToSRGB() const override;
|
bool onGammaCloseToSRGB() const override;
|
||||||
bool onGammaIsLinear() const override;
|
bool onGammaIsLinear() const override;
|
||||||
bool onIsNumericalTransferFn(SkColorSpaceTransferFn* coeffs) const override;
|
bool onIsNumericalTransferFn(SkColorSpaceTransferFn* coeffs) const override;
|
||||||
|
bool nonlinearBlending() const override { return fNonlinearBlending; }
|
||||||
|
|
||||||
const SkData* onProfileData() const override { return fProfileData.get(); }
|
const SkData* onProfileData() const override { return fProfileData.get(); }
|
||||||
|
|
||||||
sk_sp<SkColorSpace> makeLinearGamma() const override;
|
sk_sp<SkColorSpace> makeLinearGamma() const override;
|
||||||
sk_sp<SkColorSpace> makeSRGBGamma() const override;
|
sk_sp<SkColorSpace> makeSRGBGamma() const override;
|
||||||
sk_sp<SkColorSpace> makeColorSpin() const override;
|
sk_sp<SkColorSpace> makeColorSpin() const override;
|
||||||
|
sk_sp<SkColorSpace> makeNonlinearBlending() const override;
|
||||||
|
|
||||||
SkGammaNamed onGammaNamed() const override { return fGammaNamed; }
|
SkGammaNamed onGammaNamed() const override { return fGammaNamed; }
|
||||||
|
|
||||||
@ -56,6 +58,8 @@ private:
|
|||||||
mutable const uint8_t* fToDstGammaTables[3];
|
mutable const uint8_t* fToDstGammaTables[3];
|
||||||
mutable SkOnce fToDstGammaOnce;
|
mutable SkOnce fToDstGammaOnce;
|
||||||
|
|
||||||
|
bool fNonlinearBlending = false;
|
||||||
|
|
||||||
friend class SkColorSpace;
|
friend class SkColorSpace;
|
||||||
friend class ColorSpaceXformTest;
|
friend class ColorSpaceXformTest;
|
||||||
};
|
};
|
||||||
|
@ -23,10 +23,6 @@ SkPictureImageGenerator::Make(const SkISize& size, sk_sp<SkPicture> picture, con
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SkImage::BitDepth::kF16 == bitDepth && (!colorSpace || !colorSpace->gammaIsLinear())) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (colorSpace && (!colorSpace->gammaCloseToSRGB() && !colorSpace->gammaIsLinear())) {
|
if (colorSpace && (!colorSpace->gammaCloseToSRGB() && !colorSpace->gammaIsLinear())) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
@ -300,6 +300,7 @@ GrPixelConfig GrRenderableConfigForColorSpace(const SkColorSpace* colorSpace) {
|
|||||||
if (!colorSpace) {
|
if (!colorSpace) {
|
||||||
return kRGBA_8888_GrPixelConfig;
|
return kRGBA_8888_GrPixelConfig;
|
||||||
} else if (colorSpace->gammaIsLinear()) {
|
} else if (colorSpace->gammaIsLinear()) {
|
||||||
|
// TODO
|
||||||
return kRGBA_half_GrPixelConfig;
|
return kRGBA_half_GrPixelConfig;
|
||||||
} else if (colorSpace->gammaCloseToSRGB()) {
|
} else if (colorSpace->gammaCloseToSRGB()) {
|
||||||
return kSRGBA_8888_GrPixelConfig;
|
return kSRGBA_8888_GrPixelConfig;
|
||||||
|
@ -271,7 +271,7 @@ bool SkSurface_Gpu::onDraw(const SkDeferredDisplayList* ddl) {
|
|||||||
bool SkSurface_Gpu::Valid(const SkImageInfo& info) {
|
bool SkSurface_Gpu::Valid(const SkImageInfo& info) {
|
||||||
switch (info.colorType()) {
|
switch (info.colorType()) {
|
||||||
case kRGBA_F16_SkColorType:
|
case kRGBA_F16_SkColorType:
|
||||||
return (!info.colorSpace()) || info.colorSpace()->gammaIsLinear();
|
return true;
|
||||||
case kRGBA_8888_SkColorType:
|
case kRGBA_8888_SkColorType:
|
||||||
case kBGRA_8888_SkColorType:
|
case kBGRA_8888_SkColorType:
|
||||||
return !info.colorSpace() || info.colorSpace()->gammaCloseToSRGB();
|
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) {
|
bool SkSurface_Gpu::Valid(const GrCaps* caps, GrPixelConfig config, SkColorSpace* colorSpace) {
|
||||||
switch (config) {
|
switch (config) {
|
||||||
case kRGBA_half_GrPixelConfig:
|
case kRGBA_half_GrPixelConfig:
|
||||||
return (!colorSpace) || colorSpace->gammaIsLinear();
|
return true;
|
||||||
case kSRGBA_8888_GrPixelConfig:
|
case kSRGBA_8888_GrPixelConfig:
|
||||||
case kSBGRA_8888_GrPixelConfig:
|
case kSBGRA_8888_GrPixelConfig:
|
||||||
return caps->srgbSupport() && colorSpace && colorSpace->gammaCloseToSRGB();
|
return caps->srgbSupport() && colorSpace && colorSpace->gammaCloseToSRGB();
|
||||||
|
@ -68,9 +68,6 @@ bool SkSurfaceValidateRasterInfo(const SkImageInfo& info, size_t rowBytes) {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case kRGBA_F16_SkColorType:
|
case kRGBA_F16_SkColorType:
|
||||||
if (info.colorSpace() && (!info.colorSpace()->gammaIsLinear())) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
|
@ -118,7 +118,7 @@ bool SkJpegEncoderMgr::setParams(const SkImageInfo& srcInfo, const SkJpegEncoder
|
|||||||
numComponents = 1;
|
numComponents = 1;
|
||||||
break;
|
break;
|
||||||
case kRGBA_F16_SkColorType:
|
case kRGBA_F16_SkColorType:
|
||||||
if (!srcInfo.colorSpace() || !srcInfo.colorSpace()->gammaIsLinear() ||
|
if (!srcInfo.colorSpace() ||
|
||||||
SkTransferFunctionBehavior::kRespect != options.fBlendBehavior) {
|
SkTransferFunctionBehavior::kRespect != options.fBlendBehavior) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -106,7 +106,7 @@ bool SkPngEncoderMgr::setHeader(const SkImageInfo& srcInfo, const SkPngEncoder::
|
|||||||
int bitDepth = 8;
|
int bitDepth = 8;
|
||||||
switch (srcInfo.colorType()) {
|
switch (srcInfo.colorType()) {
|
||||||
case kRGBA_F16_SkColorType:
|
case kRGBA_F16_SkColorType:
|
||||||
SkASSERT(srcInfo.colorSpace() && srcInfo.colorSpace()->gammaIsLinear());
|
SkASSERT(srcInfo.colorSpace());
|
||||||
sigBit.red = 16;
|
sigBit.red = 16;
|
||||||
sigBit.green = 16;
|
sigBit.green = 16;
|
||||||
sigBit.blue = 16;
|
sigBit.blue = 16;
|
||||||
|
@ -88,10 +88,6 @@ static transform_scanline_proc choose_proc(const SkImageInfo& info,
|
|||||||
case kGray_8_SkColorType:
|
case kGray_8_SkColorType:
|
||||||
return transform_scanline_gray;
|
return transform_scanline_gray;
|
||||||
case kRGBA_F16_SkColorType:
|
case kRGBA_F16_SkColorType:
|
||||||
if (!info.colorSpace() || !info.colorSpace()->gammaIsLinear()) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (info.alphaType()) {
|
switch (info.alphaType()) {
|
||||||
case kOpaque_SkAlphaType:
|
case kOpaque_SkAlphaType:
|
||||||
case kUnpremul_SkAlphaType:
|
case kUnpremul_SkAlphaType:
|
||||||
|
@ -1144,22 +1144,22 @@ static void test_conversion_possible(skiatest::Reporter* r, const char* path,
|
|||||||
SkBitmap bm;
|
SkBitmap bm;
|
||||||
bm.allocPixels(infoF16);
|
bm.allocPixels(infoF16);
|
||||||
SkCodec::Result result = codec->getPixels(infoF16, bm.getPixels(), bm.rowBytes());
|
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);
|
result = codec->startScanlineDecode(infoF16);
|
||||||
if (supportsScanlineDecoder) {
|
if (supportsScanlineDecoder) {
|
||||||
REPORTER_ASSERT(r, SkCodec::kInvalidConversion == result);
|
REPORTER_ASSERT(r, SkCodec::kSuccess == result);
|
||||||
} else {
|
} else {
|
||||||
REPORTER_ASSERT(r, SkCodec::kUnimplemented == result
|
REPORTER_ASSERT(r, SkCodec::kUnimplemented == result
|
||||||
|| SkCodec::kInvalidConversion == result);
|
|| SkCodec::kSuccess == result);
|
||||||
}
|
}
|
||||||
|
|
||||||
result = codec->startIncrementalDecode(infoF16, bm.getPixels(), bm.rowBytes());
|
result = codec->startIncrementalDecode(infoF16, bm.getPixels(), bm.rowBytes());
|
||||||
if (supportsIncrementalDecoder) {
|
if (supportsIncrementalDecoder) {
|
||||||
REPORTER_ASSERT(r, SkCodec::kInvalidConversion == result);
|
REPORTER_ASSERT(r, SkCodec::kSuccess == result);
|
||||||
} else {
|
} else {
|
||||||
REPORTER_ASSERT(r, SkCodec::kUnimplemented == result
|
REPORTER_ASSERT(r, SkCodec::kUnimplemented == result
|
||||||
|| SkCodec::kInvalidConversion == result);
|
|| SkCodec::kSuccess == result);
|
||||||
}
|
}
|
||||||
|
|
||||||
infoF16 = infoF16.makeColorSpace(infoF16.colorSpace()->makeLinearGamma());
|
infoF16 = infoF16.makeColorSpace(infoF16.colorSpace()->makeLinearGamma());
|
||||||
|
76
tests/NonlinearBlendingTest.cpp
Normal file
76
tests/NonlinearBlendingTest.cpp
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
@ -951,8 +951,8 @@ static void test_surface_creation_and_snapshot_with_color_space(
|
|||||||
{ kN32_SkColorType, oddColorSpace, false, "N32-odd" },
|
{ kN32_SkColorType, oddColorSpace, false, "N32-odd" },
|
||||||
{ kRGBA_F16_SkColorType, nullptr, true, "F16-nullptr" },
|
{ kRGBA_F16_SkColorType, nullptr, true, "F16-nullptr" },
|
||||||
{ kRGBA_F16_SkColorType, linearColorSpace, true, "F16-linear" },
|
{ kRGBA_F16_SkColorType, linearColorSpace, true, "F16-linear" },
|
||||||
{ kRGBA_F16_SkColorType, srgbColorSpace, false, "F16-srgb" },
|
{ kRGBA_F16_SkColorType, srgbColorSpace, true, "F16-srgb" },
|
||||||
{ kRGBA_F16_SkColorType, oddColorSpace, false, "F16-odd" },
|
{ kRGBA_F16_SkColorType, oddColorSpace, true, "F16-odd" },
|
||||||
{ kRGB_565_SkColorType, srgbColorSpace, false, "565-srgb" },
|
{ kRGB_565_SkColorType, srgbColorSpace, false, "565-srgb" },
|
||||||
{ kAlpha_8_SkColorType, srgbColorSpace, false, "A8-srgb" },
|
{ kAlpha_8_SkColorType, srgbColorSpace, false, "A8-srgb" },
|
||||||
{ kRGBA_1010102_SkColorType, nullptr, true, "1010102-nullptr" },
|
{ kRGBA_1010102_SkColorType, nullptr, true, "1010102-nullptr" },
|
||||||
|
Loading…
Reference in New Issue
Block a user