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" |
11 #include "base/process.h" | 11 #include "base/process.h" |
12 #include "build/build_config.h" | 12 #include "build/build_config.h" |
13 #include "chrome/common/mru_cache.h" | 13 #include "chrome/common/mru_cache.h" |
14 | 14 |
15 #if defined(OS_WIN) | 15 #if defined(OS_WIN) |
16 #include <windows.h> | 16 #include <windows.h> |
17 #elif defined(OS_MACOSX) | 17 #elif defined(OS_MACOSX) |
18 #include "skia/ext/platform_canvas.h" | 18 #include "skia/ext/platform_canvas.h" |
19 #elif defined(OS_LINUX) | 19 #elif defined(OS_LINUX) |
20 #include "chrome/common/x11_util.h" | 20 #include "chrome/common/x11_util.h" |
21 #endif | 21 #endif |
22 | 22 |
23 class RenderWidgetHost; | 23 class RenderWidgetHost; |
24 class SkBitmap; | 24 class SkBitmap; |
25 class TransportDIB; | 25 class TransportDIB; |
| 26 typedef struct _GdkDrawable GdkDrawable; |
26 | 27 |
27 // BackingStore ---------------------------------------------------------------- | 28 // BackingStore ---------------------------------------------------------------- |
28 | 29 |
29 // Represents a backing store for the pixels in a RenderWidgetHost. | 30 // Represents a backing store for the pixels in a RenderWidgetHost. |
30 class BackingStore { | 31 class BackingStore { |
31 public: | 32 public: |
32 #if defined(OS_WIN) || defined(OS_MACOSX) | 33 #if defined(OS_WIN) || defined(OS_MACOSX) |
33 BackingStore(RenderWidgetHost* widget, const gfx::Size& size); | 34 BackingStore(RenderWidgetHost* widget, const gfx::Size& size); |
34 #elif defined(OS_LINUX) | 35 #elif defined(OS_LINUX) |
35 // Create a backing store on the X server. The visual is an Xlib Visual | 36 // Create a backing store on the X server. The visual is an Xlib Visual |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 // display: the display of the backing store and target window | 69 // display: the display of the backing store and target window |
69 // damage: the area to copy | 70 // damage: the area to copy |
70 // target: the X id of the target window | 71 // target: the X id of the target window |
71 void ShowRect(const gfx::Rect& damage, XID target); | 72 void ShowRect(const gfx::Rect& damage, XID target); |
72 | 73 |
73 // Paints the server-side backing store data to a SkBitmap. On failure, the | 74 // Paints the server-side backing store data to a SkBitmap. On failure, the |
74 // return bitmap will be isNull(). | 75 // return bitmap will be isNull(). |
75 SkBitmap PaintRectToBitmap(const gfx::Rect& rect); | 76 SkBitmap PaintRectToBitmap(const gfx::Rect& rect); |
76 #endif | 77 #endif |
77 | 78 |
| 79 #if defined(TOOLKIT_GTK) |
| 80 // Paint the backing store into the target's |dest_rect|. |
| 81 void PaintToRect(const gfx::Rect& dest_rect, GdkDrawable* target); |
| 82 #endif |
| 83 |
78 // Paints the bitmap from the renderer onto the backing store. | 84 // Paints the bitmap from the renderer onto the backing store. |
79 void PaintRect(base::ProcessHandle process, | 85 void PaintRect(base::ProcessHandle process, |
80 TransportDIB* bitmap, | 86 TransportDIB* bitmap, |
81 const gfx::Rect& bitmap_rect); | 87 const gfx::Rect& bitmap_rect); |
82 | 88 |
83 // Scrolls the given rect in the backing store, replacing the given region | 89 // Scrolls the given rect in the backing store, replacing the given region |
84 // identified by |bitmap_rect| by the bitmap in the file identified by the | 90 // identified by |bitmap_rect| by the bitmap in the file identified by the |
85 // given file handle. | 91 // given file handle. |
86 void ScrollRect(base::ProcessHandle process, | 92 void ScrollRect(base::ProcessHandle process, |
87 TransportDIB* bitmap, const gfx::Rect& bitmap_rect, | 93 TransportDIB* bitmap, const gfx::Rect& bitmap_rect, |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 // This is the RENDER picture pointing at |pixmap_|. | 139 // This is the RENDER picture pointing at |pixmap_|. |
134 XID picture_; | 140 XID picture_; |
135 // This is a default graphic context, used in XCopyArea | 141 // This is a default graphic context, used in XCopyArea |
136 void* pixmap_gc_; | 142 void* pixmap_gc_; |
137 #endif | 143 #endif |
138 | 144 |
139 DISALLOW_COPY_AND_ASSIGN(BackingStore); | 145 DISALLOW_COPY_AND_ASSIGN(BackingStore); |
140 }; | 146 }; |
141 | 147 |
142 #endif // CHROME_BROWSER_RENDERER_HOST_BACKING_STORE_H_ | 148 #endif // CHROME_BROWSER_RENDERER_HOST_BACKING_STORE_H_ |
OLD | NEW |