adds invalidate method and proper resizing
This commit is contained in:
parent
d1274bb79f
commit
b4c220613f
6 changed files with 31 additions and 5 deletions
|
@ -24,6 +24,8 @@ void OffScreenOutputDevice::Resize(
|
|||
const gfx::Size& pixel_size, float scale_factor) {
|
||||
scale_factor_ = scale_factor;
|
||||
|
||||
printf("OffScreenOutputDevice::Resize\n");
|
||||
|
||||
if (viewport_pixel_size_ == pixel_size) return;
|
||||
viewport_pixel_size_ = pixel_size;
|
||||
|
||||
|
|
|
@ -439,11 +439,7 @@ content::RenderWidgetHost* OffScreenRenderWidgetHostView::GetRenderWidgetHost()
|
|||
void OffScreenRenderWidgetHostView::SetSize(const gfx::Size& size) {
|
||||
size_ = size;
|
||||
|
||||
const gfx::Size& size_in_pixels =
|
||||
gfx::ConvertSizeToPixel(scale_factor_, size);
|
||||
|
||||
GetRootLayer()->SetBounds(gfx::Rect(size));
|
||||
GetCompositor()->SetScaleAndSize(scale_factor_, size_in_pixels);
|
||||
ResizeRootLayer();
|
||||
}
|
||||
|
||||
void OffScreenRenderWidgetHostView::SetBounds(const gfx::Rect& new_bounds) {
|
||||
|
@ -892,6 +888,17 @@ void OffScreenRenderWidgetHostView::SetupFrameRate(bool force) {
|
|||
}
|
||||
}
|
||||
|
||||
void OffScreenRenderWidgetHostView::Invalidate() {
|
||||
const gfx::Rect& bounds_in_pixels = GetViewBounds();
|
||||
|
||||
printf("Invalidate\n");
|
||||
if (software_output_device_) {
|
||||
software_output_device_->OnPaint(bounds_in_pixels);
|
||||
} else if (copy_frame_generator_.get()) {
|
||||
copy_frame_generator_->GenerateCopyFrame(true, bounds_in_pixels);
|
||||
}
|
||||
}
|
||||
|
||||
void OffScreenRenderWidgetHostView::ResizeRootLayer() {
|
||||
SetupFrameRate(false);
|
||||
|
||||
|
|
|
@ -193,6 +193,8 @@ class OffScreenRenderWidgetHostView
|
|||
ui::Layer* GetRootLayer() const;
|
||||
content::DelegatedFrameHost* GetDelegatedFrameHost() const;
|
||||
|
||||
void Invalidate();
|
||||
|
||||
content::RenderWidgetHostImpl* render_widget_host() const
|
||||
{ return render_widget_host_; }
|
||||
NativeWindow* window() const { return native_window_; }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue