summaryrefslogtreecommitdiffstats
path: root/ppapi
diff options
context:
space:
mode:
Diffstat (limited to 'ppapi')
-rw-r--r--ppapi/api/dev/ppb_graphics_2d_dev.idl16
-rw-r--r--ppapi/c/dev/ppb_graphics_2d_dev.h24
-rw-r--r--ppapi/cpp/dev/graphics_2d_dev.cc40
-rw-r--r--ppapi/cpp/dev/graphics_2d_dev.h10
-rw-r--r--ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c4
-rw-r--r--ppapi/proxy/graphics_2d_resource.cc4
-rw-r--r--ppapi/proxy/graphics_2d_resource.h1
-rw-r--r--ppapi/proxy/ppapi_messages.h3
-rw-r--r--ppapi/thunk/interfaces_ppb_public_dev.h2
-rw-r--r--ppapi/thunk/ppb_graphics_2d_api.h1
-rw-r--r--ppapi/thunk/ppb_graphics_2d_dev_thunk.cc20
11 files changed, 108 insertions, 17 deletions
diff --git a/ppapi/api/dev/ppb_graphics_2d_dev.idl b/ppapi/api/dev/ppb_graphics_2d_dev.idl
index 33b5f59..2924760 100644
--- a/ppapi/api/dev/ppb_graphics_2d_dev.idl
+++ b/ppapi/api/dev/ppb_graphics_2d_dev.idl
@@ -8,7 +8,8 @@
[generate_thunk]
label Chrome {
- M22 = 0.1
+ M22 = 0.1,
+ M32 = 0.2
};
/* PPB_Graphics2D_Dev interface */
@@ -45,5 +46,18 @@ interface PPB_Graphics2D_Dev {
*/
float_t GetScale(
[in] PP_Resource resource);
+
+ /***
+ * Sets the offset into the plugin element at which the graphics context is
+ * painted. This allows a portion of the plugin element to be painted to.
+ * The new offset will only be applied after Flush() has been called.
+ *
+ * @param[in] resource A <code>Graphics2D</code> context resource.
+ * @param[in] offset The offset at which the context should be painted.
+ */
+ [version=0.2]
+ void SetOffset(
+ [in] PP_Resource resource,
+ [in] PP_Point offset);
};
diff --git a/ppapi/c/dev/ppb_graphics_2d_dev.h b/ppapi/c/dev/ppb_graphics_2d_dev.h
index a4661215..789b6aa 100644
--- a/ppapi/c/dev/ppb_graphics_2d_dev.h
+++ b/ppapi/c/dev/ppb_graphics_2d_dev.h
@@ -3,18 +3,20 @@
* found in the LICENSE file.
*/
-/* From dev/ppb_graphics_2d_dev.idl modified Tue Jun 19 14:11:08 2012. */
+/* From dev/ppb_graphics_2d_dev.idl modified Wed Nov 6 16:07:44 2013. */
#ifndef PPAPI_C_DEV_PPB_GRAPHICS_2D_DEV_H_
#define PPAPI_C_DEV_PPB_GRAPHICS_2D_DEV_H_
#include "ppapi/c/pp_bool.h"
#include "ppapi/c/pp_macros.h"
+#include "ppapi/c/pp_point.h"
#include "ppapi/c/pp_resource.h"
#include "ppapi/c/pp_stdint.h"
#define PPB_GRAPHICS2D_DEV_INTERFACE_0_1 "PPB_Graphics2D(Dev);0.1"
-#define PPB_GRAPHICS2D_DEV_INTERFACE PPB_GRAPHICS2D_DEV_INTERFACE_0_1
+#define PPB_GRAPHICS2D_DEV_INTERFACE_0_2 "PPB_Graphics2D(Dev);0.2"
+#define PPB_GRAPHICS2D_DEV_INTERFACE PPB_GRAPHICS2D_DEV_INTERFACE_0_2
/**
* @file
@@ -26,7 +28,7 @@
* @{
*/
/* PPB_Graphics2D_Dev interface */
-struct PPB_Graphics2D_Dev_0_1 {
+struct PPB_Graphics2D_Dev_0_2 {
/**
* SetScale() sets the scale factor that will be applied when painting the
* graphics context onto the output device. Typically, if rendering at device
@@ -55,9 +57,23 @@ struct PPB_Graphics2D_Dev_0_1 {
* is not a valid <code>Graphics2D</code> context, this will return 0.0.
*/
float (*GetScale)(PP_Resource resource);
+ /***
+ * Sets the offset into the plugin element at which the graphics context is
+ * painted. This allows a portion of the plugin element to be painted to.
+ * The new offset will only be applied after Flush() has been called.
+ *
+ * @param[in] resource A <code>Graphics2D</code> context resource.
+ * @param[in] offset The offset at which the context should be painted.
+ */
+ void (*SetOffset)(PP_Resource resource, const struct PP_Point* offset);
};
-typedef struct PPB_Graphics2D_Dev_0_1 PPB_Graphics2D_Dev;
+typedef struct PPB_Graphics2D_Dev_0_2 PPB_Graphics2D_Dev;
+
+struct PPB_Graphics2D_Dev_0_1 {
+ PP_Bool (*SetScale)(PP_Resource resource, float scale);
+ float (*GetScale)(PP_Resource resource);
+};
/**
* @}
*/
diff --git a/ppapi/cpp/dev/graphics_2d_dev.cc b/ppapi/cpp/dev/graphics_2d_dev.cc
index e141bb6..ee7a80f 100644
--- a/ppapi/cpp/dev/graphics_2d_dev.cc
+++ b/ppapi/cpp/dev/graphics_2d_dev.cc
@@ -6,33 +6,53 @@
#include "ppapi/c/dev/ppb_graphics_2d_dev.h"
#include "ppapi/cpp/module_impl.h"
+#include "ppapi/cpp/point.h"
namespace pp {
namespace {
-template <> const char* interface_name<PPB_Graphics2D_Dev>() {
- return PPB_GRAPHICS2D_DEV_INTERFACE;
+template <> const char* interface_name<PPB_Graphics2D_Dev_0_1>() {
+ return PPB_GRAPHICS2D_DEV_INTERFACE_0_1;
+}
+
+template <> const char* interface_name<PPB_Graphics2D_Dev_0_2>() {
+ return PPB_GRAPHICS2D_DEV_INTERFACE_0_2;
}
} // namespace
// static
bool Graphics2D_Dev::SupportsScale() {
- return has_interface<PPB_Graphics2D_Dev>();
+ return has_interface<PPB_Graphics2D_Dev_0_1>() ||
+ has_interface<PPB_Graphics2D_Dev_0_2>();
}
bool Graphics2D_Dev::SetScale(float scale) {
- if (!has_interface<PPB_Graphics2D_Dev>())
- return false;
- return PP_ToBool(get_interface<PPB_Graphics2D_Dev>()->SetScale(pp_resource(),
- scale));
+ if (has_interface<PPB_Graphics2D_Dev_0_2>()) {
+ return PP_ToBool(get_interface<PPB_Graphics2D_Dev_0_2>()->SetScale(
+ pp_resource(), scale));
+ }
+ if (has_interface<PPB_Graphics2D_Dev_0_1>()) {
+ return PP_ToBool(get_interface<PPB_Graphics2D_Dev_0_1>()->SetScale(
+ pp_resource(), scale));
+ }
+ return false;
}
float Graphics2D_Dev::GetScale() {
- if (!has_interface<PPB_Graphics2D_Dev>())
- return 1.0f;
- return get_interface<PPB_Graphics2D_Dev>()->GetScale(pp_resource());
+ if (has_interface<PPB_Graphics2D_Dev_0_2>())
+ return get_interface<PPB_Graphics2D_Dev_0_2>()->GetScale(pp_resource());
+ if (has_interface<PPB_Graphics2D_Dev_0_1>())
+ return get_interface<PPB_Graphics2D_Dev_0_1>()->GetScale(pp_resource());
+ return 1.0f;
+}
+
+void Graphics2D_Dev::SetOffset(const pp::Point& offset) {
+ if (!has_interface<PPB_Graphics2D_Dev_0_2>())
+ return;
+ get_interface<PPB_Graphics2D_Dev_0_2>()->SetOffset(pp_resource(),
+ &offset.pp_point());
}
} // namespace pp
diff --git a/ppapi/cpp/dev/graphics_2d_dev.h b/ppapi/cpp/dev/graphics_2d_dev.h
index 3dc8c71..d3a277b 100644
--- a/ppapi/cpp/dev/graphics_2d_dev.h
+++ b/ppapi/cpp/dev/graphics_2d_dev.h
@@ -9,6 +9,8 @@
namespace pp {
+class Point;
+
// Graphics2DDev is a version of Graphics2D that exposes under-development APIs
// for HiDPI
class Graphics2D_Dev : public Graphics2D {
@@ -48,6 +50,14 @@ class Graphics2D_Dev : public Graphics2D {
/// @return Returns the scale factor for the graphics context. If the resource
/// is invalid, 0.0 will be returned.
float GetScale();
+
+ /// Set the offset into the plugin element at which the graphics context is
+ /// painted. This allows a portion of the plugin element to be painted to.
+ /// The new offset will only be applied after Flush() has been called.
+ ///
+ /// @param[in] resource A <code>Graphics2D</code> context resource.
+ /// @param[in] offset The offset at which the context should be painted.
+ void SetOffset(const pp::Point& offset);
};
} // namespace pp
diff --git a/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c b/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c
index 98175e8..ff41829 100644
--- a/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c
+++ b/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c
@@ -1901,6 +1901,8 @@ static int32_t Pnacl_M14_PPB_Font_Dev_PixelOffsetForCharacter(PP_Resource font,
/* Not generating wrapper methods for PPB_Graphics2D_Dev_0_1 */
+/* Not generating wrapper methods for PPB_Graphics2D_Dev_0_2 */
+
/* Begin wrapper methods for PPB_IMEInputEvent_Dev_0_1 */
static PP_Bool Pnacl_M16_PPB_IMEInputEvent_Dev_IsIMEInputEvent(PP_Resource resource) {
@@ -4615,6 +4617,8 @@ struct PPB_Font_Dev_0_6 Pnacl_Wrappers_PPB_Font_Dev_0_6 = {
/* Not generating wrapper interface for PPB_Graphics2D_Dev_0_1 */
+/* Not generating wrapper interface for PPB_Graphics2D_Dev_0_2 */
+
struct PPB_IMEInputEvent_Dev_0_1 Pnacl_Wrappers_PPB_IMEInputEvent_Dev_0_1 = {
.IsIMEInputEvent = (PP_Bool (*)(PP_Resource resource))&Pnacl_M16_PPB_IMEInputEvent_Dev_IsIMEInputEvent,
.GetText = (struct PP_Var (*)(PP_Resource ime_event))&Pnacl_M16_PPB_IMEInputEvent_Dev_GetText,
diff --git a/ppapi/proxy/graphics_2d_resource.cc b/ppapi/proxy/graphics_2d_resource.cc
index 3bad2e4e..cd7cf4f 100644
--- a/ppapi/proxy/graphics_2d_resource.cc
+++ b/ppapi/proxy/graphics_2d_resource.cc
@@ -111,6 +111,10 @@ float Graphics2DResource::GetScale() {
return scale_;
}
+void Graphics2DResource::SetOffset(const PP_Point* offset) {
+ Post(RENDERER, PpapiHostMsg_Graphics2D_SetOffset(*offset));
+}
+
int32_t Graphics2DResource::Flush(scoped_refptr<TrackedCallback> callback) {
// If host is not even created, return failure immediately. This can happen
// when failed to initialize (in constructor).
diff --git a/ppapi/proxy/graphics_2d_resource.h b/ppapi/proxy/graphics_2d_resource.h
index b7ec30c..0fc3844 100644
--- a/ppapi/proxy/graphics_2d_resource.h
+++ b/ppapi/proxy/graphics_2d_resource.h
@@ -40,6 +40,7 @@ class PPAPI_PROXY_EXPORT Graphics2DResource
virtual void ReplaceContents(PP_Resource image_data) OVERRIDE;
virtual PP_Bool SetScale(float scale) OVERRIDE;
virtual float GetScale() OVERRIDE;
+ virtual void SetOffset(const PP_Point* offset) OVERRIDE;
virtual int32_t Flush(scoped_refptr<TrackedCallback> callback) OVERRIDE;
virtual bool ReadImageData(PP_Resource image,
const PP_Point* top_left) OVERRIDE;
diff --git a/ppapi/proxy/ppapi_messages.h b/ppapi/proxy/ppapi_messages.h
index daa9445..291851e 100644
--- a/ppapi/proxy/ppapi_messages.h
+++ b/ppapi/proxy/ppapi_messages.h
@@ -1363,6 +1363,8 @@ IPC_MESSAGE_CONTROL1(PpapiHostMsg_Graphics2D_ReplaceContents,
ppapi::HostResource /* image_data */)
IPC_MESSAGE_CONTROL1(PpapiHostMsg_Graphics2D_Dev_SetScale,
float /* scale */)
+IPC_MESSAGE_CONTROL1(PpapiHostMsg_Graphics2D_SetOffset,
+ PP_Point /* offset */)
// Graphics2D, plugin -> host -> plugin
IPC_MESSAGE_CONTROL0(PpapiHostMsg_Graphics2D_Flush)
@@ -1386,7 +1388,6 @@ IPC_MESSAGE_CONTROL1(PpapiPluginMsg_NetworkMonitor_NetworkList,
ppapi::proxy::SerializedNetworkList /* network_list */)
IPC_MESSAGE_CONTROL0(PpapiPluginMsg_NetworkMonitor_Forbidden)
-
// NetworkProxy ----------------------------------------------------------------
IPC_MESSAGE_CONTROL0(PpapiHostMsg_NetworkProxy_Create)
diff --git a/ppapi/thunk/interfaces_ppb_public_dev.h b/ppapi/thunk/interfaces_ppb_public_dev.h
index d07f5dc..1ad85bc 100644
--- a/ppapi/thunk/interfaces_ppb_public_dev.h
+++ b/ppapi/thunk/interfaces_ppb_public_dev.h
@@ -68,6 +68,8 @@ PROXIED_IFACE(NoAPIName, PPB_CRYPTO_DEV_INTERFACE_0_1, PPB_Crypto_Dev_0_1)
PROXIED_IFACE(NoAPIName, PPB_DEVICEREF_DEV_INTERFACE_0_1, PPB_DeviceRef_Dev_0_1)
PROXIED_IFACE(NoAPIName, PPB_GRAPHICS2D_DEV_INTERFACE_0_1,
PPB_Graphics2D_Dev_0_1)
+PROXIED_IFACE(NoAPIName, PPB_GRAPHICS2D_DEV_INTERFACE_0_2,
+ PPB_Graphics2D_Dev_0_2)
PROXIED_IFACE(PPB_Instance, PPB_CHAR_SET_DEV_INTERFACE_0_4, PPB_CharSet_Dev_0_4)
PROXIED_IFACE(PPB_Instance, PPB_URLUTIL_DEV_INTERFACE_0_6, PPB_URLUtil_Dev_0_6)
PROXIED_IFACE(PPB_Instance, PPB_URLUTIL_DEV_INTERFACE_0_7, PPB_URLUtil_Dev_0_7)
diff --git a/ppapi/thunk/ppb_graphics_2d_api.h b/ppapi/thunk/ppb_graphics_2d_api.h
index 4e1bda3..300aefe 100644
--- a/ppapi/thunk/ppb_graphics_2d_api.h
+++ b/ppapi/thunk/ppb_graphics_2d_api.h
@@ -36,6 +36,7 @@ class PPAPI_THUNK_EXPORT PPB_Graphics2D_API {
// Dev interface.
virtual PP_Bool SetScale(float scale) = 0;
virtual float GetScale() = 0;
+ virtual void SetOffset(const PP_Point* offset) = 0;
// Test only
virtual bool ReadImageData(PP_Resource image, const PP_Point* top_left) = 0;
diff --git a/ppapi/thunk/ppb_graphics_2d_dev_thunk.cc b/ppapi/thunk/ppb_graphics_2d_dev_thunk.cc
index 760ecee..f178074 100644
--- a/ppapi/thunk/ppb_graphics_2d_dev_thunk.cc
+++ b/ppapi/thunk/ppb_graphics_2d_dev_thunk.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// From dev/ppb_graphics_2d_dev.idl modified Fri Apr 26 08:52:02 2013.
+// From dev/ppb_graphics_2d_dev.idl modified Wed Oct 2 17:27:31 2013.
#include "ppapi/c/dev/ppb_graphics_2d_dev.h"
#include "ppapi/c/pp_errors.h"
@@ -34,16 +34,34 @@ float GetScale(PP_Resource resource) {
return enter.object()->GetScale();
}
+void SetOffset(PP_Resource resource, const struct PP_Point* offset) {
+ VLOG(4) << "PPB_Graphics2D_Dev::SetOffset()";
+ EnterResource<PPB_Graphics2D_API> enter(resource, true);
+ if (enter.failed())
+ return;
+ enter.object()->SetOffset(offset);
+}
+
const PPB_Graphics2D_Dev_0_1 g_ppb_graphics2d_dev_thunk_0_1 = {
&SetScale,
&GetScale
};
+const PPB_Graphics2D_Dev_0_2 g_ppb_graphics2d_dev_thunk_0_2 = {
+ &SetScale,
+ &GetScale,
+ &SetOffset
+};
+
} // namespace
const PPB_Graphics2D_Dev_0_1* GetPPB_Graphics2D_Dev_0_1_Thunk() {
return &g_ppb_graphics2d_dev_thunk_0_1;
}
+const PPB_Graphics2D_Dev_0_2* GetPPB_Graphics2D_Dev_0_2_Thunk() {
+ return &g_ppb_graphics2d_dev_thunk_0_2;
+}
+
} // namespace thunk
} // namespace ppapi