mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-02-17 20:50:42 +01:00
Merge revision 741 changes:
- Add the ability to customize the animation frame rate (issue #697). git-svn-id: https://chromiumembedded.googlecode.com/svn/branches/963@742 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
parent
34af061616
commit
4292533524
@ -1831,7 +1831,9 @@ public:
|
||||
// element is the view or the popup widget. |buffer| contains the pixel data
|
||||
// for the whole image. |dirtyRects| contains the set of rectangles that need
|
||||
// to be repainted. On Windows |buffer| will be width*height*4 bytes in size
|
||||
// and represents a BGRA image with an upper-left origin.
|
||||
// and represents a BGRA image with an upper-left origin. The
|
||||
// CefBrowserSettings.animation_frame_rate value controls the rate at which
|
||||
// this method is called.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void OnPaint(CefRefPtr<CefBrowser> browser,
|
||||
|
@ -1607,7 +1607,9 @@ typedef struct _cef_render_handler_t
|
||||
// element is the view or the popup widget. |buffer| contains the pixel data
|
||||
// for the whole image. |dirtyRects| contains the set of rectangles that need
|
||||
// to be repainted. On Windows |buffer| will be width*height*4 bytes in size
|
||||
// and represents a BGRA image with an upper-left origin.
|
||||
// and represents a BGRA image with an upper-left origin. The
|
||||
// cef_browser_tSettings.animation_frame_rate value controls the rate at which
|
||||
// this function is called.
|
||||
///
|
||||
void (CEF_CALLBACK *on_paint)(struct _cef_render_handler_t* self,
|
||||
struct _cef_browser_t* browser, enum cef_paint_element_type_t type,
|
||||
|
@ -201,9 +201,14 @@ typedef struct _cef_browser_settings_t {
|
||||
bool history_disabled;
|
||||
|
||||
///
|
||||
// The number of frames per second (fps) for the requestAnimationFrame timer
|
||||
// and calls to CefRenderHandler::OnPaint(). The value must be between 0 and
|
||||
// 90. Specify zero for the default frame rate of 30 fps.
|
||||
// The number of frames per second (fps) for animation and windowless
|
||||
// rendering. When window rendering is enabled and the JavaScript
|
||||
// requestAnimationFrame method is used the browser client area will be
|
||||
// invalidated at the rate specified. When window rendering is disabled the
|
||||
// CefRenderHandler::OnPaint() method will be called at the rate specified.
|
||||
// This value must be between 0 and 90. Specify a value of zero for the
|
||||
// default frame rate of 30 fps. Changing this value may affect display
|
||||
// performance and/or CPU usage.
|
||||
///
|
||||
int animation_frame_rate;
|
||||
|
||||
|
@ -105,7 +105,8 @@ void WebWidgetHost::SetFrameRate(int frames_per_second) {
|
||||
}
|
||||
|
||||
void WebWidgetHost::ScheduleInvalidateTimer() {
|
||||
if (invalidate_timer_.IsRunning())
|
||||
// Invalidation is only required when window rendering is enabled.
|
||||
if (!view_ || invalidate_timer_.IsRunning())
|
||||
return;
|
||||
|
||||
// Maintain the desired rate.
|
||||
|
@ -436,10 +436,13 @@ NPError NPP_SetWindowImpl(NPP instance, NPWindow* window_info) {
|
||||
|
||||
// Create the off-screen rendering window.
|
||||
CefWindowInfo windowInfo;
|
||||
CefBrowserSettings settings;
|
||||
windowInfo.SetAsOffScreen(plugin->hWnd);
|
||||
if (g_offscreenTransparent)
|
||||
windowInfo.SetTransparentPainting(TRUE);
|
||||
|
||||
CefBrowserSettings settings;
|
||||
AppGetBrowserSettings(settings);
|
||||
|
||||
CefBrowser::CreateBrowser(windowInfo, new ClientOSRHandler(plugin),
|
||||
"http://www.google.com", settings);
|
||||
}
|
||||
|
@ -7,8 +7,9 @@
|
||||
|
||||
#include "osrtest_mac.h"
|
||||
#include "include/cef.h"
|
||||
#include "osrenderer.h"
|
||||
#include "cefclient.h"
|
||||
#include "client_popup_handler.h"
|
||||
#include "osrenderer.h"
|
||||
#include "resource_util.h"
|
||||
#include "util.h"
|
||||
|
||||
@ -735,12 +736,14 @@ void RunTest(bool transparent) {
|
||||
[view release];
|
||||
|
||||
CefWindowInfo info;
|
||||
CefBrowserSettings settings;
|
||||
|
||||
// Initialize the window info as off-screen.
|
||||
info.SetAsOffScreen(view);
|
||||
info.SetTransparentPainting(transparent);
|
||||
|
||||
CefBrowserSettings settings;
|
||||
AppGetBrowserSettings(settings);
|
||||
|
||||
// Creat the browser window.
|
||||
CefBrowser::CreateBrowser(info, new ClientOSRHandler(view),
|
||||
"http://tests/osrtest", settings);
|
||||
|
Loading…
x
Reference in New Issue
Block a user