mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
pass width and height information through to cef paint callback
This commit is contained in:
parent
9f7aacdacf
commit
fb72a64833
6 changed files with 10 additions and 11 deletions
|
@ -1292,6 +1292,8 @@ impl<Window: WindowMethods> IOCompositor<Window> {
|
|||
if !self.context.is_some() {
|
||||
return None
|
||||
}
|
||||
let (width, height) =
|
||||
(self.window_size.width.get() as usize, self.window_size.height.get() as usize);
|
||||
if !self.window.prepare_for_composite(width, height) {
|
||||
return None
|
||||
}
|
||||
|
@ -1305,9 +1307,6 @@ impl<Window: WindowMethods> IOCompositor<Window> {
|
|||
_ => {}
|
||||
}
|
||||
|
||||
let (width, height) =
|
||||
(self.window_size.width.get() as usize, self.window_size.height.get() as usize);
|
||||
|
||||
let (framebuffer_ids, texture_ids) = match target {
|
||||
CompositeTarget::Window => (vec!(), vec!()),
|
||||
_ => initialize_png(width, height)
|
||||
|
|
|
@ -123,7 +123,7 @@ pub trait WindowMethods {
|
|||
/// Requests that the window system prepare a composite. Typically this will involve making
|
||||
/// some type of platform-specific graphics context current. Returns true if the composite may
|
||||
/// proceed and false if it should not.
|
||||
fn prepare_for_composite(&self) -> bool;
|
||||
fn prepare_for_composite(&self, width: usize, height: usize) -> bool;
|
||||
|
||||
/// Sets the cursor to be used in the window.
|
||||
fn set_cursor(&self, cursor: Cursor);
|
||||
|
|
|
@ -8,12 +8,12 @@ use types::cef_paint_element_type_t::PET_VIEW;
|
|||
use std::ptr;
|
||||
|
||||
pub trait CefRenderHandlerExtensions {
|
||||
fn paint(&self, browser: CefBrowser);
|
||||
fn paint(&self, browser: CefBrowser, width: usize, height: usize);
|
||||
}
|
||||
|
||||
impl CefRenderHandlerExtensions for CefRenderHandler {
|
||||
fn paint(&self, browser: CefBrowser) {
|
||||
self.on_paint(browser, PET_VIEW, 0, ptr::null(), &mut (), 0, 0)
|
||||
fn paint(&self, browser: CefBrowser, width: usize, height: usize) {
|
||||
self.on_paint(browser, PET_VIEW, 0, ptr::null(), &mut (), width as i32, height as i32)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -253,12 +253,12 @@ impl WindowMethods for Window {
|
|||
box receiver as Box<CompositorReceiver>)
|
||||
}
|
||||
|
||||
fn prepare_for_composite(&self) -> bool {
|
||||
fn prepare_for_composite(&self, width: usize, height: usize) -> bool {
|
||||
let browser = self.cef_browser.borrow();
|
||||
match *browser {
|
||||
None => {}
|
||||
Some(ref browser) => {
|
||||
browser.get_host().get_client().get_render_handler().paint(browser.clone());
|
||||
browser.get_host().get_client().get_render_handler().paint(browser.clone(), width, height);
|
||||
}
|
||||
}
|
||||
true
|
||||
|
|
|
@ -550,7 +550,7 @@ impl WindowMethods for Window {
|
|||
self.window.set_cursor(glutin_cursor);
|
||||
}
|
||||
|
||||
fn prepare_for_composite(&self) -> bool {
|
||||
fn prepare_for_composite(&self, _width: usize, _height: usize) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
|
|
|
@ -818,7 +818,7 @@ impl WindowMethods for Window {
|
|||
fn set_cursor(&self, _: Cursor) {
|
||||
}
|
||||
|
||||
fn prepare_for_composite(&self) -> bool {
|
||||
fn prepare_for_composite(&self, _width: usize, _height: usize) -> bool {
|
||||
true
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue