Add the ability to customize the animation frame rate (issue #697).
git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@741 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
parent
03ced41cf2
commit
606612399c
|
@ -96,7 +96,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,
|
||||||
|
|
|
@ -100,7 +100,9 @@ class CefRenderHandler : public virtual CefBase {
|
||||||
// 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,
|
||||||
|
|
|
@ -239,9 +239,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;
|
||||||
|
|
||||||
|
|
|
@ -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.
|
||||||
|
|
|
@ -437,10 +437,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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,8 +7,9 @@
|
||||||
|
|
||||||
#include "cefclient/osrtest_mac.h"
|
#include "cefclient/osrtest_mac.h"
|
||||||
#include "include/cef_browser.h"
|
#include "include/cef_browser.h"
|
||||||
#include "cefclient/osrenderer.h"
|
#include "cefclient/cefclient.h"
|
||||||
#include "cefclient/client_popup_handler.h"
|
#include "cefclient/client_popup_handler.h"
|
||||||
|
#include "cefclient/osrenderer.h"
|
||||||
#include "cefclient/resource_util.h"
|
#include "cefclient/resource_util.h"
|
||||||
#include "cefclient/util.h"
|
#include "cefclient/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);
|
||||||
|
|
Loading…
Reference in New Issue