| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 CHROME_BROWSER_RENDERER_HOST_BACKING_STORE_H_ | 5 #ifndef CHROME_BROWSER_RENDERER_HOST_BACKING_STORE_H_ |
| 6 #define CHROME_BROWSER_RENDERER_HOST_BACKING_STORE_H_ | 6 #define CHROME_BROWSER_RENDERER_HOST_BACKING_STORE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 | 33 |
| 34 // The number of bytes that this backing store consumes. The default | 34 // The number of bytes that this backing store consumes. The default |
| 35 // implementation just assumes there's 32 bits per pixel over the current | 35 // implementation just assumes there's 32 bits per pixel over the current |
| 36 // size of the screen. Implementations may override this if they have more | 36 // size of the screen. Implementations may override this if they have more |
| 37 // information about the color depth. | 37 // information about the color depth. |
| 38 virtual size_t MemorySize(); | 38 virtual size_t MemorySize(); |
| 39 | 39 |
| 40 // Paints the bitmap from the renderer onto the backing store. bitmap_rect | 40 // Paints the bitmap from the renderer onto the backing store. bitmap_rect |
| 41 // gives the location of bitmap, and copy_rects specifies the subregion(s) of | 41 // gives the location of bitmap, and copy_rects specifies the subregion(s) of |
| 42 // the backingstore to be painted from the bitmap. | 42 // the backingstore to be painted from the bitmap. |
| 43 // | |
| 44 // The value placed into |*painted_synchronously| indicates if the paint was | |
| 45 // completed synchronously and the TransportDIB can be freed. False means that | |
| 46 // the backing store may still be using the transport DIB and it will manage | |
| 47 // notifying the RenderWidgetHost that it's done with it via | |
| 48 // DonePaintingToBackingStore(). | |
| 49 virtual void PaintToBackingStore( | 43 virtual void PaintToBackingStore( |
| 50 RenderProcessHost* process, | 44 RenderProcessHost* process, |
| 51 TransportDIB::Id bitmap, | 45 TransportDIB::Id bitmap, |
| 52 const gfx::Rect& bitmap_rect, | 46 const gfx::Rect& bitmap_rect, |
| 53 const std::vector<gfx::Rect>& copy_rects, | 47 const std::vector<gfx::Rect>& copy_rects) = 0; |
| 54 bool* painted_synchronously) = 0; | |
| 55 | 48 |
| 56 // Extracts the gives subset of the backing store and copies it to the given | 49 // Extracts the gives subset of the backing store and copies it to the given |
| 57 // PlatformCanvas. The PlatformCanvas should not be initialized. This function | 50 // PlatformCanvas. The PlatformCanvas should not be initialized. This function |
| 58 // will call initialize() with the correct size. The return value indicates | 51 // will call initialize() with the correct size. The return value indicates |
| 59 // success. | 52 // success. |
| 60 virtual bool CopyFromBackingStore(const gfx::Rect& rect, | 53 virtual bool CopyFromBackingStore(const gfx::Rect& rect, |
| 61 skia::PlatformCanvas* output) = 0; | 54 skia::PlatformCanvas* output) = 0; |
| 62 | 55 |
| 63 // Scrolls the contents of clip_rect in the backing store by dx or dy (but dx | 56 // Scrolls the contents of clip_rect in the backing store by dx or dy (but dx |
| 64 // and dy cannot both be non-zero). | 57 // and dy cannot both be non-zero). |
| 65 virtual void ScrollBackingStore(int dx, int dy, | 58 virtual void ScrollBackingStore(int dx, int dy, |
| 66 const gfx::Rect& clip_rect, | 59 const gfx::Rect& clip_rect, |
| 67 const gfx::Size& view_size) = 0; | 60 const gfx::Size& view_size) = 0; |
| 68 protected: | 61 protected: |
| 69 // Can only be constructed via subclasses. | 62 // Can only be constructed via subclasses. |
| 70 BackingStore(RenderWidgetHost* widget, const gfx::Size& size); | 63 BackingStore(RenderWidgetHost* widget, const gfx::Size& size); |
| 71 | 64 |
| 72 private: | 65 private: |
| 73 // The owner of this backing store. | 66 // The owner of this backing store. |
| 74 RenderWidgetHost* render_widget_host_; | 67 RenderWidgetHost* render_widget_host_; |
| 75 | 68 |
| 76 // The size of the backing store. | 69 // The size of the backing store. |
| 77 gfx::Size size_; | 70 gfx::Size size_; |
| 78 | 71 |
| 79 DISALLOW_COPY_AND_ASSIGN(BackingStore); | 72 DISALLOW_COPY_AND_ASSIGN(BackingStore); |
| 80 }; | 73 }; |
| 81 | 74 |
| 82 #endif // CHROME_BROWSER_RENDERER_HOST_BACKING_STORE_H_ | 75 #endif // CHROME_BROWSER_RENDERER_HOST_BACKING_STORE_H_ |
| OLD | NEW |