Skip to content

Commit 29f30aa

Browse files
committed
added checks for painting_ when setting the outputdevice to active state and removed show/hide from start/stoppainting since during testing they caused transparent frames to appear when a window was set to paint again after stopping
1 parent 3be68ba commit 29f30aa

File tree

4 files changed

+5
-15
lines changed

4 files changed

+5
-15
lines changed

atom/browser/api/atom_api_web_contents.cc

+2-6
Original file line numberDiff line numberDiff line change
@@ -1354,10 +1354,8 @@ void WebContents::StartPainting() {
13541354

13551355
auto* osr_rwhv = static_cast<OffScreenRenderWidgetHostView*>(
13561356
web_contents()->GetRenderWidgetHostView());
1357-
if (osr_rwhv) {
1358-
osr_rwhv->Show();
1357+
if (osr_rwhv)
13591358
osr_rwhv->SetPainting(true);
1360-
}
13611359
}
13621360

13631361
void WebContents::StopPainting() {
@@ -1366,10 +1364,8 @@ void WebContents::StopPainting() {
13661364

13671365
auto* osr_rwhv = static_cast<OffScreenRenderWidgetHostView*>(
13681366
web_contents()->GetRenderWidgetHostView());
1369-
if (osr_rwhv) {
1367+
if (osr_rwhv)
13701368
osr_rwhv->SetPainting(false);
1371-
osr_rwhv->Hide();
1372-
}
13731369
}
13741370

13751371
bool WebContents::IsPainting() const {

atom/browser/osr/osr_output_device.cc

-4
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,6 @@ void OffScreenOutputDevice::SetActive(bool active) {
7676

7777
void OffScreenOutputDevice::OnPaint(const gfx::Rect& damage_rect) {
7878
gfx::Rect rect = damage_rect;
79-
if (!pending_damage_rect_.IsEmpty()) {
80-
rect.Union(pending_damage_rect_);
81-
pending_damage_rect_.SetRect(0, 0, 0, 0);
82-
}
8379

8480
rect.Intersect(gfx::Rect(viewport_pixel_size_));
8581
if (rect.IsEmpty())

atom/browser/osr/osr_output_device.h

-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ class OffScreenOutputDevice : public cc::SoftwareOutputDevice {
3535

3636
std::unique_ptr<SkCanvas> canvas_;
3737
std::unique_ptr<SkBitmap> bitmap_;
38-
gfx::Rect pending_damage_rect_;
3938

4039
DISALLOW_COPY_AND_ASSIGN(OffScreenOutputDevice);
4140
};

atom/browser/osr/osr_render_widget_host_view.cc

+3-4
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,6 @@ void OffScreenRenderWidgetHostView::Show() {
476476
render_widget_host_->WasShown(ui::LatencyInfo());
477477
delegated_frame_host_->SetCompositor(compositor_.get());
478478
delegated_frame_host_->WasShown(ui::LatencyInfo());
479-
compositor_->ScheduleFullRedraw();
480479
}
481480

482481
void OffScreenRenderWidgetHostView::Hide() {
@@ -540,7 +539,7 @@ void OffScreenRenderWidgetHostView::OnSwapCompositorFrame(
540539
if (frame->delegated_frame_data) {
541540
if (software_output_device_) {
542541
if (!begin_frame_timer_.get()) {
543-
software_output_device_->SetActive(true);
542+
software_output_device_->SetActive(painting_);
544543
}
545544

546545
delegated_frame_host_->SwapDelegatedFrame(output_surface_id,
@@ -780,7 +779,7 @@ void OffScreenRenderWidgetHostView::OnSetNeedsBeginFrames(bool enabled) {
780779
begin_frame_timer_->SetActive(enabled);
781780

782781
if (software_output_device_) {
783-
software_output_device_->SetActive(enabled);
782+
software_output_device_->SetActive(enabled && painting_);
784783
}
785784
}
786785

@@ -794,7 +793,7 @@ void OffScreenRenderWidgetHostView::SetPainting(bool painting) {
794793
painting_ = painting;
795794

796795
if (software_output_device_) {
797-
software_output_device_->SetActive(painting);
796+
software_output_device_->SetActive(painting_);
798797
}
799798
}
800799

0 commit comments

Comments
 (0)