Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(443)

Side by Side Diff: chrome/browser/renderer_host/backing_store.h

Issue 108040: Send array of paint rects and bitmaps as opposed to a Union (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 skia::PlatformCanvas* canvas() { return &canvas_; } 56 skia::PlatformCanvas* canvas() { return &canvas_; }
57 #elif defined(OS_LINUX) 57 #elif defined(OS_LINUX)
58 // Copy from the server-side backing store to the target window 58 // Copy from the server-side backing store to the target window
59 // display: the display of the backing store and target window 59 // display: the display of the backing store and target window
60 // damage: the area to copy 60 // damage: the area to copy
61 // target: the X id of the target window 61 // target: the X id of the target window
62 void ShowRect(const gfx::Rect& damage, XID target); 62 void ShowRect(const gfx::Rect& damage, XID target);
63 #endif 63 #endif
64 64
65 // Paints the bitmap from the renderer onto the backing store. 65 // Paints the bitmap from the renderer onto the backing store.
66 // bitmap_rect is the rect of the whole bitmap, and paint_rect
67 // is a sub-rect of bitmap that we want to draw.
66 void PaintRect(base::ProcessHandle process, 68 void PaintRect(base::ProcessHandle process,
67 TransportDIB* bitmap, 69 TransportDIB* bitmap,
68 const gfx::Rect& bitmap_rect); 70 const gfx::Rect& bitmap_rect,
71 const gfx::Rect& paint_rect);
69 72
70 // Scrolls the given rect in the backing store, replacing the given region 73 // Scrolls the given rect in the backing store, replacing the given region
71 // identified by |bitmap_rect| by the bitmap in the file identified by the 74 // identified by |bitmap_rect| by the bitmap in the file identified by the
72 // given file handle. 75 // given file handle.
73 void ScrollRect(base::ProcessHandle process, 76 void ScrollRect(base::ProcessHandle process,
74 TransportDIB* bitmap, const gfx::Rect& bitmap_rect, 77 TransportDIB* bitmap, const gfx::Rect& bitmap_rect,
75 int dx, int dy, 78 int dx, int dy,
76 const gfx::Rect& clip_rect, 79 const gfx::Rect& clip_rect,
77 const gfx::Size& view_size); 80 const gfx::Size& view_size);
78 81
79 private: 82 private:
80 // The size of the backing store. 83 // The size of the backing store.
81 gfx::Size size_; 84 gfx::Size size_;
82 85
83 #if defined(OS_WIN) 86 #if defined(OS_WIN)
84 87
85 // The backing store dc. 88 // The backing store dc.
86 HDC hdc_; 89 HDC hdc_;
87 // Handle to the backing store dib. 90 // Handle to the backing store dib.
88 HANDLE backing_store_dib_; 91 HANDLE backing_store_dib_;
89 // Handle to the original bitmap in the dc. 92 // Handle to the original bitmap in the dc.
90 HANDLE original_bitmap_; 93 HANDLE original_bitmap_;
91 // Number of bits per pixel of the screen. 94 // Number of bits per pixel of the screen.
92 int color_depth_; 95 int color_depth_;
93 #elif defined(OS_MACOSX) 96 #elif defined(OS_MACOSX)
94 skia::PlatformCanvas canvas_; 97 skia::PlatformCanvas canvas_;
95 #elif defined(OS_LINUX) 98 #elif defined(OS_LINUX)
96 // Paints the bitmap from the renderer onto the backing store without 99 // Paints the bitmap from the renderer onto the backing store without
97 // using Xrender to composite the pixmaps. 100 // using Xrender to composite the pixmaps.
101 // bitmap_rect is the rect of the whole bitmap, and paint_rect
102 // is a sub-rect of bitmap that we want to draw.
98 void PaintRectWithoutXrender(TransportDIB* bitmap, 103 void PaintRectWithoutXrender(TransportDIB* bitmap,
99 const gfx::Rect& bitmap_rect); 104 const gfx::Rect& bitmap_rect,
105 const gfx::Rect& paint_rect);
100 106
101 // This is the connection to the X server where this backing store will be 107 // This is the connection to the X server where this backing store will be
102 // displayed. 108 // displayed.
103 Display *const display_; 109 Display *const display_;
104 // If this is true, then |connection_| is good for MIT-SHM (X shared memory). 110 // If this is true, then |connection_| is good for MIT-SHM (X shared memory).
105 const bool use_shared_memory_; 111 const bool use_shared_memory_;
106 // If this is true, then we can use Xrender to composite our pixmaps. 112 // If this is true, then we can use Xrender to composite our pixmaps.
107 const bool use_render_; 113 const bool use_render_;
108 // If |use_render_| is false, this is the number of bits-per-pixel for |depth| 114 // If |use_render_| is false, this is the number of bits-per-pixel for |depth|
109 int pixmap_bpp_; 115 int pixmap_bpp_;
110 // This is the depth of the target window. 116 // This is the depth of the target window.
111 const int visual_depth_; 117 const int visual_depth_;
112 // The parent window (probably a GtkDrawingArea) for this backing store. 118 // The parent window (probably a GtkDrawingArea) for this backing store.
113 const XID root_window_; 119 const XID root_window_;
114 // This is a handle to the server side pixmap which is our backing store. 120 // This is a handle to the server side pixmap which is our backing store.
115 XID pixmap_; 121 XID pixmap_;
116 // This is the RENDER picture pointing at |pixmap_|. 122 // This is the RENDER picture pointing at |pixmap_|.
117 XID picture_; 123 XID picture_;
118 // This is a default graphic context, used in XCopyArea 124 // This is a default graphic context, used in XCopyArea
119 void* pixmap_gc_; 125 void* pixmap_gc_;
120 #endif 126 #endif
121 127
128 // Sanity checks on the size of the rects to draw so that we don't allocate
129 // enourmous pixmaps.
130 static int kMaxBitmapLengthAllowed;
131
122 DISALLOW_COPY_AND_ASSIGN(BackingStore); 132 DISALLOW_COPY_AND_ASSIGN(BackingStore);
123 }; 133 };
124 134
125 // BackingStoreManager --------------------------------------------------------- 135 // BackingStoreManager ---------------------------------------------------------
126 136
127 // This class manages backing stores in the browsr. Every RenderWidgetHost is 137 // This class manages backing stores in the browsr. Every RenderWidgetHost is
128 // associated with a backing store which it requests from this class. The 138 // associated with a backing store which it requests from this class. The
129 // hosts don't maintain any references to the backing stores. These backing 139 // hosts don't maintain any references to the backing stores. These backing
130 // stores are maintained in a cache which can be trimmed as needed. 140 // stores are maintained in a cache which can be trimmed as needed.
131 class BackingStoreManager { 141 class BackingStoreManager {
(...skipping 19 matching lines...) Expand all
151 // bitmap_rect 161 // bitmap_rect
152 // The rect to be painted into the backing store 162 // The rect to be painted into the backing store
153 // needs_full_paint 163 // needs_full_paint
154 // Set if we need to send out a request to paint the view 164 // Set if we need to send out a request to paint the view
155 // to the renderer. 165 // to the renderer.
156 static BackingStore* PrepareBackingStore(RenderWidgetHost* host, 166 static BackingStore* PrepareBackingStore(RenderWidgetHost* host,
157 const gfx::Size& backing_store_size, 167 const gfx::Size& backing_store_size,
158 base::ProcessHandle process_handle, 168 base::ProcessHandle process_handle,
159 TransportDIB* bitmap, 169 TransportDIB* bitmap,
160 const gfx::Rect& bitmap_rect, 170 const gfx::Rect& bitmap_rect,
171 const gfx::Rect& paint_rect,
161 bool* needs_full_paint); 172 bool* needs_full_paint);
162 173
163 // Returns a matching backing store for the host. 174 // Returns a matching backing store for the host.
164 // Returns NULL if we fail to find one. 175 // Returns NULL if we fail to find one.
165 static BackingStore* Lookup(RenderWidgetHost* host); 176 static BackingStore* Lookup(RenderWidgetHost* host);
166 177
167 // Removes the backing store for the host. 178 // Removes the backing store for the host.
168 static void RemoveBackingStore(RenderWidgetHost* host); 179 static void RemoveBackingStore(RenderWidgetHost* host);
169 180
170 private: 181 private:
171 // Not intended for instantiation. 182 // Not intended for instantiation.
172 BackingStoreManager() {} 183 BackingStoreManager() {}
173 184
174 DISALLOW_COPY_AND_ASSIGN(BackingStoreManager); 185 DISALLOW_COPY_AND_ASSIGN(BackingStoreManager);
175 }; 186 };
176 187
177 #endif // CHROME_BROWSER_RENDERER_HOST_BACKING_STORE_H_ 188 #endif // CHROME_BROWSER_RENDERER_HOST_BACKING_STORE_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/renderer_host/backing_store.cc » ('j') | chrome/browser/renderer_host/backing_store_win.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698