OLD | NEW |
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 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 clip_rect.y() /* source y */, | 429 clip_rect.y() /* source y */, |
430 clip_rect.width() - abs(dx), | 430 clip_rect.width() - abs(dx), |
431 clip_rect.height(), | 431 clip_rect.height(), |
432 std::max(clip_rect.x(), clip_rect.x() + dx) /* dest x */, | 432 std::max(clip_rect.x(), clip_rect.x() + dx) /* dest x */, |
433 clip_rect.y() /* dest x */); | 433 clip_rect.y() /* dest x */); |
434 } | 434 } |
435 } | 435 } |
436 } | 436 } |
437 | 437 |
438 void BackingStoreX::XShowRect(const gfx::Rect& rect, XID target) { | 438 void BackingStoreX::XShowRect(const gfx::Rect& rect, XID target) { |
| 439 XShowRect(gfx::Point(0, 0), rect, target); |
| 440 } |
| 441 |
| 442 void BackingStoreX::XShowRect(const gfx::Point &origin, |
| 443 const gfx::Rect& rect, XID target) { |
439 XCopyArea(display_, pixmap_, target, static_cast<GC>(pixmap_gc_), | 444 XCopyArea(display_, pixmap_, target, static_cast<GC>(pixmap_gc_), |
440 rect.x(), rect.y(), rect.width(), rect.height(), | 445 rect.x(), rect.y(), rect.width(), rect.height(), |
441 rect.x(), rect.y()); | 446 rect.x() + origin.x(), rect.y() + origin.y()); |
442 } | 447 } |
443 | 448 |
444 void BackingStoreX::CairoShowRect(const gfx::Rect& rect, | 449 void BackingStoreX::CairoShowRect(const gfx::Rect& rect, |
445 GdkDrawable* drawable) { | 450 GdkDrawable* drawable) { |
446 cairo_surface_t* surface = cairo_xlib_surface_create( | 451 cairo_surface_t* surface = cairo_xlib_surface_create( |
447 display_, pixmap_, static_cast<Visual*>(visual_), | 452 display_, pixmap_, static_cast<Visual*>(visual_), |
448 size().width(), size().height()); | 453 size().width(), size().height()); |
449 cairo_t* cr = gdk_cairo_create(drawable); | 454 cairo_t* cr = gdk_cairo_create(drawable); |
450 cairo_set_source_surface(cr, surface, 0, 0); | 455 cairo_set_source_surface(cr, surface, 0, 0); |
451 | 456 |
(...skipping 20 matching lines...) Expand all Loading... |
472 cairo_set_source(cr, pattern); | 477 cairo_set_source(cr, pattern); |
473 cairo_pattern_destroy(pattern); | 478 cairo_pattern_destroy(pattern); |
474 | 479 |
475 cairo_identity_matrix(cr); | 480 cairo_identity_matrix(cr); |
476 | 481 |
477 cairo_rectangle(cr, rect.x(), rect.y(), rect.width(), rect.height()); | 482 cairo_rectangle(cr, rect.x(), rect.y(), rect.width(), rect.height()); |
478 cairo_fill(cr); | 483 cairo_fill(cr); |
479 cairo_destroy(cr); | 484 cairo_destroy(cr); |
480 } | 485 } |
481 #endif | 486 #endif |
OLD | NEW |