diff options
author | jhorwich@chromium.org <jhorwich@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-09 15:39:22 +0000 |
---|---|---|
committer | jhorwich@chromium.org <jhorwich@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-09 15:39:22 +0000 |
commit | f381e90d6f112bc395d7cf743cfa199737041541 (patch) | |
tree | 42507ef60f9021cee0f13971acdb54829434715c /ppapi/api | |
parent | e20b88d661f2468003a38cbdaebb0ea3ef63474d (diff) | |
download | chromium_src-f381e90d6f112bc395d7cf743cfa199737041541.zip chromium_src-f381e90d6f112bc395d7cf743cfa199737041541.tar.gz chromium_src-f381e90d6f112bc395d7cf743cfa199737041541.tar.bz2 |
Move HiDPI-related Pepper interfaces to stable
This adds the APIs provided in PPB_View_Dev_0_1 and PP_Graphics2D_Dev_0_1 to
the public Pepper APIs for PPB_View and PPB_Graphics2D.
Includes:
- Change to IDL and generated C headers/shim
- Change to PPAPI to export the 1_1 interfaces
- C++ glue
- Example PPAPI plugin for using HiDPI Pepper APIs
BUG=144071
TEST=Existing (prebuilt) PDF plugin using 1.0 interfaces still works
Review URL: https://codereview.chromium.org/12989006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@193110 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/api')
-rw-r--r-- | ppapi/api/ppb_graphics_2d.idl | 39 | ||||
-rw-r--r-- | ppapi/api/ppb_view.idl | 36 |
2 files changed, 73 insertions, 2 deletions
diff --git a/ppapi/api/ppb_graphics_2d.idl b/ppapi/api/ppb_graphics_2d.idl index 1dddc65..f9b420d 100644 --- a/ppapi/api/ppb_graphics_2d.idl +++ b/ppapi/api/ppb_graphics_2d.idl @@ -9,7 +9,8 @@ */ label Chrome { - M14 = 1.0 + M14 = 1.0, + M27 = 1.1 }; /** @@ -242,5 +243,41 @@ interface PPB_Graphics2D { int32_t Flush( [in] PP_Resource graphics_2d, [in] PP_CompletionCallback callback); + + /** + * SetScale() sets the scale factor that will be applied when painting the + * graphics context onto the output device. Typically, if rendering at device + * resolution is desired, the context would be created with the width and + * height scaled up by the view's GetDeviceScale and SetScale called with a + * scale of 1.0 / GetDeviceScale(). For example, if the view resource passed + * to DidChangeView has a rectangle of (w=200, h=100) and a device scale of + * 2.0, one would call Create with a size of (w=400, h=200) and then call + * SetScale with 0.5. One would then treat each pixel in the context as a + * single device pixel. + * + * @param[in] resource A <code>Graphics2D</code> context resource. + * @param[in] scale The scale to apply when painting. + * + * @return Returns <code>PP_TRUE</code> on success or <code>PP_FALSE</code> if + * the resource is invalid or the scale factor is 0 or less. + */ + [version=1.1] + PP_Bool SetScale( + [in] PP_Resource resource, + [in] float_t scale); + + /*** + * GetScale() gets the scale factor that will be applied when painting the + * graphics context onto the output device. + * + * @param[in] resource A <code>Graphics2D</code> context resource. + * + * @return Returns the scale factor for the graphics context. If the resource + * is not a valid <code>Graphics2D</code> context, this will return 0.0. + */ + [version=1.1] + float_t GetScale( + [in] PP_Resource resource); + }; diff --git a/ppapi/api/ppb_view.idl b/ppapi/api/ppb_view.idl index cc61ed2..a01c5e8 100644 --- a/ppapi/api/ppb_view.idl +++ b/ppapi/api/ppb_view.idl @@ -11,7 +11,8 @@ [generate_thunk] label Chrome { - M18 = 1.0 + M18 = 1.0, + M28 = 1.1 }; /** @@ -159,5 +160,38 @@ interface PPB_View { */ PP_Bool GetClipRect([in] PP_Resource resource, [out] PP_Rect clip); + + /** + * GetDeviceScale returns the scale factor between device pixels and Density + * Independent Pixels (DIPs, also known as logical pixels or UI pixels on + * some platforms). This allows the developer to render their contents at + * device resolution, even as coordinates / sizes are given in DIPs through + * the API. + * + * Note that the coordinate system for Pepper APIs is DIPs. Also note that + * one DIP might not equal one CSS pixel - when page scale/zoom is in effect. + * + * @param[in] resource A <code>PP_Resource</code> corresponding to a + * <code>PPB_View</code> resource. + * + * @return A <code>float</code> value representing the number of device pixels + * per DIP. If the resource is invalid, the value will be 0.0. + */ + [version=1.1] + float_t GetDeviceScale([in] PP_Resource resource); + + /** + * GetCSSScale returns the scale factor between DIPs and CSS pixels. This + * allows proper scaling between DIPs - as sent via the Pepper API - and CSS + * pixel coordinates used for Web content. + * + * @param[in] resource A <code>PP_Resource</code> corresponding to a + * <code>PPB_View</code> resource. + * + * @return css_scale A <code>float</code> value representing the number of + * DIPs per CSS pixel. If the resource is invalid, the value will be 0.0. + */ + [version=1.1] + float_t GetCSSScale([in] PP_Resource resource); }; |