diff options
-rw-r--r-- | chrome/browser/component_updater/ppapi_utils.cc | 1 | ||||
-rw-r--r-- | content/renderer/pepper/plugin_module.cc | 1 | ||||
-rw-r--r-- | native_client_sdk/src/libraries/ppapi/library.dsc | 1 | ||||
-rw-r--r-- | native_client_sdk/src/libraries/ppapi_cpp/library.dsc | 3 | ||||
-rw-r--r-- | ppapi/BUILD.gn | 1 | ||||
-rw-r--r-- | ppapi/api/dev/ppb_view_dev.idl | 46 | ||||
-rw-r--r-- | ppapi/c/dev/ppb_view_dev.h | 65 | ||||
-rw-r--r-- | ppapi/cpp/dev/view_dev.cc | 32 | ||||
-rw-r--r-- | ppapi/cpp/dev/view_dev.h | 44 | ||||
-rw-r--r-- | ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c | 4 | ||||
-rw-r--r-- | ppapi/ppapi_shared.gypi | 1 | ||||
-rw-r--r-- | ppapi/ppapi_sources.gypi | 2 | ||||
-rw-r--r-- | ppapi/proxy/interface_list.cc | 1 | ||||
-rw-r--r-- | ppapi/tests/all_c_includes.h | 1 | ||||
-rw-r--r-- | ppapi/tests/all_cpp_includes.h | 1 | ||||
-rw-r--r-- | ppapi/thunk/interfaces_ppb_public_dev.h | 2 | ||||
-rw-r--r-- | ppapi/thunk/ppb_view_dev_thunk.cc | 47 |
17 files changed, 253 insertions, 0 deletions
diff --git a/chrome/browser/component_updater/ppapi_utils.cc b/chrome/browser/component_updater/ppapi_utils.cc index f9d51d5..d8bee1e 100644 --- a/chrome/browser/component_updater/ppapi_utils.cc +++ b/chrome/browser/component_updater/ppapi_utils.cc @@ -27,6 +27,7 @@ #include "ppapi/c/dev/ppb_var_deprecated.h" #include "ppapi/c/dev/ppb_video_capture_dev.h" #include "ppapi/c/dev/ppb_video_decoder_dev.h" +#include "ppapi/c/dev/ppb_view_dev.h" #include "ppapi/c/dev/ppb_widget_dev.h" #include "ppapi/c/dev/ppb_zoom_dev.h" #include "ppapi/c/ppb_audio.h" diff --git a/content/renderer/pepper/plugin_module.cc b/content/renderer/pepper/plugin_module.cc index a2157c9..9a46794 100644 --- a/content/renderer/pepper/plugin_module.cc +++ b/content/renderer/pepper/plugin_module.cc @@ -49,6 +49,7 @@ #include "ppapi/c/dev/ppb_var_deprecated.h" #include "ppapi/c/dev/ppb_video_capture_dev.h" #include "ppapi/c/dev/ppb_video_decoder_dev.h" +#include "ppapi/c/dev/ppb_view_dev.h" #include "ppapi/c/dev/ppb_widget_dev.h" #include "ppapi/c/dev/ppb_zoom_dev.h" #include "ppapi/c/pp_module.h" diff --git a/native_client_sdk/src/libraries/ppapi/library.dsc b/native_client_sdk/src/libraries/ppapi/library.dsc index 47749f9..b213395 100644 --- a/native_client_sdk/src/libraries/ppapi/library.dsc +++ b/native_client_sdk/src/libraries/ppapi/library.dsc @@ -105,6 +105,7 @@ 'ppb_trace_event_dev.h', 'ppb_truetype_font_dev.h', 'ppb_var_deprecated.h', + 'ppb_view_dev.h', 'ppb_zoom_dev.h', 'pp_cursor_type_dev.h', 'ppp_class_deprecated.h', diff --git a/native_client_sdk/src/libraries/ppapi_cpp/library.dsc b/native_client_sdk/src/libraries/ppapi_cpp/library.dsc index eb388ec..1ca014e 100644 --- a/native_client_sdk/src/libraries/ppapi_cpp/library.dsc +++ b/native_client_sdk/src/libraries/ppapi_cpp/library.dsc @@ -71,6 +71,8 @@ 'scriptable_object_deprecated.cc', 'selection_dev.cc', 'truetype_font_dev.cc', + 'view_dev.cc', + 'zoom_dev.cc', # ppapi/utility/graphics 'paint_aggregator.cc', @@ -158,6 +160,7 @@ 'truetype_font_dev.h', 'video_capture_client_dev.h', 'video_decoder_client_dev.h', + 'view_dev.h', 'widget_client_dev.h', 'zoom_dev.h', ], diff --git a/ppapi/BUILD.gn b/ppapi/BUILD.gn index 7b6aef7..c0a4768 100644 --- a/ppapi/BUILD.gn +++ b/ppapi/BUILD.gn @@ -331,6 +331,7 @@ component("ppapi_shared") { "thunk/ppb_video_source_private_api.h", "thunk/ppb_video_source_private_thunk.cc", "thunk/ppb_view_api.h", + "thunk/ppb_view_dev_thunk.cc", "thunk/ppb_view_thunk.cc", "thunk/ppb_websocket_api.h", "thunk/ppb_websocket_thunk.cc", diff --git a/ppapi/api/dev/ppb_view_dev.idl b/ppapi/api/dev/ppb_view_dev.idl new file mode 100644 index 0000000..0846bd8 --- /dev/null +++ b/ppapi/api/dev/ppb_view_dev.idl @@ -0,0 +1,46 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* This file contains the <code>PPB_View_Dev</code> interface. */ + +[generate_thunk] + +label Chrome { + M22 = 0.1 +}; + +/* PPB_View_Dev interface */ +interface PPB_View_Dev { + /** + * GetDeviceScale returns the scale factor between device pixels and 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. + */ + 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. + */ + float_t GetCSSScale([in] PP_Resource resource); +}; + diff --git a/ppapi/c/dev/ppb_view_dev.h b/ppapi/c/dev/ppb_view_dev.h new file mode 100644 index 0000000..1995193 --- /dev/null +++ b/ppapi/c/dev/ppb_view_dev.h @@ -0,0 +1,65 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From dev/ppb_view_dev.idl modified Mon Jun 18 14:55:58 2012. */ + +#ifndef PPAPI_C_DEV_PPB_VIEW_DEV_H_ +#define PPAPI_C_DEV_PPB_VIEW_DEV_H_ + +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_stdint.h" + +#define PPB_VIEW_DEV_INTERFACE_0_1 "PPB_View(Dev);0.1" +#define PPB_VIEW_DEV_INTERFACE PPB_VIEW_DEV_INTERFACE_0_1 + +/** + * @file + * This file contains the <code>PPB_View_Dev</code> interface. */ + + +/** + * @addtogroup Interfaces + * @{ + */ +/* PPB_View_Dev interface */ +struct PPB_View_Dev_0_1 { + /** + * GetDeviceScale returns the scale factor between device pixels and 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. + */ + float (*GetDeviceScale)(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. + */ + float (*GetCSSScale)(PP_Resource resource); +}; + +typedef struct PPB_View_Dev_0_1 PPB_View_Dev; +/** + * @} + */ + +#endif /* PPAPI_C_DEV_PPB_VIEW_DEV_H_ */ + diff --git a/ppapi/cpp/dev/view_dev.cc b/ppapi/cpp/dev/view_dev.cc new file mode 100644 index 0000000..473e9b4 --- /dev/null +++ b/ppapi/cpp/dev/view_dev.cc @@ -0,0 +1,32 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ppapi/cpp/dev/view_dev.h" + +#include "ppapi/c/dev/ppb_view_dev.h" +#include "ppapi/cpp/module_impl.h" + +namespace pp { + +namespace { + +template <> const char* interface_name<PPB_View_Dev>() { + return PPB_VIEW_DEV_INTERFACE; +} + +} // namespace + +float ViewDev::GetDeviceScale() const { + if (!has_interface<PPB_View_Dev>()) + return 1.0f; + return get_interface<PPB_View_Dev>()->GetDeviceScale(pp_resource()); +} + +float ViewDev::GetCSSScale() const { + if (!has_interface<PPB_View_Dev>()) + return 1.0f; + return get_interface<PPB_View_Dev>()->GetCSSScale(pp_resource()); +} + +} // namespace pp diff --git a/ppapi/cpp/dev/view_dev.h b/ppapi/cpp/dev/view_dev.h new file mode 100644 index 0000000..2c99e48 --- /dev/null +++ b/ppapi/cpp/dev/view_dev.h @@ -0,0 +1,44 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef PPAPI_CPP_DEV_VIEW_DEV_H_ +#define PPAPI_CPP_DEV_VIEW_DEV_H_ + +#include "ppapi/cpp/view.h" + +namespace pp { + +// ViewDev is a version of View that exposes under-development APIs related to +// HiDPI +class ViewDev : public View { + public: + ViewDev() : View() {} + ViewDev(const View& other) : View(other) {} + + virtual ~ViewDev() {} + + /// GetDeviceScale returns the scale factor between device pixels and 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. + /// + /// @return A <code>float</code> value representing the number of device + /// pixels per DIP. + float GetDeviceScale() const; + + /// 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. + /// + /// @return A <code>float</code> value representing the number of DIPs per CSS + /// pixel. + float GetCSSScale() const; +}; + +} // namespace pp + +#endif // PPAPI_CPP_DEV_VIEW_DEV_H_ 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 121028d..3c3dd81 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 @@ -2668,6 +2668,8 @@ static void Pnacl_M14_PPB_VideoDecoder_Dev_Destroy(PP_Resource video_decoder) { /* End wrapper methods for PPB_VideoDecoder_Dev_0_16 */ +/* Not generating wrapper methods for PPB_View_Dev_0_1 */ + /* Not generating wrapper methods for PPB_Widget_Dev_0_3 */ /* Not generating wrapper methods for PPB_Widget_Dev_0_4 */ @@ -5165,6 +5167,8 @@ static const struct PPB_VideoDecoder_Dev_0_16 Pnacl_Wrappers_PPB_VideoDecoder_De .Destroy = (void (*)(PP_Resource video_decoder))&Pnacl_M14_PPB_VideoDecoder_Dev_Destroy }; +/* Not generating wrapper interface for PPB_View_Dev_0_1 */ + /* Not generating wrapper interface for PPB_Widget_Dev_0_3 */ /* Not generating wrapper interface for PPB_Widget_Dev_0_4 */ diff --git a/ppapi/ppapi_shared.gypi b/ppapi/ppapi_shared.gypi index 27708f9..9fe1375 100644 --- a/ppapi/ppapi_shared.gypi +++ b/ppapi/ppapi_shared.gypi @@ -285,6 +285,7 @@ 'thunk/ppb_video_source_private_api.h', 'thunk/ppb_video_source_private_thunk.cc', 'thunk/ppb_view_api.h', + 'thunk/ppb_view_dev_thunk.cc', 'thunk/ppb_view_thunk.cc', 'thunk/ppb_websocket_api.h', 'thunk/ppb_websocket_thunk.cc', diff --git a/ppapi/ppapi_sources.gypi b/ppapi/ppapi_sources.gypi index 180ea14..10f2d16 100644 --- a/ppapi/ppapi_sources.gypi +++ b/ppapi/ppapi_sources.gypi @@ -290,6 +290,8 @@ 'cpp/dev/video_decoder_client_dev.h', 'cpp/dev/video_decoder_dev.cc', 'cpp/dev/video_decoder_dev.h', + 'cpp/dev/view_dev.cc', + 'cpp/dev/view_dev.h', 'cpp/dev/widget_client_dev.cc', 'cpp/dev/widget_client_dev.h', 'cpp/dev/widget_dev.cc', diff --git a/ppapi/proxy/interface_list.cc b/ppapi/proxy/interface_list.cc index da53062..295069e 100644 --- a/ppapi/proxy/interface_list.cc +++ b/ppapi/proxy/interface_list.cc @@ -26,6 +26,7 @@ #include "ppapi/c/dev/ppb_url_util_dev.h" #include "ppapi/c/dev/ppb_var_deprecated.h" #include "ppapi/c/dev/ppb_video_capture_dev.h" +#include "ppapi/c/dev/ppb_view_dev.h" #include "ppapi/c/dev/ppb_widget_dev.h" #include "ppapi/c/dev/ppb_zoom_dev.h" #include "ppapi/c/ppb_audio.h" diff --git a/ppapi/tests/all_c_includes.h b/ppapi/tests/all_c_includes.h index 6eaf25e..07b6b43 100644 --- a/ppapi/tests/all_c_includes.h +++ b/ppapi/tests/all_c_includes.h @@ -28,6 +28,7 @@ #include "ppapi/c/dev/ppb_url_util_dev.h" #include "ppapi/c/dev/ppb_var_deprecated.h" #include "ppapi/c/dev/ppb_video_decoder_dev.h" +#include "ppapi/c/dev/ppb_view_dev.h" #include "ppapi/c/dev/ppb_widget_dev.h" #include "ppapi/c/dev/ppb_zoom_dev.h" #include "ppapi/c/dev/ppp_class_deprecated.h" diff --git a/ppapi/tests/all_cpp_includes.h b/ppapi/tests/all_cpp_includes.h index 706c55c..f0d5006 100644 --- a/ppapi/tests/all_cpp_includes.h +++ b/ppapi/tests/all_cpp_includes.h @@ -28,6 +28,7 @@ #include "ppapi/cpp/dev/text_input_dev.h" #include "ppapi/cpp/dev/url_util_dev.h" #include "ppapi/cpp/dev/video_decoder_dev.h" +#include "ppapi/cpp/dev/view_dev.h" #include "ppapi/cpp/dev/widget_client_dev.h" #include "ppapi/cpp/dev/widget_dev.h" #include "ppapi/cpp/dev/zoom_dev.h" diff --git a/ppapi/thunk/interfaces_ppb_public_dev.h b/ppapi/thunk/interfaces_ppb_public_dev.h index 7424c978..9597843 100644 --- a/ppapi/thunk/interfaces_ppb_public_dev.h +++ b/ppapi/thunk/interfaces_ppb_public_dev.h @@ -18,6 +18,8 @@ PROXIED_IFACE(PPB_MEMORY_DEV_INTERFACE_0_1, PPB_Memory_Dev_0_1) PROXIED_IFACE(PPB_PRINTING_DEV_INTERFACE_0_7, PPB_Printing_Dev_0_7) PROXIED_IFACE(PPB_TEXTINPUT_DEV_INTERFACE_0_2, PPB_TextInput_Dev_0_2) PROXIED_IFACE(PPB_TRUETYPEFONT_DEV_INTERFACE_0_1, PPB_TrueTypeFont_Dev_0_1) +PROXIED_IFACE(PPB_VIEW_DEV_INTERFACE_0_1, PPB_View_Dev_0_1) +PROXIED_IFACE(PPB_ZOOM_DEV_INTERFACE_0_2, PPB_Zoom_Dev_0_2) #if !defined(OS_NACL) PROXIED_API(PPB_Buffer) diff --git a/ppapi/thunk/ppb_view_dev_thunk.cc b/ppapi/thunk/ppb_view_dev_thunk.cc new file mode 100644 index 0000000..7ec98f9 --- /dev/null +++ b/ppapi/thunk/ppb_view_dev_thunk.cc @@ -0,0 +1,47 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// From dev/ppb_view_dev.idl modified Tue Aug 20 08:13:36 2013. + +#include "ppapi/c/dev/ppb_view_dev.h" +#include "ppapi/c/pp_errors.h" +#include "ppapi/shared_impl/tracked_callback.h" +#include "ppapi/thunk/enter.h" +#include "ppapi/thunk/ppapi_thunk_export.h" +#include "ppapi/thunk/ppb_view_api.h" + +namespace ppapi { +namespace thunk { + +namespace { + +float GetDeviceScale(PP_Resource resource) { + VLOG(4) << "PPB_View_Dev::GetDeviceScale()"; + EnterResource<PPB_View_API> enter(resource, true); + if (enter.failed()) + return 0.0f; + return enter.object()->GetDeviceScale(); +} + +float GetCSSScale(PP_Resource resource) { + VLOG(4) << "PPB_View_Dev::GetCSSScale()"; + EnterResource<PPB_View_API> enter(resource, true); + if (enter.failed()) + return 0.0f; + return enter.object()->GetCSSScale(); +} + +const PPB_View_Dev_0_1 g_ppb_view_dev_thunk_0_1 = { + &GetDeviceScale, + &GetCSSScale +}; + +} // namespace + +PPAPI_THUNK_EXPORT const PPB_View_Dev_0_1* GetPPB_View_Dev_0_1_Thunk() { + return &g_ppb_view_dev_thunk_0_1; +} + +} // namespace thunk +} // namespace ppapi |