4444#include < OpenImageIO/sysutil.h>
4545#include < OpenImageIO/timer.h>
4646
47+ #include " imageio_pvt.h"
4748
4849#include " ivutils.h"
4950
5051
51- namespace {
52-
53- inline bool
54- IsSpecSrgb (const ImageSpec& spec)
55- {
56- return equivalent_colorspace (spec.get_string_attribute (" oiio:ColorSpace" ),
57- " srgb_rec709_scene" );
58- }
59-
60- } // namespace
61-
62-
6352// clang-format off
6453static const char *s_file_filters = " "
6554 " Image Files (*.bmp *.cin *.dcm *.dds *.dpx *.fits *.gif *.hdr *.ico *.iff "
@@ -1242,7 +1231,8 @@ ImageViewer::loadCurrentImage(int subimage, int miplevel)
12421231 // std::cerr << "Loading HALF-FLOAT as FLOAT\n";
12431232 read_format = TypeDesc::FLOAT;
12441233 }
1245- if (IsSpecSrgb (image_spec) && !glwin->is_srgb_capable ()) {
1234+ if (pvt::is_colorspace_srgb (image_spec)
1235+ && !glwin->is_srgb_capable ()) {
12461236 // If the image is in sRGB, but OpenGL can't load sRGB textures then
12471237 // we'll need to do the transformation on the CPU after loading the
12481238 // image. We (so far) can only do this with UINT8 images, so make
@@ -1257,7 +1247,8 @@ ImageViewer::loadCurrentImage(int subimage, int miplevel)
12571247 read_format = TypeDesc::UINT8;
12581248 allow_transforms = true ;
12591249
1260- if (IsSpecSrgb (image_spec) && !glwin->is_srgb_capable ())
1250+ if (pvt::is_colorspace_srgb (image_spec)
1251+ && !glwin->is_srgb_capable ())
12611252 srgb_transform = true ;
12621253 }
12631254
@@ -1443,7 +1434,7 @@ ImageViewer::exposureMinusOneTenthStop()
14431434 img->exposure (img->exposure () - 0.1 );
14441435 if (!glwin->is_glsl_capable ()) {
14451436 bool srgb_transform = (!glwin->is_srgb_capable ()
1446- && IsSpecSrgb (img->spec ()));
1437+ && pvt::is_colorspace_srgb (img->spec ()));
14471438 img->pixel_transform (srgb_transform, (int )current_color_mode (),
14481439 current_channel ());
14491440 displayCurrentImage ();
@@ -1462,7 +1453,7 @@ ImageViewer::exposureMinusOneHalfStop()
14621453 img->exposure (img->exposure () - 0.5 );
14631454 if (!glwin->is_glsl_capable ()) {
14641455 bool srgb_transform = (!glwin->is_srgb_capable ()
1465- && IsSpecSrgb (img->spec ()));
1456+ && pvt::is_colorspace_srgb (img->spec ()));
14661457 img->pixel_transform (srgb_transform, (int )current_color_mode (),
14671458 current_channel ());
14681459 displayCurrentImage ();
@@ -1481,7 +1472,7 @@ ImageViewer::exposurePlusOneTenthStop()
14811472 img->exposure (img->exposure () + 0.1 );
14821473 if (!glwin->is_glsl_capable ()) {
14831474 bool srgb_transform = (!glwin->is_srgb_capable ()
1484- && IsSpecSrgb (img->spec ()));
1475+ && pvt::is_colorspace_srgb (img->spec ()));
14851476 img->pixel_transform (srgb_transform, (int )current_color_mode (),
14861477 current_channel ());
14871478 displayCurrentImage ();
@@ -1500,7 +1491,7 @@ ImageViewer::exposurePlusOneHalfStop()
15001491 img->exposure (img->exposure () + 0.5 );
15011492 if (!glwin->is_glsl_capable ()) {
15021493 bool srgb_transform = (!glwin->is_srgb_capable ()
1503- && IsSpecSrgb (img->spec ()));
1494+ && pvt::is_colorspace_srgb (img->spec ()));
15041495 img->pixel_transform (srgb_transform, (int )current_color_mode (),
15051496 current_channel ());
15061497 displayCurrentImage ();
@@ -1520,7 +1511,7 @@ ImageViewer::gammaMinus()
15201511 img->gamma (img->gamma () - 0.05 );
15211512 if (!glwin->is_glsl_capable ()) {
15221513 bool srgb_transform = (!glwin->is_srgb_capable ()
1523- && IsSpecSrgb (img->spec ()));
1514+ && pvt::is_colorspace_srgb (img->spec ()));
15241515 img->pixel_transform (srgb_transform, (int )current_color_mode (),
15251516 current_channel ());
15261517 displayCurrentImage ();
@@ -1539,7 +1530,7 @@ ImageViewer::gammaPlus()
15391530 img->gamma (img->gamma () + 0.05 );
15401531 if (!glwin->is_glsl_capable ()) {
15411532 bool srgb_transform = (!glwin->is_srgb_capable ()
1542- && IsSpecSrgb (img->spec ()));
1533+ && pvt::is_colorspace_srgb (img->spec ()));
15431534 img->pixel_transform (srgb_transform, (int )current_color_mode (),
15441535 current_channel ());
15451536 displayCurrentImage ();
@@ -1572,7 +1563,7 @@ ImageViewer::viewChannel(int c, COLOR_MODE colormode)
15721563 IvImage* img = cur ();
15731564 if (img) {
15741565 bool srgb_transform = (!glwin->is_srgb_capable ()
1575- && IsSpecSrgb (img->spec ()));
1566+ && pvt::is_colorspace_srgb (img->spec ()));
15761567 img->pixel_transform (srgb_transform, (int )colormode, c);
15771568 }
15781569 } else {
0 commit comments