mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Implement off-screen rendering support using delegated rendering (issue #1257).
This implementation supports both GPU compositing and software compositing (used when GPU is not supported or when passing `--disable-gpu --disable-gpu-compositing` command-line flags). GPU-accelerated features (WebGL and 3D CSS) that did not work with the previous off-screen rendering implementation do work with this implementation when GPU support is available. Rendering now operates on a per-frame basis. The frame rate is configurable via CefBrowserSettings.windowless_frame_rate up to a maximum of 60fps (potentially limited by how fast the system can generate new frames). CEF generates a bitmap from the compositor backing and passes it to CefRenderHandler::OnPaint. The previous CefRenderHandler/CefBrowserHost API for off-screen rendering has been restored mostly as-is with some minor changes: - CefBrowserHost::Invalidate no longer accepts a CefRect region argument. Instead of invalidating a specific region it now triggers generation of a new frame. - The |dirtyRects| argument to CefRenderHandler::OnPaint will now always be a single CefRect representing the whole view (frame) size. Previously, invalidated regions were listed separately. - Linux: CefBrowserHost::SendKeyEvent now expects X11 event information instead of GTK event information. See cefclient for an example of converting GTK events to the necessary format. - Sizes passed to the CefRenderHandler OnPaint and OnPopupSize methods are now already DPI scaled. Previously, the client had to perform DPI scaling. - Includes drag&drop implementation from issue #1032. - Includes unit test fixes from issue #1245. git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1751 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
@ -72,6 +72,7 @@ class CefCriticalSection {
|
||||
#define CefCursorHandle cef_cursor_handle_t
|
||||
#define CefEventHandle cef_event_handle_t
|
||||
#define CefWindowHandle cef_window_handle_t
|
||||
#define CefTextInputContext cef_text_input_context_t
|
||||
|
||||
struct CefMainArgsTraits {
|
||||
typedef cef_main_args_t struct_type;
|
||||
@ -113,6 +114,8 @@ struct CefWindowInfoTraits {
|
||||
target->width = src->width;
|
||||
target->height = src->height;
|
||||
target->parent_window = src->parent_window;
|
||||
target->windowless_rendering_enabled = src->windowless_rendering_enabled;
|
||||
target->transparent_painting_enabled = src->transparent_painting_enabled;
|
||||
target->window = src->window;
|
||||
}
|
||||
};
|
||||
@ -137,6 +140,24 @@ class CefWindowInfo : public CefStructBase<CefWindowInfoTraits> {
|
||||
width = windowRect.width;
|
||||
height = windowRect.height;
|
||||
}
|
||||
|
||||
///
|
||||
// Create the browser using windowless (off-screen) rendering. No window
|
||||
// will be created for the browser and all rendering will occur via the
|
||||
// CefRenderHandler interface. The |parent| value will be used to identify
|
||||
// monitor info and to act as the parent window for dialogs, context menus,
|
||||
// etc. If |parent| is not provided then the main screen monitor will be used
|
||||
// and some functionality that requires a parent window may not function
|
||||
// correctly. If |transparent| is true a transparent background color will be
|
||||
// used (RGBA=0x00000000). If |transparent| is false the background will be
|
||||
// white and opaque. In order to create windowless browsers the
|
||||
// CefSettings.windowless_rendering_enabled value must be set to true.
|
||||
///
|
||||
void SetAsWindowless(CefWindowHandle parent, bool transparent) {
|
||||
windowless_rendering_enabled = true;
|
||||
parent_window = parent;
|
||||
transparent_painting_enabled = transparent;
|
||||
}
|
||||
};
|
||||
|
||||
#endif // OS_LINUX
|
||||
|
Reference in New Issue
Block a user