| OLD | NEW | 
|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/renderer_host/backing_store_gtk.h" | 5 #include "content/browser/renderer_host/backing_store_gtk.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 646 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 657   } | 657   } | 
| 658 } | 658 } | 
| 659 | 659 | 
| 660 void BackingStoreGtk::XShowRect(const gfx::Point &origin, | 660 void BackingStoreGtk::XShowRect(const gfx::Point &origin, | 
| 661                                 const gfx::Rect& rect, XID target) { | 661                                 const gfx::Rect& rect, XID target) { | 
| 662   XCopyArea(display_, pixmap_, target, static_cast<GC>(pixmap_gc_), | 662   XCopyArea(display_, pixmap_, target, static_cast<GC>(pixmap_gc_), | 
| 663             rect.x(), rect.y(), rect.width(), rect.height(), | 663             rect.x(), rect.y(), rect.width(), rect.height(), | 
| 664             rect.x() + origin.x(), rect.y() + origin.y()); | 664             rect.x() + origin.x(), rect.y() + origin.y()); | 
| 665 } | 665 } | 
| 666 | 666 | 
| 667 void BackingStoreGtk::CairoShowRect(const gfx::Rect& rect, |  | 
| 668                                     GdkDrawable* drawable) { |  | 
| 669   cairo_surface_t* surface = cairo_xlib_surface_create( |  | 
| 670       display_, pixmap_, static_cast<Visual*>(visual_), |  | 
| 671       size().width(), size().height()); |  | 
| 672   cairo_t* cr = gdk_cairo_create(drawable); |  | 
| 673   cairo_set_source_surface(cr, surface, 0, 0); |  | 
| 674 |  | 
| 675   cairo_rectangle(cr, rect.x(), rect.y(), rect.width(), rect.height()); |  | 
| 676   cairo_fill(cr); |  | 
| 677   cairo_destroy(cr); |  | 
| 678   cairo_surface_destroy(surface); |  | 
| 679 } |  | 
| 680 |  | 
| 681 #if defined(TOOLKIT_GTK) | 667 #if defined(TOOLKIT_GTK) | 
| 682 void BackingStoreGtk::PaintToRect(const gfx::Rect& rect, GdkDrawable* target) { | 668 void BackingStoreGtk::PaintToRect(const gfx::Rect& rect, GdkDrawable* target) { | 
| 683   cairo_surface_t* surface = cairo_xlib_surface_create( | 669   cairo_surface_t* surface = cairo_xlib_surface_create( | 
| 684       display_, pixmap_, static_cast<Visual*>(visual_), | 670       display_, pixmap_, static_cast<Visual*>(visual_), | 
| 685       size().width(), size().height()); | 671       size().width(), size().height()); | 
| 686   cairo_t* cr = gdk_cairo_create(target); | 672   cairo_t* cr = gdk_cairo_create(target); | 
| 687 | 673 | 
| 688   cairo_translate(cr, rect.x(), rect.y()); | 674   cairo_translate(cr, rect.x(), rect.y()); | 
| 689   double x_scale = static_cast<double>(rect.width()) / size().width(); | 675   double x_scale = static_cast<double>(rect.width()) / size().width(); | 
| 690   double y_scale = static_cast<double>(rect.height()) / size().height(); | 676   double y_scale = static_cast<double>(rect.height()) / size().height(); | 
| 691   cairo_scale(cr, x_scale, y_scale); | 677   cairo_scale(cr, x_scale, y_scale); | 
| 692 | 678 | 
| 693   cairo_pattern_t* pattern = cairo_pattern_create_for_surface(surface); | 679   cairo_pattern_t* pattern = cairo_pattern_create_for_surface(surface); | 
| 694   cairo_pattern_set_filter(pattern, CAIRO_FILTER_BEST); | 680   cairo_pattern_set_filter(pattern, CAIRO_FILTER_BEST); | 
| 695   cairo_set_source(cr, pattern); | 681   cairo_set_source(cr, pattern); | 
| 696   cairo_pattern_destroy(pattern); | 682   cairo_pattern_destroy(pattern); | 
| 697 | 683 | 
| 698   cairo_identity_matrix(cr); | 684   cairo_identity_matrix(cr); | 
| 699 | 685 | 
| 700   cairo_rectangle(cr, rect.x(), rect.y(), rect.width(), rect.height()); | 686   cairo_rectangle(cr, rect.x(), rect.y(), rect.width(), rect.height()); | 
| 701   cairo_fill(cr); | 687   cairo_fill(cr); | 
| 702   cairo_destroy(cr); | 688   cairo_destroy(cr); | 
| 703 } | 689 } | 
| 704 #endif | 690 #endif | 
| 705 | 691 | 
| 706 }  // namespace content | 692 }  // namespace content | 
| OLD | NEW | 
|---|