mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Add support for shared texture and external BeginFrame in OSR mode (issue #1006)
- Add CefWindowInfo::shared_texture_enabled and CefRenderHandler::OnAcceleratedPaint for shared texture support. Currently only supported on Windows (D3D11). - Add CefWindowInfo::external_begin_frame_enabled and CefBrowserHost::SendExternalBeginFrame for external begin frame support.
This commit is contained in:
committed by
Marshall Greenblatt
parent
09afa3a843
commit
713eebcafc
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=ff3ebc51ed5743aabac0be94caf2edeedbd413b7$
|
||||
// $hash=caba7ed3d6e19f7a4499fb48f627c2f5b40e46bc$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_BROWSER_CAPI_H_
|
||||
@@ -571,6 +571,13 @@ typedef struct _cef_browser_host_t {
|
||||
void(CEF_CALLBACK* invalidate)(struct _cef_browser_host_t* self,
|
||||
cef_paint_element_type_t type);
|
||||
|
||||
///
|
||||
// Issue a BeginFrame request to Chromium. Only valid when
|
||||
// cef_window_tInfo::external_begin_frame_enabled is set to true (1).
|
||||
///
|
||||
void(CEF_CALLBACK* send_external_begin_frame)(
|
||||
struct _cef_browser_host_t* self);
|
||||
|
||||
///
|
||||
// Send a key event to the browser.
|
||||
///
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=d259309846e69d866a834aa701bbf8c9562dd117$
|
||||
// $hash=ef8abd4a01fe1047abc0d2ab1c359704611a60ac$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_RENDER_HANDLER_CAPI_H_
|
||||
@@ -142,6 +142,18 @@ typedef struct _cef_render_handler_t {
|
||||
int width,
|
||||
int height);
|
||||
|
||||
///
|
||||
// Called when an view has been rendered to the given shared texture handle.
|
||||
// Currently, the shared handle represents a D3D11 Texture2D that can be
|
||||
// accessed with the OpenSharedResource function available from a ID3D11Device
|
||||
///
|
||||
void(CEF_CALLBACK* on_accelerated_paint)(struct _cef_render_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
cef_paint_element_type_t type,
|
||||
size_t dirtyRectsCount,
|
||||
cef_rect_t const* dirtyRects,
|
||||
void* shared_handle);
|
||||
|
||||
///
|
||||
// Called when the browser's cursor has changed. If |type| is CT_CUSTOM then
|
||||
// |custom_cursor_info| will be populated with the custom cursor information.
|
||||
|
@@ -595,6 +595,13 @@ class CefBrowserHost : public virtual CefBaseRefCounted {
|
||||
/*--cef()--*/
|
||||
virtual void Invalidate(PaintElementType type) = 0;
|
||||
|
||||
///
|
||||
// Issue a BeginFrame request to Chromium. Only valid when
|
||||
// CefWindowInfo::external_begin_frame_enabled is set to true.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void SendExternalBeginFrame() = 0;
|
||||
|
||||
///
|
||||
// Send a key event to the browser.
|
||||
///
|
||||
|
@@ -135,7 +135,8 @@ class CefRenderHandler : public virtual CefBaseRefCounted {
|
||||
// contains the pixel data for the whole image. |dirtyRects| contains the set
|
||||
// of rectangles in pixel coordinates that need to be repainted. |buffer| will
|
||||
// be |width|*|height|*4 bytes in size and represents a BGRA image with an
|
||||
// upper-left origin.
|
||||
// upper-left origin. This method is only called when
|
||||
// CefWindowInfo::shared_texture_enabled is set to false.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void OnPaint(CefRefPtr<CefBrowser> browser,
|
||||
@@ -145,6 +146,21 @@ class CefRenderHandler : public virtual CefBaseRefCounted {
|
||||
int width,
|
||||
int height) = 0;
|
||||
|
||||
///
|
||||
// Called when an element has been rendered to the shared texture handle.
|
||||
// |type| indicates whether the element is the view or the popup widget.
|
||||
// |dirtyRects| contains the set of rectangles in pixel coordinates that need
|
||||
// to be repainted. |shared_handle| is the handle for a D3D11 Texture2D that
|
||||
// can be accessed via ID3D11Device using the OpenSharedResource method. This
|
||||
// method is only called when CefWindowInfo::shared_texture_enabled is set to
|
||||
// true, and is currently only supported on Windows.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void OnAcceleratedPaint(CefRefPtr<CefBrowser> browser,
|
||||
PaintElementType type,
|
||||
const RectList& dirtyRects,
|
||||
void* shared_handle) {}
|
||||
|
||||
///
|
||||
// Called when the browser's cursor has changed. If |type| is CT_CUSTOM then
|
||||
// |custom_cursor_info| will be populated with the custom cursor information.
|
||||
|
@@ -82,6 +82,8 @@ struct CefWindowInfoTraits {
|
||||
target->height = src->height;
|
||||
target->parent_window = src->parent_window;
|
||||
target->windowless_rendering_enabled = src->windowless_rendering_enabled;
|
||||
target->shared_texture_enabled = src->shared_texture_enabled;
|
||||
target->external_begin_frame_enabled = src->external_begin_frame_enabled;
|
||||
target->window = src->window;
|
||||
}
|
||||
};
|
||||
|
@@ -88,6 +88,8 @@ struct CefWindowInfoTraits {
|
||||
target->hidden = src->hidden;
|
||||
target->parent_view = src->parent_view;
|
||||
target->windowless_rendering_enabled = src->windowless_rendering_enabled;
|
||||
target->shared_texture_enabled = src->shared_texture_enabled;
|
||||
target->external_begin_frame_enabled = src->external_begin_frame_enabled;
|
||||
target->view = src->view;
|
||||
}
|
||||
};
|
||||
|
@@ -96,6 +96,19 @@ typedef struct _cef_window_info_t {
|
||||
///
|
||||
int windowless_rendering_enabled;
|
||||
|
||||
///
|
||||
// Set to true (1) to enable shared textures for windowless rendering. Only
|
||||
// valid if windowless_rendering_enabled above is also set to true. Currently
|
||||
// only supported on Windows (D3D11).
|
||||
///
|
||||
int shared_texture_enabled;
|
||||
|
||||
///
|
||||
// Set to true (1) to enable the ability to issue BeginFrame requests from the
|
||||
// client application by calling CefBrowserHost::SendExternalBeginFrame.
|
||||
///
|
||||
int external_begin_frame_enabled;
|
||||
|
||||
///
|
||||
// Pointer for the new browser window. Only used with windowed rendering.
|
||||
///
|
||||
|
@@ -106,6 +106,19 @@ typedef struct _cef_window_info_t {
|
||||
///
|
||||
int windowless_rendering_enabled;
|
||||
|
||||
///
|
||||
// Set to true (1) to enable shared textures for windowless rendering. Only
|
||||
// valid if windowless_rendering_enabled above is also set to true. Currently
|
||||
// only supported on Windows (D3D11).
|
||||
///
|
||||
int shared_texture_enabled;
|
||||
|
||||
///
|
||||
// Set to true (1) to enable the ability to issue BeginFrame from the client
|
||||
// application.
|
||||
///
|
||||
int external_begin_frame_enabled;
|
||||
|
||||
///
|
||||
// NSView pointer for the new browser view. Only used with windowed rendering.
|
||||
///
|
||||
|
@@ -84,6 +84,19 @@ typedef struct _cef_window_info_t {
|
||||
///
|
||||
int windowless_rendering_enabled;
|
||||
|
||||
///
|
||||
// Set to true (1) to enable shared textures for windowless rendering. Only
|
||||
// valid if windowless_rendering_enabled above is also set to true. Currently
|
||||
// only supported on Windows (D3D11).
|
||||
///
|
||||
int shared_texture_enabled;
|
||||
|
||||
///
|
||||
// Set to true (1) to enable the ability to issue BeginFrame requests from the
|
||||
// client application by calling CefBrowserHost::SendExternalBeginFrame.
|
||||
///
|
||||
int external_begin_frame_enabled;
|
||||
|
||||
///
|
||||
// Handle for the new browser window. Only used with windowed rendering.
|
||||
///
|
||||
|
@@ -88,6 +88,8 @@ struct CefWindowInfoTraits {
|
||||
target->parent_window = src->parent_window;
|
||||
target->menu = src->menu;
|
||||
target->windowless_rendering_enabled = src->windowless_rendering_enabled;
|
||||
target->shared_texture_enabled = src->shared_texture_enabled;
|
||||
target->external_begin_frame_enabled = src->external_begin_frame_enabled;
|
||||
target->window = src->window;
|
||||
}
|
||||
};
|
||||
|
Reference in New Issue
Block a user