| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_BACKING_STORE_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_BACKING_STORE_H_ |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_BACKING_STORE_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_BACKING_STORE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/callback_forward.h" | 12 #include "base/callback_forward.h" |
| 13 #include "content/common/content_export.h" | 13 #include "content/common/content_export.h" |
| 14 #include "ui/gfx/size.h" | 14 #include "ui/gfx/size.h" |
| 15 #include "ui/gfx/surface/transport_dib.h" | 15 #include "ui/gfx/surface/transport_dib.h" |
| 16 | 16 |
| 17 class RenderProcessHost; | 17 class RenderProcessHost; |
| 18 class RenderWidgetHost; | |
| 19 | 18 |
| 20 namespace gfx { | 19 namespace gfx { |
| 21 class Rect; | 20 class Rect; |
| 22 } | 21 } |
| 23 | 22 |
| 24 namespace content { | 23 namespace content { |
| 25 class RenderProcessHost; | 24 class RenderProcessHost; |
| 25 class RenderWidgetHost; |
| 26 } | 26 } |
| 27 | 27 |
| 28 namespace skia { | 28 namespace skia { |
| 29 class PlatformCanvas; | 29 class PlatformCanvas; |
| 30 } | 30 } |
| 31 | 31 |
| 32 // Represents a backing store for the pixels in a RenderWidgetHost. | 32 // Represents a backing store for the pixels in a RenderWidgetHost. |
| 33 class CONTENT_EXPORT BackingStore { | 33 class CONTENT_EXPORT BackingStore { |
| 34 public: | 34 public: |
| 35 virtual ~BackingStore(); | 35 virtual ~BackingStore(); |
| 36 | 36 |
| 37 RenderWidgetHost* render_widget_host() const { return render_widget_host_; } | 37 content::RenderWidgetHost* render_widget_host() const { |
| 38 return render_widget_host_; |
| 39 } |
| 38 const gfx::Size& size() { return size_; } | 40 const gfx::Size& size() { return size_; } |
| 39 | 41 |
| 40 // The number of bytes that this backing store consumes. The default | 42 // The number of bytes that this backing store consumes. The default |
| 41 // implementation just assumes there's 32 bits per pixel over the current | 43 // implementation just assumes there's 32 bits per pixel over the current |
| 42 // size of the screen. Implementations may override this if they have more | 44 // size of the screen. Implementations may override this if they have more |
| 43 // information about the color depth. | 45 // information about the color depth. |
| 44 virtual size_t MemorySize(); | 46 virtual size_t MemorySize(); |
| 45 | 47 |
| 46 // Paints the bitmap from the renderer onto the backing store. bitmap_rect | 48 // Paints the bitmap from the renderer onto the backing store. bitmap_rect |
| 47 // gives the location of bitmap, and copy_rects specifies the subregion(s) of | 49 // gives the location of bitmap, and copy_rects specifies the subregion(s) of |
| (...skipping 17 matching lines...) Expand all Loading... |
| 65 virtual bool CopyFromBackingStore(const gfx::Rect& rect, | 67 virtual bool CopyFromBackingStore(const gfx::Rect& rect, |
| 66 skia::PlatformCanvas* output) = 0; | 68 skia::PlatformCanvas* output) = 0; |
| 67 | 69 |
| 68 // Scrolls the contents of clip_rect in the backing store by dx or dy (but dx | 70 // Scrolls the contents of clip_rect in the backing store by dx or dy (but dx |
| 69 // and dy cannot both be non-zero). | 71 // and dy cannot both be non-zero). |
| 70 virtual void ScrollBackingStore(int dx, int dy, | 72 virtual void ScrollBackingStore(int dx, int dy, |
| 71 const gfx::Rect& clip_rect, | 73 const gfx::Rect& clip_rect, |
| 72 const gfx::Size& view_size) = 0; | 74 const gfx::Size& view_size) = 0; |
| 73 protected: | 75 protected: |
| 74 // Can only be constructed via subclasses. | 76 // Can only be constructed via subclasses. |
| 75 BackingStore(RenderWidgetHost* widget, const gfx::Size& size); | 77 BackingStore(content::RenderWidgetHost* widget, const gfx::Size& size); |
| 76 | 78 |
| 77 private: | 79 private: |
| 78 // The owner of this backing store. | 80 // The owner of this backing store. |
| 79 RenderWidgetHost* render_widget_host_; | 81 content::RenderWidgetHost* render_widget_host_; |
| 80 | 82 |
| 81 // The size of the backing store. | 83 // The size of the backing store. |
| 82 gfx::Size size_; | 84 gfx::Size size_; |
| 83 | 85 |
| 84 DISALLOW_COPY_AND_ASSIGN(BackingStore); | 86 DISALLOW_COPY_AND_ASSIGN(BackingStore); |
| 85 }; | 87 }; |
| 86 | 88 |
| 87 #endif // CONTENT_BROWSER_RENDERER_HOST_BACKING_STORE_H_ | 89 #endif // CONTENT_BROWSER_RENDERER_HOST_BACKING_STORE_H_ |
| OLD | NEW |