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

Side by Side Diff: chrome/browser/renderer_host/backing_store_x.cc

Issue 3834003: On Windows, create a new TransportDIB::Handle struct which includes the file (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Rebase Created 10 years, 2 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
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #include "chrome/browser/renderer_host/backing_store_x.h" 5 #include "chrome/browser/renderer_host/backing_store_x.h"
6 6
7 #include <cairo-xlib.h> 7 #include <cairo-xlib.h>
8 #include <gtk/gtk.h> 8 #include <gtk/gtk.h>
9 #include <stdlib.h> 9 #include <stdlib.h>
10 #include <sys/ipc.h> 10 #include <sys/ipc.h>
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 copy_rect.height(), // height 151 copy_rect.height(), // height
152 copy_rect.x(), // dest_x 152 copy_rect.x(), // dest_x
153 copy_rect.y()); // dest_y 153 copy_rect.y()); // dest_y
154 } 154 }
155 155
156 XFreePixmap(display_, pixmap); 156 XFreePixmap(display_, pixmap);
157 } 157 }
158 158
159 void BackingStoreX::PaintToBackingStore( 159 void BackingStoreX::PaintToBackingStore(
160 RenderProcessHost* process, 160 RenderProcessHost* process,
161 TransportDIB::Id bitmap, 161 TransportDIB::Id dib_id,
162 TransportDIB::Handle dib_handle,
162 const gfx::Rect& bitmap_rect, 163 const gfx::Rect& bitmap_rect,
163 const std::vector<gfx::Rect>& copy_rects, 164 const std::vector<gfx::Rect>& copy_rects,
164 bool* painted_synchronously) { 165 bool* painted_synchronously) {
166 TransportDIB::ScopedHandle scoped_dib_handle(dib_handle);
165 // Our paints are always synchronous and the caller can free the TransportDIB 167 // Our paints are always synchronous and the caller can free the TransportDIB
166 // when we're done, even on error. 168 // when we're done, even on error.
167 *painted_synchronously = true; 169 *painted_synchronously = true;
168 170
169 if (!display_) 171 if (!display_)
170 return; 172 return;
171 173
172 if (bitmap_rect.IsEmpty()) 174 if (bitmap_rect.IsEmpty())
173 return; 175 return;
174 176
175 const int width = bitmap_rect.width(); 177 const int width = bitmap_rect.width();
176 const int height = bitmap_rect.height(); 178 const int height = bitmap_rect.height();
177 179
178 if (width <= 0 || width > kMaxVideoLayerSize || 180 if (width <= 0 || width > kMaxVideoLayerSize ||
179 height <= 0 || height > kMaxVideoLayerSize) 181 height <= 0 || height > kMaxVideoLayerSize)
180 return; 182 return;
181 183
182 TransportDIB* dib = process->GetTransportDIB(bitmap); 184 TransportDIB* dib = process->GetTransportDIB(dib_id,
185 scoped_dib_handle.release());
183 if (!dib) 186 if (!dib)
184 return; 187 return;
185 188
186 if (!use_render_) 189 if (!use_render_)
187 return PaintRectWithoutXrender(dib, bitmap_rect, copy_rects); 190 return PaintRectWithoutXrender(dib, bitmap_rect, copy_rects);
188 191
189 Picture picture; 192 Picture picture;
190 Pixmap pixmap; 193 Pixmap pixmap;
191 194
192 if (shared_memory_support_ == x11_util::SHARED_MEMORY_PIXMAP) { 195 if (shared_memory_support_ == x11_util::SHARED_MEMORY_PIXMAP) {
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 cairo_set_source(cr, pattern); 475 cairo_set_source(cr, pattern);
473 cairo_pattern_destroy(pattern); 476 cairo_pattern_destroy(pattern);
474 477
475 cairo_identity_matrix(cr); 478 cairo_identity_matrix(cr);
476 479
477 cairo_rectangle(cr, rect.x(), rect.y(), rect.width(), rect.height()); 480 cairo_rectangle(cr, rect.x(), rect.y(), rect.width(), rect.height());
478 cairo_fill(cr); 481 cairo_fill(cr);
479 cairo_destroy(cr); 482 cairo_destroy(cr);
480 } 483 }
481 #endif 484 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698