fixes paint toggling, for real tho hopefully
This commit is contained in:
parent
690ca7ec2a
commit
aac5fb0377
2 changed files with 16 additions and 16 deletions
|
@ -431,11 +431,6 @@ void OffScreenRenderWidgetHostView::SendBeginFrame(base::TimeTicks frame_time,
|
||||||
vsync_period, cc::BeginFrameArgs::NORMAL)));
|
vsync_period, cc::BeginFrameArgs::NORMAL)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void OffScreenRenderWidgetHostView::SetPaintCallback(
|
|
||||||
const OnPaintCallback* callback) {
|
|
||||||
callback_ = callback;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool OffScreenRenderWidgetHostView::OnMessageReceived(
|
bool OffScreenRenderWidgetHostView::OnMessageReceived(
|
||||||
const IPC::Message& message) {
|
const IPC::Message& message) {
|
||||||
bool handled = true;
|
bool handled = true;
|
||||||
|
@ -450,6 +445,11 @@ bool OffScreenRenderWidgetHostView::OnMessageReceived(
|
||||||
return handled;
|
return handled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OffScreenRenderWidgetHostView::SetPaintCallback(
|
||||||
|
const OnPaintCallback* callback) {
|
||||||
|
callback_ = callback;
|
||||||
|
}
|
||||||
|
|
||||||
void OffScreenRenderWidgetHostView::InitAsChild(gfx::NativeView) {
|
void OffScreenRenderWidgetHostView::InitAsChild(gfx::NativeView) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -492,7 +492,7 @@ void OffScreenRenderWidgetHostView::Focus() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OffScreenRenderWidgetHostView::HasFocus() const {
|
bool OffScreenRenderWidgetHostView::HasFocus() const {
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OffScreenRenderWidgetHostView::IsSurfaceAvailableForCopy() const {
|
bool OffScreenRenderWidgetHostView::IsSurfaceAvailableForCopy() const {
|
||||||
|
@ -554,8 +554,8 @@ void OffScreenRenderWidgetHostView::OnSwapCompositorFrame(
|
||||||
TRACE_EVENT0("electron",
|
TRACE_EVENT0("electron",
|
||||||
"OffScreenRenderWidgetHostView::OnSwapCompositorFrame");
|
"OffScreenRenderWidgetHostView::OnSwapCompositorFrame");
|
||||||
|
|
||||||
if (!painting_)
|
// if (!painting_)
|
||||||
return;
|
// return;
|
||||||
|
|
||||||
if (frame->metadata.root_scroll_offset != last_scroll_offset_) {
|
if (frame->metadata.root_scroll_offset != last_scroll_offset_) {
|
||||||
last_scroll_offset_ = frame->metadata.root_scroll_offset;
|
last_scroll_offset_ = frame->metadata.root_scroll_offset;
|
||||||
|
@ -585,6 +585,7 @@ void OffScreenRenderWidgetHostView::OnSwapCompositorFrame(
|
||||||
delegated_frame_host_->SwapDelegatedFrame(output_surface_id,
|
delegated_frame_host_->SwapDelegatedFrame(output_surface_id,
|
||||||
std::move(frame));
|
std::move(frame));
|
||||||
|
|
||||||
|
if (painting_)
|
||||||
copy_frame_generator_->GenerateCopyFrame(true, damage_rect);
|
copy_frame_generator_->GenerateCopyFrame(true, damage_rect);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -782,7 +783,7 @@ std::unique_ptr<cc::SoftwareOutputDevice>
|
||||||
void OffScreenRenderWidgetHostView::OnSetNeedsBeginFrames(bool enabled) {
|
void OffScreenRenderWidgetHostView::OnSetNeedsBeginFrames(bool enabled) {
|
||||||
SetupFrameRate(false);
|
SetupFrameRate(false);
|
||||||
|
|
||||||
begin_frame_timer_->SetActive(painting_ && enabled);
|
begin_frame_timer_->SetActive(enabled);
|
||||||
|
|
||||||
if (software_output_device_) {
|
if (software_output_device_) {
|
||||||
software_output_device_->SetActive(enabled);
|
software_output_device_->SetActive(enabled);
|
||||||
|
@ -836,10 +837,6 @@ void OffScreenRenderWidgetHostView::OnPaint(
|
||||||
void OffScreenRenderWidgetHostView::SetPainting(bool painting) {
|
void OffScreenRenderWidgetHostView::SetPainting(bool painting) {
|
||||||
painting_ = painting;
|
painting_ = painting;
|
||||||
|
|
||||||
if (begin_frame_timer_.get()) {
|
|
||||||
begin_frame_timer_->SetActive(painting);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (software_output_device_) {
|
if (software_output_device_) {
|
||||||
software_output_device_->SetActive(painting);
|
software_output_device_->SetActive(painting);
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,18 +16,21 @@ exports.load = (appUrl) => {
|
||||||
mainWindow = new BrowserWindow({
|
mainWindow = new BrowserWindow({
|
||||||
width: 800,
|
width: 800,
|
||||||
height: 600,
|
height: 600,
|
||||||
|
show: false,
|
||||||
autoHideMenuBar: true,
|
autoHideMenuBar: true,
|
||||||
backgroundColor: '#FFFFFF',
|
backgroundColor: '#FFFFFF',
|
||||||
useContentSize: true,
|
useContentSize: true,
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
offscreen: true,
|
offscreen: true,
|
||||||
nodeIntegration: false
|
nodeIntegration: false,
|
||||||
|
backgroundThrottling: false
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
mainWindow.loadURL('file:///Volumes/Elements/dev/electron/spec/fixtures/api/offscreen-rendering.html')
|
mainWindow.loadURL(appUrl)
|
||||||
mainWindow.focus()
|
mainWindow.focus()
|
||||||
|
|
||||||
mainWindow.webContents.on('dom-ready', () => {
|
mainWindow.webContents.on('dom-ready', () => {
|
||||||
|
mainWindow.webContents.setFrameRate(10)
|
||||||
let ping = true
|
let ping = true
|
||||||
setInterval(() => {
|
setInterval(() => {
|
||||||
if (ping) {
|
if (ping) {
|
||||||
|
|
Loading…
Reference in a new issue