| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_GTK_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_BACKING_STORE_GTK_H_ |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_BACKING_STORE_GTK_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_BACKING_STORE_GTK_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "build/build_config.h" | 12 #include "build/build_config.h" |
| 13 #include "content/browser/renderer_host/backing_store.h" | 13 #include "content/browser/renderer_host/backing_store.h" |
| 14 #include "content/common/content_export.h" | 14 #include "content/common/content_export.h" |
| 15 #include "ui/base/x/x11_util.h" | 15 #include "ui/gfx/x/x11_types.h" |
| 16 | 16 |
| 17 namespace gfx { | 17 namespace gfx { |
| 18 class Point; | 18 class Point; |
| 19 class Rect; | 19 class Rect; |
| 20 } | 20 } |
| 21 | 21 |
| 22 typedef struct _GdkDrawable GdkDrawable; | 22 typedef struct _GdkDrawable GdkDrawable; |
| 23 | 23 |
| 24 namespace content { | 24 namespace content { |
| 25 | 25 |
| 26 class CONTENT_EXPORT BackingStoreGtk : public BackingStore { | 26 class CONTENT_EXPORT BackingStoreGtk : public BackingStore { |
| 27 public: | 27 public: |
| 28 // Create a backing store on the X server. The visual is an Xlib Visual | 28 // Create a backing store on the X server. The visual is an Xlib Visual |
| 29 // describing the format of the target window and the depth is the color | 29 // describing the format of the target window and the depth is the color |
| 30 // depth of the X window which will be drawn into. | 30 // depth of the X window which will be drawn into. |
| 31 BackingStoreGtk(RenderWidgetHost* widget, | 31 BackingStoreGtk(RenderWidgetHost* widget, |
| 32 const gfx::Size& size, | 32 const gfx::Size& size, |
| 33 void* visual, | 33 void* visual, |
| 34 int depth); | 34 int depth); |
| 35 | 35 |
| 36 // This is for unittesting only. An object constructed using this constructor | 36 // This is for unittesting only. An object constructed using this constructor |
| 37 // will silently ignore all paints | 37 // will silently ignore all paints |
| 38 BackingStoreGtk(RenderWidgetHost* widget, const gfx::Size& size); | 38 BackingStoreGtk(RenderWidgetHost* widget, const gfx::Size& size); |
| 39 | 39 |
| 40 virtual ~BackingStoreGtk(); | 40 virtual ~BackingStoreGtk(); |
| 41 | 41 |
| 42 Display* display() const { return display_; } | 42 XDisplay* display() const { return display_; } |
| 43 XID root_window() const { return root_window_; } | 43 XID root_window() const { return root_window_; } |
| 44 | 44 |
| 45 // Copy from the server-side backing store to the target window | 45 // Copy from the server-side backing store to the target window |
| 46 // origin: the destination rectangle origin | 46 // origin: the destination rectangle origin |
| 47 // damage: the area to copy | 47 // damage: the area to copy |
| 48 // target: the X id of the target window | 48 // target: the X id of the target window |
| 49 void XShowRect(const gfx::Point &origin, const gfx::Rect& damage, | 49 void XShowRect(const gfx::Point &origin, const gfx::Rect& damage, |
| 50 XID target); | 50 XID target); |
| 51 | 51 |
| 52 #if defined(TOOLKIT_GTK) | 52 #if defined(TOOLKIT_GTK) |
| (...skipping 19 matching lines...) Expand all Loading... |
| 72 | 72 |
| 73 private: | 73 private: |
| 74 // Paints the bitmap from the renderer onto the backing store without | 74 // Paints the bitmap from the renderer onto the backing store without |
| 75 // using Xrender to composite the pixmaps. | 75 // using Xrender to composite the pixmaps. |
| 76 void PaintRectWithoutXrender(TransportDIB* bitmap, | 76 void PaintRectWithoutXrender(TransportDIB* bitmap, |
| 77 const gfx::Rect& bitmap_rect, | 77 const gfx::Rect& bitmap_rect, |
| 78 const std::vector<gfx::Rect>& copy_rects); | 78 const std::vector<gfx::Rect>& copy_rects); |
| 79 | 79 |
| 80 // This is the connection to the X server where this backing store will be | 80 // This is the connection to the X server where this backing store will be |
| 81 // displayed. | 81 // displayed. |
| 82 Display* const display_; | 82 XDisplay* const display_; |
| 83 // What flavor, if any, MIT-SHM (X shared memory) support we have. | 83 // What flavor, if any, MIT-SHM (X shared memory) support we have. |
| 84 const ui::SharedMemorySupport shared_memory_support_; | 84 const ui::SharedMemorySupport shared_memory_support_; |
| 85 // If this is true, then we can use Xrender to composite our pixmaps. | 85 // If this is true, then we can use Xrender to composite our pixmaps. |
| 86 const bool use_render_; | 86 const bool use_render_; |
| 87 // If |use_render_| is false, this is the number of bits-per-pixel for |depth| | 87 // If |use_render_| is false, this is the number of bits-per-pixel for |depth| |
| 88 int pixmap_bpp_; | 88 int pixmap_bpp_; |
| 89 // if |use_render_| is false, we need the Visual to get the RGB masks. | 89 // if |use_render_| is false, we need the Visual to get the RGB masks. |
| 90 void* const visual_; | 90 void* const visual_; |
| 91 // This is the depth of the target window. | 91 // This is the depth of the target window. |
| 92 const int visual_depth_; | 92 const int visual_depth_; |
| 93 // The parent window (probably a GtkDrawingArea) for this backing store. | 93 // The parent window (probably a GtkDrawingArea) for this backing store. |
| 94 const XID root_window_; | 94 const XID root_window_; |
| 95 // This is a handle to the server side pixmap which is our backing store. | 95 // This is a handle to the server side pixmap which is our backing store. |
| 96 XID pixmap_; | 96 XID pixmap_; |
| 97 // This is the RENDER picture pointing at |pixmap_|. | 97 // This is the RENDER picture pointing at |pixmap_|. |
| 98 XID picture_; | 98 XID picture_; |
| 99 // This is a default graphic context, used in XCopyArea | 99 // This is a default graphic context, used in XCopyArea |
| 100 void* pixmap_gc_; | 100 void* pixmap_gc_; |
| 101 | 101 |
| 102 DISALLOW_COPY_AND_ASSIGN(BackingStoreGtk); | 102 DISALLOW_COPY_AND_ASSIGN(BackingStoreGtk); |
| 103 }; | 103 }; |
| 104 | 104 |
| 105 } // namespace content | 105 } // namespace content |
| 106 | 106 |
| 107 #endif // CONTENT_BROWSER_RENDERER_HOST_BACKING_STORE_GTK_H_ | 107 #endif // CONTENT_BROWSER_RENDERER_HOST_BACKING_STORE_GTK_H_ |
| OLD | NEW |