| 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 19 matching lines...) Expand all Loading... |
| 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 // root_window: The X id of the root window | 39 // root_window: The X id of the root window |
| 40 // use_render: if true, the X server supports Xrender |
| 40 // use_shared_memory: if true, the X server is local | 41 // use_shared_memory: if true, the X server is local |
| 41 BackingStore(const gfx::Size& size, Display* x_connection, int depth, | 42 BackingStore(const gfx::Size& size, Display* x_connection, int depth, |
| 42 void* visual, XID root_window, bool use_shared_memory); | 43 void* visual, XID root_window, bool use_render, |
| 44 bool use_shared_memory); |
| 43 // This is for unittesting only. An object constructed using this constructor | 45 // This is for unittesting only. An object constructed using this constructor |
| 44 // will silently ignore all paints | 46 // will silently ignore all paints |
| 45 explicit BackingStore(const gfx::Size& size); | 47 explicit BackingStore(const gfx::Size& size); |
| 46 #endif | 48 #endif |
| 47 ~BackingStore(); | 49 ~BackingStore(); |
| 48 | 50 |
| 49 const gfx::Size& size() { return size_; } | 51 const gfx::Size& size() { return size_; } |
| 50 | 52 |
| 51 #if defined(OS_WIN) | 53 #if defined(OS_WIN) |
| 52 HDC hdc() { return hdc_; } | 54 HDC hdc() { return hdc_; } |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 HDC hdc_; | 93 HDC hdc_; |
| 92 | 94 |
| 93 // Handle to the backing store dib. | 95 // Handle to the backing store dib. |
| 94 HANDLE backing_store_dib_; | 96 HANDLE backing_store_dib_; |
| 95 | 97 |
| 96 // Handle to the original bitmap in the dc. | 98 // Handle to the original bitmap in the dc. |
| 97 HANDLE original_bitmap_; | 99 HANDLE original_bitmap_; |
| 98 #elif defined(OS_MACOSX) | 100 #elif defined(OS_MACOSX) |
| 99 skia::PlatformCanvas canvas_; | 101 skia::PlatformCanvas canvas_; |
| 100 #elif defined(OS_LINUX) | 102 #elif defined(OS_LINUX) |
| 103 // Paints the bitmap from the renderer onto the backing store without |
| 104 // using Xrender to composite the pixmaps. |
| 105 void PaintRectWithoutXrender(TransportDIB* bitmap, |
| 106 const gfx::Rect& bitmap_rect); |
| 107 |
| 101 // This is the connection to the X server where this backing store will be | 108 // This is the connection to the X server where this backing store will be |
| 102 // displayed. | 109 // displayed. |
| 103 Display *const display_; | 110 Display *const display_; |
| 104 // If this is true, then |connection_| is good for MIT-SHM (X shared memory). | 111 // If this is true, then |connection_| is good for MIT-SHM (X shared memory). |
| 105 const bool use_shared_memory_; | 112 const bool use_shared_memory_; |
| 113 // If this is true, then we can use Xrender to composite our pixmaps. |
| 114 const bool use_render_; |
| 115 // If |use_render_| is false, this is the number of bits-per-pixel for |depth| |
| 116 int pixmap_bpp_; |
| 117 // This is the depth of the target window. |
| 118 const int visual_depth_; |
| 106 // The parent window (probably a GtkDrawingArea) for this backing store. | 119 // The parent window (probably a GtkDrawingArea) for this backing store. |
| 107 const XID root_window_; | 120 const XID root_window_; |
| 108 // This is a handle to the server side pixmap which is our backing store. | 121 // This is a handle to the server side pixmap which is our backing store. |
| 109 XID pixmap_; | 122 XID pixmap_; |
| 110 // This is the RENDER picture pointing at |pixmap_|. | 123 // This is the RENDER picture pointing at |pixmap_|. |
| 111 XID picture_; | 124 XID picture_; |
| 112 // This is a default graphic context, used in XCopyArea | 125 // This is a default graphic context, used in XCopyArea |
| 113 void* pixmap_gc_; | 126 void* pixmap_gc_; |
| 114 #endif | 127 #endif |
| 115 | 128 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 static void RemoveBackingStore(RenderWidgetHost* host); | 175 static void RemoveBackingStore(RenderWidgetHost* host); |
| 163 | 176 |
| 164 private: | 177 private: |
| 165 // Not intended for instantiation. | 178 // Not intended for instantiation. |
| 166 BackingStoreManager() {} | 179 BackingStoreManager() {} |
| 167 | 180 |
| 168 DISALLOW_COPY_AND_ASSIGN(BackingStoreManager); | 181 DISALLOW_COPY_AND_ASSIGN(BackingStoreManager); |
| 169 }; | 182 }; |
| 170 | 183 |
| 171 #endif // CHROME_BROWSER_RENDERER_HOST_BACKING_STORE_H_ | 184 #endif // CHROME_BROWSER_RENDERER_HOST_BACKING_STORE_H_ |
| OLD | NEW |