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
This commit is contained in:
parent
3be68ba136
commit
29f30aa6ba
4 changed files with 5 additions and 15 deletions
|
@ -1354,11 +1354,9 @@ void WebContents::StartPainting() {
|
||||||
|
|
||||||
auto* osr_rwhv = static_cast<OffScreenRenderWidgetHostView*>(
|
auto* osr_rwhv = static_cast<OffScreenRenderWidgetHostView*>(
|
||||||
web_contents()->GetRenderWidgetHostView());
|
web_contents()->GetRenderWidgetHostView());
|
||||||
if (osr_rwhv) {
|
if (osr_rwhv)
|
||||||
osr_rwhv->Show();
|
|
||||||
osr_rwhv->SetPainting(true);
|
osr_rwhv->SetPainting(true);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void WebContents::StopPainting() {
|
void WebContents::StopPainting() {
|
||||||
if (!IsOffScreen())
|
if (!IsOffScreen())
|
||||||
|
@ -1366,10 +1364,8 @@ void WebContents::StopPainting() {
|
||||||
|
|
||||||
auto* osr_rwhv = static_cast<OffScreenRenderWidgetHostView*>(
|
auto* osr_rwhv = static_cast<OffScreenRenderWidgetHostView*>(
|
||||||
web_contents()->GetRenderWidgetHostView());
|
web_contents()->GetRenderWidgetHostView());
|
||||||
if (osr_rwhv) {
|
if (osr_rwhv)
|
||||||
osr_rwhv->SetPainting(false);
|
osr_rwhv->SetPainting(false);
|
||||||
osr_rwhv->Hide();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WebContents::IsPainting() const {
|
bool WebContents::IsPainting() const {
|
||||||
|
|
|
@ -76,10 +76,6 @@ void OffScreenOutputDevice::SetActive(bool active) {
|
||||||
|
|
||||||
void OffScreenOutputDevice::OnPaint(const gfx::Rect& damage_rect) {
|
void OffScreenOutputDevice::OnPaint(const gfx::Rect& damage_rect) {
|
||||||
gfx::Rect rect = damage_rect;
|
gfx::Rect rect = damage_rect;
|
||||||
if (!pending_damage_rect_.IsEmpty()) {
|
|
||||||
rect.Union(pending_damage_rect_);
|
|
||||||
pending_damage_rect_.SetRect(0, 0, 0, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
rect.Intersect(gfx::Rect(viewport_pixel_size_));
|
rect.Intersect(gfx::Rect(viewport_pixel_size_));
|
||||||
if (rect.IsEmpty())
|
if (rect.IsEmpty())
|
||||||
|
|
|
@ -35,7 +35,6 @@ class OffScreenOutputDevice : public cc::SoftwareOutputDevice {
|
||||||
|
|
||||||
std::unique_ptr<SkCanvas> canvas_;
|
std::unique_ptr<SkCanvas> canvas_;
|
||||||
std::unique_ptr<SkBitmap> bitmap_;
|
std::unique_ptr<SkBitmap> bitmap_;
|
||||||
gfx::Rect pending_damage_rect_;
|
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(OffScreenOutputDevice);
|
DISALLOW_COPY_AND_ASSIGN(OffScreenOutputDevice);
|
||||||
};
|
};
|
||||||
|
|
|
@ -476,7 +476,6 @@ void OffScreenRenderWidgetHostView::Show() {
|
||||||
render_widget_host_->WasShown(ui::LatencyInfo());
|
render_widget_host_->WasShown(ui::LatencyInfo());
|
||||||
delegated_frame_host_->SetCompositor(compositor_.get());
|
delegated_frame_host_->SetCompositor(compositor_.get());
|
||||||
delegated_frame_host_->WasShown(ui::LatencyInfo());
|
delegated_frame_host_->WasShown(ui::LatencyInfo());
|
||||||
compositor_->ScheduleFullRedraw();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OffScreenRenderWidgetHostView::Hide() {
|
void OffScreenRenderWidgetHostView::Hide() {
|
||||||
|
@ -540,7 +539,7 @@ void OffScreenRenderWidgetHostView::OnSwapCompositorFrame(
|
||||||
if (frame->delegated_frame_data) {
|
if (frame->delegated_frame_data) {
|
||||||
if (software_output_device_) {
|
if (software_output_device_) {
|
||||||
if (!begin_frame_timer_.get()) {
|
if (!begin_frame_timer_.get()) {
|
||||||
software_output_device_->SetActive(true);
|
software_output_device_->SetActive(painting_);
|
||||||
}
|
}
|
||||||
|
|
||||||
delegated_frame_host_->SwapDelegatedFrame(output_surface_id,
|
delegated_frame_host_->SwapDelegatedFrame(output_surface_id,
|
||||||
|
@ -780,7 +779,7 @@ void OffScreenRenderWidgetHostView::OnSetNeedsBeginFrames(bool enabled) {
|
||||||
begin_frame_timer_->SetActive(enabled);
|
begin_frame_timer_->SetActive(enabled);
|
||||||
|
|
||||||
if (software_output_device_) {
|
if (software_output_device_) {
|
||||||
software_output_device_->SetActive(enabled);
|
software_output_device_->SetActive(enabled && painting_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -794,7 +793,7 @@ void OffScreenRenderWidgetHostView::SetPainting(bool painting) {
|
||||||
painting_ = painting;
|
painting_ = painting;
|
||||||
|
|
||||||
if (software_output_device_) {
|
if (software_output_device_) {
|
||||||
software_output_device_->SetActive(painting);
|
software_output_device_->SetActive(painting_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue