chromium/native_client_sdk/doc_generated/pepper_beta/c/struct_p_p_b___view__1__2.html

{{+bindTo:partials.standard_nacl_api}}
<h1>PPB_View Struct Reference</h1>
<div id="doxygen-ref">
{{- dummy div to appease doxygen -}}
  <div>
<!-- Generated by Doxygen 1.7.6.1 -->


</div>
<!--header-->
<div class="contents">
<!-- doxytag: class="PPB_View" --><h2>
Data Fields</h2><table class="memberdecls">

<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___enums.html#ga4f272d99be14aacafe08dfd4ef830918">PP_Bool</a>(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p_b___view__1__2.html#a74d7a537d292a9f0a59bba78f19f683b">IsView</a> )(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> resource)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___enums.html#ga4f272d99be14aacafe08dfd4ef830918">PP_Bool</a>(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p_b___view__1__2.html#af767d8feb7445431648389d52b977079">GetRect</a> )(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> resource, struct <a class="el" href="struct_p_p___rect.html">PP_Rect</a> *rect)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___enums.html#ga4f272d99be14aacafe08dfd4ef830918">PP_Bool</a>(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p_b___view__1__2.html#a002327305e06133095aa8aefb0d77de1">IsFullscreen</a> )(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> resource)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___enums.html#ga4f272d99be14aacafe08dfd4ef830918">PP_Bool</a>(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p_b___view__1__2.html#a86813cde54dea35dd7cbe119f4a0fe7b">IsVisible</a> )(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> resource)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___enums.html#ga4f272d99be14aacafe08dfd4ef830918">PP_Bool</a>(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p_b___view__1__2.html#aafc97fdd80955aa32d6bca58828eabd6">IsPageVisible</a> )(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> resource)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___enums.html#ga4f272d99be14aacafe08dfd4ef830918">PP_Bool</a>(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p_b___view__1__2.html#a39a55aa9b1933e5f4d37c3f1100556b7">GetClipRect</a> )(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> resource, struct <a class="el" href="struct_p_p___rect.html">PP_Rect</a> *clip)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">float(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p_b___view__1__2.html#acff2671f2780e13264354000ec178391">GetDeviceScale</a> )(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> resource)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">float(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p_b___view__1__2.html#aef9d532581488ce90af0cbff5464c37c">GetCSSScale</a> )(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> resource)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___enums.html#ga4f272d99be14aacafe08dfd4ef830918">PP_Bool</a>(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p_b___view__1__2.html#aa6b09b1066326b2d1272d9aa7f34d69c">GetScrollOffset</a> )(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> resource, struct <a class="el" href="struct_p_p___point.html">PP_Point</a> *offset)</td></tr>
</table>
<hr /><a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock"><p><code>PPB_View</code> represents the state of the view of an instance. </p>
<p>You will receive new view information using <code><a class="el" href="struct_p_p_p___instance__1__1.html#aa028a7b17d62242ac56b6ab4b55dc047" title="DidChangeView() is called when the position, size, or other view attributes of the instance has chang...">PPP_Instance.DidChangeView</a></code>. </p>
</div><hr /><h2>Field Documentation</h2>
<a class="anchor" id="a39a55aa9b1933e5f4d37c3f1100556b7"></a><!-- doxytag: member="PPB_View::GetClipRect" ref="a39a55aa9b1933e5f4d37c3f1100556b7" args=")(PP_Resource resource, struct PP_Rect *clip)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="group___enums.html#ga4f272d99be14aacafe08dfd4ef830918">PP_Bool</a>(* <a class="el" href="struct_p_p_b___view__1__2.html#a39a55aa9b1933e5f4d37c3f1100556b7">PPB_View::GetClipRect</a>)(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> resource, struct <a class="el" href="struct_p_p___rect.html">PP_Rect</a> *clip)</td>
</tr>
</table>
</div>
<div class="memdoc">
<p><a class="el" href="struct_p_p_b___view__1__2.html#a39a55aa9b1933e5f4d37c3f1100556b7" title="GetClipRect() returns the clip rectangle relative to the upper-left corner of the module instance...">GetClipRect()</a> returns the clip rectangle relative to the upper-left corner of the module instance. </p>
<p>This rectangle indicates the portions of the module instance that are scrolled into view.</p>
<p>If the module instance is scrolled off the view, the return value will be (0, 0, 0, 0). This clip rectangle does <em>not</em> take into account page visibility. Therefore, if the module instance is scrolled into view, but the page itself is on a tab that is not visible, the return rectangle will contain the visible rectangle as though the page were visible. Refer to <a class="el" href="struct_p_p_b___view__1__2.html#aafc97fdd80955aa32d6bca58828eabd6" title="IsPageVisible() determines if the page that contains the module instance is visible.">IsPageVisible()</a> and <a class="el" href="struct_p_p_b___view__1__2.html#a86813cde54dea35dd7cbe119f4a0fe7b" title="IsVisible() determines whether the module instance might be visible to the user.">IsVisible()</a> if you want to account for page visibility.</p>
<p>Most applications will not need to worry about the clip rectangle. The recommended behavior is to do full updates if the module instance is visible, as determined by <a class="el" href="struct_p_p_b___view__1__2.html#a86813cde54dea35dd7cbe119f4a0fe7b" title="IsVisible() determines whether the module instance might be visible to the user.">IsVisible()</a>, and do no updates if it is not visible.</p>
<p>However, if the cost for computing pixels is very high for your application, or the pages you're targeting frequently have very large module instances with small visible portions, you may wish to optimize further. In this case, the clip rectangle will tell you which parts of the module to update.</p>
<p>Note that painting of the page and sending of view changed updates happens asynchronously. This means when the user scrolls, for example, it is likely that the previous backing store of the module instance will be used for the first paint, and will be updated later when your application generates new content with the new clip. This may cause flickering at the boundaries when scrolling. If you do choose to do partial updates, you may want to think about what color the invisible portions of your backing store contain (be it transparent or some background color) or to paint a certain region outside the clip to reduce the visual distraction when this happens.</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">resource</td><td>A <code>PP_Resource</code> corresponding to a <code>PPB_View</code> resource.</td></tr>
<tr><td class="paramname">clip</td><td>Output argument receiving the clip rect on success.</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>Returns <code>PP_TRUE</code> if the resource was valid and the clip rect was filled in, <code>PP_FALSE</code> if not. </dd></dl>
</div>
</div>
<a class="anchor" id="aef9d532581488ce90af0cbff5464c37c"></a><!-- doxytag: member="PPB_View::GetCSSScale" ref="aef9d532581488ce90af0cbff5464c37c" args=")(PP_Resource resource)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">float(* <a class="el" href="struct_p_p_b___view__1__2.html#aef9d532581488ce90af0cbff5464c37c">PPB_View::GetCSSScale</a>)(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> resource)</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>GetCSSScale returns the scale factor between DIPs and CSS pixels. </p>
<p>This allows proper scaling between DIPs - as sent via the Pepper API - and CSS pixel coordinates used for Web content.</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">resource</td><td>A <code>PP_Resource</code> corresponding to a <code>PPB_View</code> resource.</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>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. </dd></dl>
</div>
</div>
<a class="anchor" id="acff2671f2780e13264354000ec178391"></a><!-- doxytag: member="PPB_View::GetDeviceScale" ref="acff2671f2780e13264354000ec178391" args=")(PP_Resource resource)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">float(* <a class="el" href="struct_p_p_b___view__1__2.html#acff2671f2780e13264354000ec178391">PPB_View::GetDeviceScale</a>)(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> resource)</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>GetDeviceScale returns the scale factor between device pixels and Density Independent Pixels (DIPs, also known as logical pixels or UI pixels on some platforms). </p>
<p>This allows the developer to render their contents at device resolution, even as coordinates / sizes are given in DIPs through the API.</p>
<p>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.</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">resource</td><td>A <code>PP_Resource</code> corresponding to a <code>PPB_View</code> resource.</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>A <code>float</code> value representing the number of device pixels per DIP. If the resource is invalid, the value will be 0.0. </dd></dl>
</div>
</div>
<a class="anchor" id="af767d8feb7445431648389d52b977079"></a><!-- doxytag: member="PPB_View::GetRect" ref="af767d8feb7445431648389d52b977079" args=")(PP_Resource resource, struct PP_Rect *rect)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="group___enums.html#ga4f272d99be14aacafe08dfd4ef830918">PP_Bool</a>(* <a class="el" href="struct_p_p_b___view__1__2.html#af767d8feb7445431648389d52b977079">PPB_View::GetRect</a>)(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> resource, struct <a class="el" href="struct_p_p___rect.html">PP_Rect</a> *rect)</td>
</tr>
</table>
</div>
<div class="memdoc">
<p><a class="el" href="struct_p_p_b___view__1__2.html#af767d8feb7445431648389d52b977079" title="GetRect() retrieves the rectangle of the module instance associated with a view changed notification ...">GetRect()</a> retrieves the rectangle of the module instance associated with a view changed notification relative to the upper-left of the browser viewport. </p>
<p>This position changes when the page is scrolled.</p>
<p>The returned rectangle may not be inside the visible portion of the viewport if the module instance is scrolled off the page. Therefore, the position may be negative or larger than the size of the page. The size will always reflect the size of the module were it to be scrolled entirely into view.</p>
<p>In general, most modules will not need to worry about the position of the module instance in the viewport, and only need to use the size.</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">resource</td><td>A <code>PP_Resource</code> corresponding to a <code>PPB_View</code> resource.</td></tr>
<tr><td class="paramname">rect</td><td>A <code><a class="el" href="struct_p_p___rect.html" title="The PP_Rect struct contains the size and location of a 2D rectangle.">PP_Rect</a></code> receiving the rectangle on success.</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>Returns <code>PP_TRUE</code> if the resource was valid and the viewport rectangle was filled in, <code>PP_FALSE</code> if not. </dd></dl>
</div>
</div>
<a class="anchor" id="aa6b09b1066326b2d1272d9aa7f34d69c"></a><!-- doxytag: member="PPB_View::GetScrollOffset" ref="aa6b09b1066326b2d1272d9aa7f34d69c" args=")(PP_Resource resource, struct PP_Point *offset)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="group___enums.html#ga4f272d99be14aacafe08dfd4ef830918">PP_Bool</a>(* <a class="el" href="struct_p_p_b___view__1__2.html#aa6b09b1066326b2d1272d9aa7f34d69c">PPB_View::GetScrollOffset</a>)(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> resource, struct <a class="el" href="struct_p_p___point.html">PP_Point</a> *offset)</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>GetScrollOffset returns the scroll offset of the window containing the plugin. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">resource</td><td>A <code>PP_Resource</code> corresponding to a <code>PPB_View</code> resource.</td></tr>
<tr><td class="paramdir">[out]</td><td class="paramname">offset</td><td>A <code><a class="el" href="struct_p_p___point.html" title="The PP_Point structure defines the integer x and y coordinates of a point.">PP_Point</a></code> which will be set to the value of the scroll offset in CSS pixels.</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>Returns <code>PP_TRUE</code> if the resource was valid and the offset was filled in, <code>PP_FALSE</code> if not. </dd></dl>
</div>
</div>
<a class="anchor" id="a002327305e06133095aa8aefb0d77de1"></a><!-- doxytag: member="PPB_View::IsFullscreen" ref="a002327305e06133095aa8aefb0d77de1" args=")(PP_Resource resource)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="group___enums.html#ga4f272d99be14aacafe08dfd4ef830918">PP_Bool</a>(* <a class="el" href="struct_p_p_b___view__1__2.html#a002327305e06133095aa8aefb0d77de1">PPB_View::IsFullscreen</a>)(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> resource)</td>
</tr>
</table>
</div>
<div class="memdoc">
<p><a class="el" href="struct_p_p_b___view__1__2.html#a002327305e06133095aa8aefb0d77de1" title="IsFullscreen() returns whether the instance is currently displaying in fullscreen mode...">IsFullscreen()</a> returns whether the instance is currently displaying in fullscreen mode. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">resource</td><td>A <code>PP_Resource</code> corresponding to a <code>PPB_View</code> resource.</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd><code>PP_TRUE</code> if the instance is in full screen mode, or <code>PP_FALSE</code> if it's not or the resource is invalid. </dd></dl>
</div>
</div>
<a class="anchor" id="aafc97fdd80955aa32d6bca58828eabd6"></a><!-- doxytag: member="PPB_View::IsPageVisible" ref="aafc97fdd80955aa32d6bca58828eabd6" args=")(PP_Resource resource)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="group___enums.html#ga4f272d99be14aacafe08dfd4ef830918">PP_Bool</a>(* <a class="el" href="struct_p_p_b___view__1__2.html#aafc97fdd80955aa32d6bca58828eabd6">PPB_View::IsPageVisible</a>)(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> resource)</td>
</tr>
</table>
</div>
<div class="memdoc">
<p><a class="el" href="struct_p_p_b___view__1__2.html#aafc97fdd80955aa32d6bca58828eabd6" title="IsPageVisible() determines if the page that contains the module instance is visible.">IsPageVisible()</a> determines if the page that contains the module instance is visible. </p>
<p>The most common cause of invisible pages is that the page is in a background tab in the browser.</p>
<p>Most applications should use <a class="el" href="struct_p_p_b___view__1__2.html#a86813cde54dea35dd7cbe119f4a0fe7b" title="IsVisible() determines whether the module instance might be visible to the user.">IsVisible()</a> instead of this function since the module instance could be scrolled off of a visible page, and this function will still return true. However, depending on how your module interacts with the page, there may be certain updates that you may want to perform when the page is visible even if your specific module instance is not visible.</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">resource</td><td>A <code>PP_Resource</code> corresponding to a <code>PPB_View</code> resource.</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd><code>PP_TRUE</code> if the instance is plausibly visible to the user, <code>PP_FALSE</code> if it is definitely not visible. </dd></dl>
</div>
</div>
<a class="anchor" id="a74d7a537d292a9f0a59bba78f19f683b"></a><!-- doxytag: member="PPB_View::IsView" ref="a74d7a537d292a9f0a59bba78f19f683b" args=")(PP_Resource resource)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="group___enums.html#ga4f272d99be14aacafe08dfd4ef830918">PP_Bool</a>(* <a class="el" href="struct_p_p_b___view__1__2.html#a74d7a537d292a9f0a59bba78f19f683b">PPB_View::IsView</a>)(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> resource)</td>
</tr>
</table>
</div>
<div class="memdoc">
<p><a class="el" href="struct_p_p_b___view__1__2.html#a74d7a537d292a9f0a59bba78f19f683b" title="IsView() determines if the given resource is a valid PPB_View resource.">IsView()</a> determines if the given resource is a valid <code>PPB_View</code> resource. </p>
<p>Note that <code>PPB_ViewChanged</code> resources derive from <code>PPB_View</code> and will return true here as well.</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">resource</td><td>A <code>PP_Resource</code> corresponding to a <code>PPB_View</code> resource.</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd><code>PP_TRUE</code> if the given resource supports <code>PPB_View</code> or <code>PP_FALSE</code> if it is an invalid resource or is a resource of another type. </dd></dl>
</div>
</div>
<a class="anchor" id="a86813cde54dea35dd7cbe119f4a0fe7b"></a><!-- doxytag: member="PPB_View::IsVisible" ref="a86813cde54dea35dd7cbe119f4a0fe7b" args=")(PP_Resource resource)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="group___enums.html#ga4f272d99be14aacafe08dfd4ef830918">PP_Bool</a>(* <a class="el" href="struct_p_p_b___view__1__2.html#a86813cde54dea35dd7cbe119f4a0fe7b">PPB_View::IsVisible</a>)(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> resource)</td>
</tr>
</table>
</div>
<div class="memdoc">
<p><a class="el" href="struct_p_p_b___view__1__2.html#a86813cde54dea35dd7cbe119f4a0fe7b" title="IsVisible() determines whether the module instance might be visible to the user.">IsVisible()</a> determines whether the module instance might be visible to the user. </p>
<p>For example, the Chrome window could be minimized or another window could be over it. In both of these cases, the module instance would not be visible to the user, but <a class="el" href="struct_p_p_b___view__1__2.html#a86813cde54dea35dd7cbe119f4a0fe7b" title="IsVisible() determines whether the module instance might be visible to the user.">IsVisible()</a> will return true.</p>
<p>Use the result to speed up or stop updates for invisible module instances.</p>
<p>This function performs the duties of <a class="el" href="struct_p_p_b___view__1__2.html#af767d8feb7445431648389d52b977079" title="GetRect() retrieves the rectangle of the module instance associated with a view changed notification ...">GetRect()</a> (determining whether the module instance is scrolled into view and the clip rectangle is nonempty) and <a class="el" href="struct_p_p_b___view__1__2.html#aafc97fdd80955aa32d6bca58828eabd6" title="IsPageVisible() determines if the page that contains the module instance is visible.">IsPageVisible()</a> (whether the page is visible to the user).</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">resource</td><td>A <code>PP_Resource</code> corresponding to a <code>PPB_View</code> resource.</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd><code>PP_TRUE</code> if the instance might be visible to the user, <code>PP_FALSE</code> if it is definitely not visible. </dd></dl>
</div>
</div>
<hr />The documentation for this struct was generated from the following file:<ul>
<li><a class="el" href="ppb__view_8h.html">ppb_view.h</a></li>
</ul>
</div><!-- contents -->
</div>
{{/partials.standard_nacl_api}}