From bcfc90e8a909bbc199f4d80143f5eb24abda1544 Mon Sep 17 00:00:00 2001 From: "brettw@chromium.org" Date: Fri, 23 Jan 2009 23:14:11 +0000 Subject: Separate out the backing store from the RenderWidgetHost into its own file to make porting easier. I also did some cleanup in the scrolling and painting areas, collapsing the confusing ScrollRect call inside OnMsgScrollRect to just be inside the function and call a new function on the backing store to scroll it. Same for painting. This also moves plugin window moving to the view. Review URL: http://codereview.chromium.org/18702 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8594 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/renderer_host/render_widget_host.h | 66 ++++++----------------- 1 file changed, 16 insertions(+), 50 deletions(-) (limited to 'chrome/browser/renderer_host/render_widget_host.h') diff --git a/chrome/browser/renderer_host/render_widget_host.h b/chrome/browser/renderer_host/render_widget_host.h index d683e84..5992b69 100644 --- a/chrome/browser/renderer_host/render_widget_host.h +++ b/chrome/browser/renderer_host/render_widget_host.h @@ -157,13 +157,6 @@ class RenderWidgetHost : public IPC::Channel::Listener { // Indicates if the page has finished loading. virtual void SetIsLoading(bool is_loading); - // Represents a device-dependent drawing surface used to hold the rendering - // of a RenderWidgetHost. - class BackingStore; - - // Manages a set of backing stores. - class BackingStoreManager; - // Get access to the widget's backing store. If a resize is in progress, // then the current size of the backing store may be less than the size of // the widget's view. This method returns NULL if the backing store could @@ -226,9 +219,6 @@ class RenderWidgetHost : public IPC::Channel::Listener { void OnMsgImeUpdateStatus(ViewHostMsg_ImeControl control, const gfx::Rect& caret_rect); - void MovePluginWindows( - const std::vector& plugin_window_moves); - // TODO(beng): (Cleanup) remove this friendship once we expose a clean API to // RenderWidgetHost Views. This exists only to give RenderWidgetHostView // access to Forward*Event. @@ -239,14 +229,6 @@ class RenderWidgetHost : public IPC::Channel::Listener { void ForwardWheelEvent(const WebMouseWheelEvent& wheel_event); void ForwardInputEvent(const WebInputEvent& input_event, int event_size); - // Called to paint a region of the backing store - void PaintRect(HANDLE bitmap, const gfx::Rect& bitmap_rect, - const gfx::Size& view_size); - - // Called to scroll a region of the backing store - void ScrollRect(HANDLE bitmap, const gfx::Rect& bitmap_rect, int dx, int dy, - const gfx::Rect& clip_rect, const gfx::Size& view_size); - // Tell this object to destroy itself. void Destroy(); @@ -324,38 +306,22 @@ class RenderWidgetHost : public IPC::Channel::Listener { // operation to finish. base::TimeTicks repaint_start_time_; - DISALLOW_EVIL_CONSTRUCTORS(RenderWidgetHost); -}; - -class RenderWidgetHost::BackingStore { - public: - BackingStore(const gfx::Size& size); - ~BackingStore(); - - HDC dc() { return hdc_; } - const gfx::Size& size() { return size_; } - - // Paints the bitmap from the renderer onto the backing store. - bool Refresh(HANDLE process, HANDLE bitmap_section, - const gfx::Rect& bitmap_rect); - private: - // Creates a dib conforming to the height/width/section parameters passed - // in. The use_os_color_depth parameter controls whether we use the color - // depth to create an appropriate dib or not. - HANDLE CreateDIB(HDC dc, int width, int height, bool use_os_color_depth, - HANDLE section); - - // The backing store dc. - HDC hdc_; - // The size of the backing store. - gfx::Size size_; - // Handle to the backing store dib. - HANDLE backing_store_dib_; - // Handle to the original bitmap in the dc. - HANDLE original_bitmap_; - - DISALLOW_COPY_AND_ASSIGN(BackingStore); + // Paints the given bitmap to the current backing store at the given location. + void PaintBackingStoreRect(HANDLE bitmap, + const gfx::Rect& bitmap_rect, + const gfx::Size& view_size); + + // Scrolls the given |clip_rect| in the backing by the given dx/dy amount. The + // |bitmap| and its corresponding location |bitmap_rect| in the backing store + // is the newly painted pixels by the renderer. + void ScrollBackingStoreRect(HANDLE bitmap, + const gfx::Rect& bitmap_rect, + int dx, int dy, + const gfx::Rect& clip_rect, + const gfx::Size& view_size); + + DISALLOW_COPY_AND_ASSIGN(RenderWidgetHost); }; class RenderWidgetHost::PaintObserver { @@ -366,4 +332,4 @@ class RenderWidgetHost::PaintObserver { virtual void RenderWidgetHostDidPaint(RenderWidgetHost* rwh) = 0; }; -#endif // #ifndef CHROME_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_H_ +#endif // CHROME_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_H_ -- cgit v1.1