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:
Marshall Greenblatt
2012-08-15 15:16:39 +00:00
parent 34af061616
commit 4292533524
6 changed files with 25 additions and 9 deletions

View File

@@ -1831,7 +1831,9 @@ public:
// element is the view or the popup widget. |buffer| contains the pixel data // 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 // 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 // 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()--*/ /*--cef()--*/
virtual void OnPaint(CefRefPtr<CefBrowser> browser, virtual void OnPaint(CefRefPtr<CefBrowser> browser,

View File

@@ -1607,7 +1607,9 @@ typedef struct _cef_render_handler_t
// element is the view or the popup widget. |buffer| contains the pixel data // 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 // 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 // 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, void (CEF_CALLBACK *on_paint)(struct _cef_render_handler_t* self,
struct _cef_browser_t* browser, enum cef_paint_element_type_t type, struct _cef_browser_t* browser, enum cef_paint_element_type_t type,

View File

@@ -201,9 +201,14 @@ typedef struct _cef_browser_settings_t {
bool history_disabled; bool history_disabled;
/// ///
// The number of frames per second (fps) for the requestAnimationFrame timer // The number of frames per second (fps) for animation and windowless
// and calls to CefRenderHandler::OnPaint(). The value must be between 0 and // rendering. When window rendering is enabled and the JavaScript
// 90. Specify zero for the default frame rate of 30 fps. // 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; int animation_frame_rate;

View File

@@ -105,7 +105,8 @@ void WebWidgetHost::SetFrameRate(int frames_per_second) {
} }
void WebWidgetHost::ScheduleInvalidateTimer() { void WebWidgetHost::ScheduleInvalidateTimer() {
if (invalidate_timer_.IsRunning()) // Invalidation is only required when window rendering is enabled.
if (!view_ || invalidate_timer_.IsRunning())
return; return;
// Maintain the desired rate. // Maintain the desired rate.

View File

@@ -436,10 +436,13 @@ NPError NPP_SetWindowImpl(NPP instance, NPWindow* window_info) {
// Create the off-screen rendering window. // Create the off-screen rendering window.
CefWindowInfo windowInfo; CefWindowInfo windowInfo;
CefBrowserSettings settings;
windowInfo.SetAsOffScreen(plugin->hWnd); windowInfo.SetAsOffScreen(plugin->hWnd);
if (g_offscreenTransparent) if (g_offscreenTransparent)
windowInfo.SetTransparentPainting(TRUE); windowInfo.SetTransparentPainting(TRUE);
CefBrowserSettings settings;
AppGetBrowserSettings(settings);
CefBrowser::CreateBrowser(windowInfo, new ClientOSRHandler(plugin), CefBrowser::CreateBrowser(windowInfo, new ClientOSRHandler(plugin),
"http://www.google.com", settings); "http://www.google.com", settings);
} }

View File

@@ -7,8 +7,9 @@
#include "osrtest_mac.h" #include "osrtest_mac.h"
#include "include/cef.h" #include "include/cef.h"
#include "osrenderer.h" #include "cefclient.h"
#include "client_popup_handler.h" #include "client_popup_handler.h"
#include "osrenderer.h"
#include "resource_util.h" #include "resource_util.h"
#include "util.h" #include "util.h"
@@ -735,12 +736,14 @@ void RunTest(bool transparent) {
[view release]; [view release];
CefWindowInfo info; CefWindowInfo info;
CefBrowserSettings settings;
// Initialize the window info as off-screen. // Initialize the window info as off-screen.
info.SetAsOffScreen(view); info.SetAsOffScreen(view);
info.SetTransparentPainting(transparent); info.SetTransparentPainting(transparent);
CefBrowserSettings settings;
AppGetBrowserSettings(settings);
// Creat the browser window. // Creat the browser window.
CefBrowser::CreateBrowser(info, new ClientOSRHandler(view), CefBrowser::CreateBrowser(info, new ClientOSRHandler(view),
"http://tests/osrtest", settings); "http://tests/osrtest", settings);