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

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

Issue 506013: Combine ViewHostMsg_{Paint,Scroll}Rect into one IPC.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years 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 #include "chrome/browser/renderer_host/backing_store.h" 5 #include "chrome/browser/renderer_host/backing_store.h"
6 6
7 #include <stdlib.h> 7 #include <stdlib.h>
8 #include <sys/ipc.h> 8 #include <sys/ipc.h>
9 #include <sys/shm.h> 9 #include <sys/shm.h>
10 #if defined(TOOLKIT_GTK) 10 #if defined(TOOLKIT_GTK)
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 304
305 // In the case of shared memory, we wait for the composite to complete so that 305 // In the case of shared memory, we wait for the composite to complete so that
306 // we are sure that the X server has finished reading. 306 // we are sure that the X server has finished reading.
307 if (use_shared_memory_) 307 if (use_shared_memory_)
308 XSync(display_, False); 308 XSync(display_, False);
309 309
310 XRenderFreePicture(display_, picture); 310 XRenderFreePicture(display_, picture);
311 XFreePixmap(display_, pixmap); 311 XFreePixmap(display_, pixmap);
312 } 312 }
313 313
314 void BackingStore::ScrollRect(base::ProcessHandle process, 314 void BackingStore::ScrollRect(int dx, int dy,
315 TransportDIB* bitmap,
316 const gfx::Rect& bitmap_rect,
317 int dx, int dy,
318 const gfx::Rect& clip_rect, 315 const gfx::Rect& clip_rect,
319 const gfx::Size& view_size) { 316 const gfx::Size& view_size) {
320 if (!display_) 317 if (!display_)
321 return; 318 return;
322 319
323 // We only support scrolling in one direction at a time. 320 // We only support scrolling in one direction at a time.
324 DCHECK(dx == 0 || dy == 0); 321 DCHECK(dx == 0 || dy == 0);
325 322
326 if (dy) { 323 if (dy) {
327 // Positive values of |dy| scroll up 324 // Positive values of |dy| scroll up
(...skipping 11 matching lines...) Expand all
339 if (abs(dx) < clip_rect.width()) { 336 if (abs(dx) < clip_rect.width()) {
340 XCopyArea(display_, pixmap_, pixmap_, static_cast<GC>(pixmap_gc_), 337 XCopyArea(display_, pixmap_, pixmap_, static_cast<GC>(pixmap_gc_),
341 std::max(clip_rect.x(), clip_rect.x() - dx), 338 std::max(clip_rect.x(), clip_rect.x() - dx),
342 clip_rect.y() /* source y */, 339 clip_rect.y() /* source y */,
343 clip_rect.width() - abs(dx), 340 clip_rect.width() - abs(dx),
344 clip_rect.height(), 341 clip_rect.height(),
345 std::max(clip_rect.x(), clip_rect.x() + dx) /* dest x */, 342 std::max(clip_rect.x(), clip_rect.x() + dx) /* dest x */,
346 clip_rect.y() /* dest x */); 343 clip_rect.y() /* dest x */);
347 } 344 }
348 } 345 }
349
350 PaintRect(process, bitmap, bitmap_rect, bitmap_rect);
351 } 346 }
352 347
353 void BackingStore::ShowRect(const gfx::Rect& rect, XID target) { 348 void BackingStore::ShowRect(const gfx::Rect& rect, XID target) {
354 XCopyArea(display_, pixmap_, target, static_cast<GC>(pixmap_gc_), 349 XCopyArea(display_, pixmap_, target, static_cast<GC>(pixmap_gc_),
355 rect.x(), rect.y(), rect.width(), rect.height(), 350 rect.x(), rect.y(), rect.width(), rect.height(),
356 rect.x(), rect.y()); 351 rect.x(), rect.y());
357 } 352 }
358 353
359 #if defined(TOOLKIT_GTK) 354 #if defined(TOOLKIT_GTK)
360 void BackingStore::PaintToRect(const gfx::Rect& rect, GdkDrawable* target) { 355 void BackingStore::PaintToRect(const gfx::Rect& rect, GdkDrawable* target) {
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 441
447 if (use_shared_memory_) 442 if (use_shared_memory_)
448 DestroySharedImage(display_, image, &shminfo); 443 DestroySharedImage(display_, image, &shminfo);
449 else 444 else
450 XDestroyImage(image); 445 XDestroyImage(image);
451 446
452 HISTOGRAM_TIMES("BackingStore.RetrievalFromX", 447 HISTOGRAM_TIMES("BackingStore.RetrievalFromX",
453 base::TimeTicks::Now() - begin_time); 448 base::TimeTicks::Now() - begin_time);
454 return bitmap; 449 return bitmap;
455 } 450 }
OLDNEW
« no previous file with comments | « chrome/browser/renderer_host/backing_store_win.cc ('k') | chrome/browser/renderer_host/browser_render_process_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698