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)));
|
||||
}
|
||||
|
||||
void OffScreenRenderWidgetHostView::SetPaintCallback(
|
||||
const OnPaintCallback* callback) {
|
||||
callback_ = callback;
|
||||
}
|
||||
|
||||
bool OffScreenRenderWidgetHostView::OnMessageReceived(
|
||||
const IPC::Message& message) {
|
||||
bool handled = true;
|
||||
|
@ -450,6 +445,11 @@ bool OffScreenRenderWidgetHostView::OnMessageReceived(
|
|||
return handled;
|
||||
}
|
||||
|
||||
void OffScreenRenderWidgetHostView::SetPaintCallback(
|
||||
const OnPaintCallback* callback) {
|
||||
callback_ = callback;
|
||||
}
|
||||
|
||||
void OffScreenRenderWidgetHostView::InitAsChild(gfx::NativeView) {
|
||||
}
|
||||
|
||||
|
@ -492,7 +492,7 @@ void OffScreenRenderWidgetHostView::Focus() {
|
|||
}
|
||||
|
||||
bool OffScreenRenderWidgetHostView::HasFocus() const {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool OffScreenRenderWidgetHostView::IsSurfaceAvailableForCopy() const {
|
||||
|
@ -554,8 +554,8 @@ void OffScreenRenderWidgetHostView::OnSwapCompositorFrame(
|
|||
TRACE_EVENT0("electron",
|
||||
"OffScreenRenderWidgetHostView::OnSwapCompositorFrame");
|
||||
|
||||
if (!painting_)
|
||||
return;
|
||||
// if (!painting_)
|
||||
// return;
|
||||
|
||||
if (frame->metadata.root_scroll_offset != last_scroll_offset_) {
|
||||
last_scroll_offset_ = frame->metadata.root_scroll_offset;
|
||||
|
@ -585,7 +585,8 @@ void OffScreenRenderWidgetHostView::OnSwapCompositorFrame(
|
|||
delegated_frame_host_->SwapDelegatedFrame(output_surface_id,
|
||||
std::move(frame));
|
||||
|
||||
copy_frame_generator_->GenerateCopyFrame(true, damage_rect);
|
||||
if (painting_)
|
||||
copy_frame_generator_->GenerateCopyFrame(true, damage_rect);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -782,7 +783,7 @@ std::unique_ptr<cc::SoftwareOutputDevice>
|
|||
void OffScreenRenderWidgetHostView::OnSetNeedsBeginFrames(bool enabled) {
|
||||
SetupFrameRate(false);
|
||||
|
||||
begin_frame_timer_->SetActive(painting_ && enabled);
|
||||
begin_frame_timer_->SetActive(enabled);
|
||||
|
||||
if (software_output_device_) {
|
||||
software_output_device_->SetActive(enabled);
|
||||
|
@ -836,10 +837,6 @@ void OffScreenRenderWidgetHostView::OnPaint(
|
|||
void OffScreenRenderWidgetHostView::SetPainting(bool painting) {
|
||||
painting_ = painting;
|
||||
|
||||
if (begin_frame_timer_.get()) {
|
||||
begin_frame_timer_->SetActive(painting);
|
||||
}
|
||||
|
||||
if (software_output_device_) {
|
||||
software_output_device_->SetActive(painting);
|
||||
}
|
||||
|
|
|
@ -16,18 +16,21 @@ exports.load = (appUrl) => {
|
|||
mainWindow = new BrowserWindow({
|
||||
width: 800,
|
||||
height: 600,
|
||||
show: false,
|
||||
autoHideMenuBar: true,
|
||||
backgroundColor: '#FFFFFF',
|
||||
useContentSize: true,
|
||||
webPreferences: {
|
||||
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.webContents.on('dom-ready', () => {
|
||||
mainWindow.webContents.setFrameRate(10)
|
||||
let ping = true
|
||||
setInterval(() => {
|
||||
if (ping) {
|
||||
|
|
Loading…
Reference in a new issue