Gitweb links:

...log 
http://git.netsurf-browser.org/netsurf.git/shortlog/ffc199d778c7666edca028da965009574fdfd3df
...commit 
http://git.netsurf-browser.org/netsurf.git/commit/ffc199d778c7666edca028da965009574fdfd3df
...tree 
http://git.netsurf-browser.org/netsurf.git/tree/ffc199d778c7666edca028da965009574fdfd3df

The branch, master has been updated
       via  ffc199d778c7666edca028da965009574fdfd3df (commit)
       via  7567f6407512acb44199a11b6496a614ca659fe2 (commit)
      from  e02020198da093a4856b149c926668c32cfcc7a4 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commitdiff 
http://git.netsurf-browser.org/netsurf.git/commit/?id=ffc199d778c7666edca028da965009574fdfd3df
commit ffc199d778c7666edca028da965009574fdfd3df
Author: Michael Drake <[email protected]>
Commit: Michael Drake <[email protected]>

    CSS: Add helpers to convert between css and physical pixels.

diff --git a/content/handlers/css/utils.h b/content/handlers/css/utils.h
index 0e723f7..e35a660 100644
--- a/content/handlers/css/utils.h
+++ b/content/handlers/css/utils.h
@@ -79,6 +79,31 @@ css_fixed nscss_len2px(
                css_unit unit,
                const css_computed_style *style);
 
+/**
+ * Convert css pixels to physical pixels.
+ *
+ * \param[in] css_pixels  Length in css pixels.
+ * \return length in physical pixels
+ */
+static inline css_fixed nscss_pixels_css_to_physical(
+               css_fixed css_pixels)
+{
+       return FDIV(FMUL(css_pixels, nscss_screen_dpi),
+                       nscss_baseline_pixel_density);
+}
+
+/**
+ * Convert physical pixels to css pixels.
+ *
+ * \param[in] physical_pixels  Length in physical pixels.
+ * \return length in css pixels
+ */
+static inline css_fixed nscss_pixels_physical_to_css(
+               css_fixed physical_pixels)
+{
+       return FDIV(FMUL(physical_pixels, nscss_baseline_pixel_density),
+                       nscss_screen_dpi);
+}
 
 /**
  * Temporary helper wrappers for for libcss computed style getter, while


commitdiff 
http://git.netsurf-browser.org/netsurf.git/commit/?id=7567f6407512acb44199a11b6496a614ca659fe2
commit 7567f6407512acb44199a11b6496a614ca659fe2
Author: Michael Drake <[email protected]>
Commit: Michael Drake <[email protected]>

    CSS: Extern the nscss_baseline_pixel_density value.
    
    Front ends should be able to set this, or it should
    be a config option.

diff --git a/content/handlers/css/utils.h b/content/handlers/css/utils.h
index c8f4c82..0e723f7 100644
--- a/content/handlers/css/utils.h
+++ b/content/handlers/css/utils.h
@@ -26,6 +26,9 @@
 /** DPI of the screen, in fixed point units */
 extern css_fixed nscss_screen_dpi;
 
+/** Medium screen density for device viewing distance. */
+extern css_fixed nscss_baseline_pixel_density;
+
 /**
  * Length conversion context data.
  */


-----------------------------------------------------------------------

Summary of changes:
 content/handlers/css/utils.h |   28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/content/handlers/css/utils.h b/content/handlers/css/utils.h
index c8f4c82..e35a660 100644
--- a/content/handlers/css/utils.h
+++ b/content/handlers/css/utils.h
@@ -26,6 +26,9 @@
 /** DPI of the screen, in fixed point units */
 extern css_fixed nscss_screen_dpi;
 
+/** Medium screen density for device viewing distance. */
+extern css_fixed nscss_baseline_pixel_density;
+
 /**
  * Length conversion context data.
  */
@@ -76,6 +79,31 @@ css_fixed nscss_len2px(
                css_unit unit,
                const css_computed_style *style);
 
+/**
+ * Convert css pixels to physical pixels.
+ *
+ * \param[in] css_pixels  Length in css pixels.
+ * \return length in physical pixels
+ */
+static inline css_fixed nscss_pixels_css_to_physical(
+               css_fixed css_pixels)
+{
+       return FDIV(FMUL(css_pixels, nscss_screen_dpi),
+                       nscss_baseline_pixel_density);
+}
+
+/**
+ * Convert physical pixels to css pixels.
+ *
+ * \param[in] physical_pixels  Length in physical pixels.
+ * \return length in css pixels
+ */
+static inline css_fixed nscss_pixels_physical_to_css(
+               css_fixed physical_pixels)
+{
+       return FDIV(FMUL(physical_pixels, nscss_baseline_pixel_density),
+                       nscss_screen_dpi);
+}
 
 /**
  * Temporary helper wrappers for for libcss computed style getter, while


-- 
NetSurf Browser

_______________________________________________
netsurf-commits mailing list
[email protected]
http://listmaster.pepperfish.net/cgi-bin/mailman/listinfo/netsurf-commits-netsurf-browser.org

Reply via email to