OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/gfx/rect.h" | 9 #include "base/gfx/rect.h" |
10 #include "base/gfx/size.h" | 10 #include "base/gfx/size.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 class BackingStore { | 29 class BackingStore { |
30 public: | 30 public: |
31 #if defined(OS_WIN) || defined(OS_MACOSX) | 31 #if defined(OS_WIN) || defined(OS_MACOSX) |
32 explicit BackingStore(const gfx::Size& size); | 32 explicit BackingStore(const gfx::Size& size); |
33 #elif defined(OS_LINUX) | 33 #elif defined(OS_LINUX) |
34 // Create a backing store on the X server. | 34 // Create a backing store on the X server. |
35 // size: the size of the server-side pixmap | 35 // size: the size of the server-side pixmap |
36 // x_connection: the display to target | 36 // x_connection: the display to target |
37 // depth: the depth of the X window which will be drawn into | 37 // depth: the depth of the X window which will be drawn into |
38 // visual: An Xlib Visual describing the format of the target window | 38 // visual: An Xlib Visual describing the format of the target window |
39 // parent_window: The X id of the target window | 39 // root_window: The X id of the root window |
40 // use_shared_memory: if true, the X server is local | 40 // use_shared_memory: if true, the X server is local |
41 BackingStore(const gfx::Size& size, Display* x_connection, int depth, | 41 BackingStore(const gfx::Size& size, Display* x_connection, int depth, |
42 void* visual, XID parent_window, bool use_shared_memory); | 42 void* visual, XID root_window, bool use_shared_memory); |
43 // This is for unittesting only. An object constructed using this constructor | 43 // This is for unittesting only. An object constructed using this constructor |
44 // will silently ignore all paints | 44 // will silently ignore all paints |
45 explicit BackingStore(const gfx::Size& size); | 45 explicit BackingStore(const gfx::Size& size); |
46 #endif | 46 #endif |
47 ~BackingStore(); | 47 ~BackingStore(); |
48 | 48 |
49 const gfx::Size& size() { return size_; } | 49 const gfx::Size& size() { return size_; } |
50 | 50 |
51 #if defined(OS_WIN) | 51 #if defined(OS_WIN) |
52 HDC hdc() { return hdc_; } | 52 HDC hdc() { return hdc_; } |
53 #elif defined(OS_MACOSX) | 53 #elif defined(OS_MACOSX) |
54 skia::PlatformCanvas* canvas() { return &canvas_; } | 54 skia::PlatformCanvas* canvas() { return &canvas_; } |
55 #elif defined(OS_LINUX) | 55 #elif defined(OS_LINUX) |
56 // Copy from the server-side backing store to the target window | 56 // Copy from the server-side backing store to the target window |
57 // display: the display of the backing store and target window | 57 // display: the display of the backing store and target window |
58 // damage: the area to copy | 58 // damage: the area to copy |
59 // target: the X id of the target window | 59 // target: the X id of the target window |
60 void ShowRect(const gfx::Rect& damage); | 60 void ShowRect(const gfx::Rect& damage, XID target); |
61 #endif | 61 #endif |
62 | 62 |
63 // Paints the bitmap from the renderer onto the backing store. | 63 // Paints the bitmap from the renderer onto the backing store. |
64 void PaintRect(base::ProcessHandle process, | 64 void PaintRect(base::ProcessHandle process, |
65 TransportDIB* bitmap, | 65 TransportDIB* bitmap, |
66 const gfx::Rect& bitmap_rect); | 66 const gfx::Rect& bitmap_rect); |
67 | 67 |
68 // Scrolls the given rect in the backing store, replacing the given region | 68 // Scrolls the given rect in the backing store, replacing the given region |
69 // identified by |bitmap_rect| by the bitmap in the file identified by the | 69 // identified by |bitmap_rect| by the bitmap in the file identified by the |
70 // given file handle. | 70 // given file handle. |
(...skipping 26 matching lines...) Expand all Loading... |
97 HANDLE original_bitmap_; | 97 HANDLE original_bitmap_; |
98 #elif defined(OS_MACOSX) | 98 #elif defined(OS_MACOSX) |
99 skia::PlatformCanvas canvas_; | 99 skia::PlatformCanvas canvas_; |
100 #elif defined(OS_LINUX) | 100 #elif defined(OS_LINUX) |
101 // This is the connection to the X server where this backing store will be | 101 // This is the connection to the X server where this backing store will be |
102 // displayed. | 102 // displayed. |
103 Display *const display_; | 103 Display *const display_; |
104 // If this is true, then |connection_| is good for MIT-SHM (X shared memory). | 104 // If this is true, then |connection_| is good for MIT-SHM (X shared memory). |
105 const bool use_shared_memory_; | 105 const bool use_shared_memory_; |
106 // The parent window (probably a GtkDrawingArea) for this backing store. | 106 // The parent window (probably a GtkDrawingArea) for this backing store. |
107 const XID parent_window_; | 107 const XID root_window_; |
108 // This is a handle to the server side pixmap which is our backing store. | 108 // This is a handle to the server side pixmap which is our backing store. |
109 XID pixmap_; | 109 XID pixmap_; |
110 // This is the RENDER picture pointing at |pixmap_|. | 110 // This is the RENDER picture pointing at |pixmap_|. |
111 XID picture_; | 111 XID picture_; |
112 // This is a default graphic context, used in XCopyArea | 112 // This is a default graphic context, used in XCopyArea |
113 void* pixmap_gc_; | 113 void* pixmap_gc_; |
114 #endif | 114 #endif |
115 | 115 |
116 DISALLOW_COPY_AND_ASSIGN(BackingStore); | 116 DISALLOW_COPY_AND_ASSIGN(BackingStore); |
117 }; | 117 }; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 static void RemoveBackingStore(RenderWidgetHost* host); | 162 static void RemoveBackingStore(RenderWidgetHost* host); |
163 | 163 |
164 private: | 164 private: |
165 // Not intended for instantiation. | 165 // Not intended for instantiation. |
166 BackingStoreManager() {} | 166 BackingStoreManager() {} |
167 | 167 |
168 DISALLOW_COPY_AND_ASSIGN(BackingStoreManager); | 168 DISALLOW_COPY_AND_ASSIGN(BackingStoreManager); |
169 }; | 169 }; |
170 | 170 |
171 #endif // CHROME_BROWSER_RENDERER_HOST_BACKING_STORE_H_ | 171 #endif // CHROME_BROWSER_RENDERER_HOST_BACKING_STORE_H_ |
OLD | NEW |