| 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/base/x/x11_util.h" |
| 16 | 16 |
| 17 namespace gfx { | 17 namespace gfx { |
| 18 class Point; | 18 class Point; |
| 19 class Rect; | 19 class Rect; |
| 20 } // namespace gfx | 20 } |
| 21 | |
| 22 | 21 |
| 23 typedef struct _GdkDrawable GdkDrawable; | 22 typedef struct _GdkDrawable GdkDrawable; |
| 24 | 23 |
| 24 namespace content { |
| 25 |
| 25 class CONTENT_EXPORT BackingStoreGtk : public BackingStore { | 26 class CONTENT_EXPORT BackingStoreGtk : public BackingStore { |
| 26 public: | 27 public: |
| 27 // 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 |
| 28 // 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 |
| 29 // depth of the X window which will be drawn into. | 30 // depth of the X window which will be drawn into. |
| 30 BackingStoreGtk(content::RenderWidgetHost* widget, | 31 BackingStoreGtk(RenderWidgetHost* widget, |
| 31 const gfx::Size& size, | 32 const gfx::Size& size, |
| 32 void* visual, | 33 void* visual, |
| 33 int depth); | 34 int depth); |
| 34 | 35 |
| 35 // This is for unittesting only. An object constructed using this constructor | 36 // This is for unittesting only. An object constructed using this constructor |
| 36 // will silently ignore all paints | 37 // will silently ignore all paints |
| 37 BackingStoreGtk(content::RenderWidgetHost* widget, const gfx::Size& size); | 38 BackingStoreGtk(RenderWidgetHost* widget, const gfx::Size& size); |
| 38 | 39 |
| 39 virtual ~BackingStoreGtk(); | 40 virtual ~BackingStoreGtk(); |
| 40 | 41 |
| 41 Display* display() const { return display_; } | 42 Display* display() const { return display_; } |
| 42 XID root_window() const { return root_window_; } | 43 XID root_window() const { return root_window_; } |
| 43 | 44 |
| 44 // Copy from the server-side backing store to the target window | 45 // Copy from the server-side backing store to the target window |
| 45 // origin: the destination rectangle origin | 46 // origin: the destination rectangle origin |
| 46 // damage: the area to copy | 47 // damage: the area to copy |
| 47 // target: the X id of the target window | 48 // target: the X id of the target window |
| 48 void XShowRect(const gfx::Point &origin, const gfx::Rect& damage, | 49 void XShowRect(const gfx::Point &origin, const gfx::Rect& damage, |
| 49 XID target); | 50 XID target); |
| 50 | 51 |
| 51 // As above, but use Cairo instead of Xlib. | 52 // As above, but use Cairo instead of Xlib. |
| 52 void CairoShowRect(const gfx::Rect& damage, GdkDrawable* drawable); | 53 void CairoShowRect(const gfx::Rect& damage, GdkDrawable* drawable); |
| 53 | 54 |
| 54 #if defined(TOOLKIT_GTK) | 55 #if defined(TOOLKIT_GTK) |
| 55 // Paint the backing store into the target's |dest_rect|. | 56 // Paint the backing store into the target's |dest_rect|. |
| 56 void PaintToRect(const gfx::Rect& dest_rect, GdkDrawable* target); | 57 void PaintToRect(const gfx::Rect& dest_rect, GdkDrawable* target); |
| 57 #endif | 58 #endif |
| 58 | 59 |
| 59 // BackingStore implementation. | 60 // BackingStore implementation. |
| 60 virtual size_t MemorySize() OVERRIDE; | 61 virtual size_t MemorySize() OVERRIDE; |
| 61 virtual void PaintToBackingStore( | 62 virtual void PaintToBackingStore( |
| 62 content::RenderProcessHost* process, | 63 RenderProcessHost* process, |
| 63 TransportDIB::Id bitmap, | 64 TransportDIB::Id bitmap, |
| 64 const gfx::Rect& bitmap_rect, | 65 const gfx::Rect& bitmap_rect, |
| 65 const std::vector<gfx::Rect>& copy_rects, | 66 const std::vector<gfx::Rect>& copy_rects, |
| 66 float scale_factor, | 67 float scale_factor, |
| 67 const base::Closure& completion_callback, | 68 const base::Closure& completion_callback, |
| 68 bool* scheduled_completion_callback) OVERRIDE; | 69 bool* scheduled_completion_callback) OVERRIDE; |
| 69 virtual bool CopyFromBackingStore(const gfx::Rect& rect, | 70 virtual bool CopyFromBackingStore(const gfx::Rect& rect, |
| 70 skia::PlatformCanvas* output) OVERRIDE; | 71 skia::PlatformCanvas* output) OVERRIDE; |
| 71 virtual void ScrollBackingStore(int dx, int dy, | 72 virtual void ScrollBackingStore(int dx, int dy, |
| 72 const gfx::Rect& clip_rect, | 73 const gfx::Rect& clip_rect, |
| (...skipping 24 matching lines...) Expand all Loading... |
| 97 // This is a handle to the server side pixmap which is our backing store. | 98 // This is a handle to the server side pixmap which is our backing store. |
| 98 XID pixmap_; | 99 XID pixmap_; |
| 99 // This is the RENDER picture pointing at |pixmap_|. | 100 // This is the RENDER picture pointing at |pixmap_|. |
| 100 XID picture_; | 101 XID picture_; |
| 101 // This is a default graphic context, used in XCopyArea | 102 // This is a default graphic context, used in XCopyArea |
| 102 void* pixmap_gc_; | 103 void* pixmap_gc_; |
| 103 | 104 |
| 104 DISALLOW_COPY_AND_ASSIGN(BackingStoreGtk); | 105 DISALLOW_COPY_AND_ASSIGN(BackingStoreGtk); |
| 105 }; | 106 }; |
| 106 | 107 |
| 108 } // namespace content |
| 109 |
| 107 #endif // CONTENT_BROWSER_RENDERER_HOST_BACKING_STORE_GTK_H_ | 110 #endif // CONTENT_BROWSER_RENDERER_HOST_BACKING_STORE_GTK_H_ |
| OLD | NEW |