← Back to team overview

ubuntu-touch-coreapps-reviewers team mailing list archive

[Merge] lp:~verzegnassi-stefano/ubuntu-docviewer-app/night-shader into lp:ubuntu-docviewer-app

 

Stefano Verzegnassi has proposed merging lp:~verzegnassi-stefano/ubuntu-docviewer-app/night-shader into lp:ubuntu-docviewer-app.

Commit message:
Night shader updated

Requested reviews:
  Ubuntu Document Viewer Developers (ubuntu-docviewer-dev)

For more details, see:
https://code.launchpad.net/~verzegnassi-stefano/ubuntu-docviewer-app/night-shader/+merge/282041

Night shader updated

Some screenshot: https://imgur.com/a/xUk8B
(left: old shader - right: new one)

List of changes:
* Use a standard greyscale formula (from NTSC and PAL specs)
  The difference is not visible though, but the previous values were only found in Qt examples (therefore not standard).

* Colors in the [0...255] range are now compressed into a [26...230] range.
* Colors between [204 and 230] are clipped to 204.

Recently I've tested the night mode with no ambient light.
Even if the amount of white is sensibly reduced by inverting the colors, I found the pure black (RGB 0,0,0) too bright.
Also, I found annoying to scroll a document with images, since the amount of white (or anyway light colors) was a bit high on average. With a further clipping of light tones, reading a document seems to be less tiring.
-- 
Your team Ubuntu Document Viewer Developers is requested to review the proposed merge of lp:~verzegnassi-stefano/ubuntu-docviewer-app/night-shader into lp:ubuntu-docviewer-app.
=== modified file 'src/app/qml/common/NightModeShader.qml'
--- src/app/qml/common/NightModeShader.qml	2015-10-10 12:03:30 +0000
+++ src/app/qml/common/NightModeShader.qml	2016-01-08 18:01:24 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2015 Canonical, Ltd.
+ * Copyright (C) 2015, 2016 Stefano Verzegnassi
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -24,10 +24,10 @@
 
         void main() {
             lowp vec4 p = texture2D(source, qt_TexCoord0);
-            p.r = 1.0 - p.r;
-            p.g = 1.0 - p.g;
-            p.b = 1.0 - p.b;
-            gl_FragColor = vec4(vec3(dot(p.rgb, vec3(0.344, 0.5, 0.156))), p.a) * qt_Opacity;
+            p.r = min(0.8, (1.0 - p.r) * 0.8 + 0.1);
+            p.g = min(0.8, (1.0 - p.g) * 0.8 + 0.1);
+            p.b = min(0.8, (1.0 - p.b) * 0.8 + 0.1);
+            gl_FragColor = vec4(vec3(dot(p.rgb, vec3(0.299, 0.587, 0.114))), p.a) * qt_Opacity;
         }
     "
 }


Follow ups