| 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 // TODO(jam): remove this file when all files have been converted. |
| 10 | 10 #include "content/browser/renderer_host/backing_store.h" |
| 11 #include "app/surface/transport_dib.h" | |
| 12 #include "base/basictypes.h" | |
| 13 #include "ui/gfx/size.h" | |
| 14 | |
| 15 class RenderProcessHost; | |
| 16 class RenderWidgetHost; | |
| 17 | |
| 18 namespace gfx { | |
| 19 class Rect; | |
| 20 } | |
| 21 | |
| 22 namespace skia { | |
| 23 class PlatformCanvas; | |
| 24 } | |
| 25 | |
| 26 // Represents a backing store for the pixels in a RenderWidgetHost. | |
| 27 class BackingStore { | |
| 28 public: | |
| 29 virtual ~BackingStore(); | |
| 30 | |
| 31 RenderWidgetHost* render_widget_host() const { return render_widget_host_; } | |
| 32 const gfx::Size& size() { return size_; } | |
| 33 | |
| 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 | |
| 36 // size of the screen. Implementations may override this if they have more | |
| 37 // information about the color depth. | |
| 38 virtual size_t MemorySize(); | |
| 39 | |
| 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 | |
| 42 // the backingstore to be painted from the bitmap. | |
| 43 virtual void PaintToBackingStore( | |
| 44 RenderProcessHost* process, | |
| 45 TransportDIB::Id bitmap, | |
| 46 const gfx::Rect& bitmap_rect, | |
| 47 const std::vector<gfx::Rect>& copy_rects) = 0; | |
| 48 | |
| 49 // Extracts the gives subset of the backing store and copies it to the given | |
| 50 // PlatformCanvas. The PlatformCanvas should not be initialized. This function | |
| 51 // will call initialize() with the correct size. The return value indicates | |
| 52 // success. | |
| 53 virtual bool CopyFromBackingStore(const gfx::Rect& rect, | |
| 54 skia::PlatformCanvas* output) = 0; | |
| 55 | |
| 56 // Scrolls the contents of clip_rect in the backing store by dx or dy (but dx | |
| 57 // and dy cannot both be non-zero). | |
| 58 virtual void ScrollBackingStore(int dx, int dy, | |
| 59 const gfx::Rect& clip_rect, | |
| 60 const gfx::Size& view_size) = 0; | |
| 61 protected: | |
| 62 // Can only be constructed via subclasses. | |
| 63 BackingStore(RenderWidgetHost* widget, const gfx::Size& size); | |
| 64 | |
| 65 private: | |
| 66 // The owner of this backing store. | |
| 67 RenderWidgetHost* render_widget_host_; | |
| 68 | |
| 69 // The size of the backing store. | |
| 70 gfx::Size size_; | |
| 71 | |
| 72 DISALLOW_COPY_AND_ASSIGN(BackingStore); | |
| 73 }; | |
| 74 | 11 |
| 75 #endif // CHROME_BROWSER_RENDERER_HOST_BACKING_STORE_H_ | 12 #endif // CHROME_BROWSER_RENDERER_HOST_BACKING_STORE_H_ |
| OLD | NEW |