| 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 16 matching lines...) Expand all Loading... |
| 27 #include "base/time.h" | 27 #include "base/time.h" |
| 28 #include "content/browser/renderer_host/render_process_host_impl.h" | 28 #include "content/browser/renderer_host/render_process_host_impl.h" |
| 29 #include "skia/ext/platform_canvas.h" | 29 #include "skia/ext/platform_canvas.h" |
| 30 #include "third_party/skia/include/core/SkBitmap.h" | 30 #include "third_party/skia/include/core/SkBitmap.h" |
| 31 #include "ui/base/gtk/gtk_signal.h" | 31 #include "ui/base/gtk/gtk_signal.h" |
| 32 #include "ui/base/x/x11_util.h" | 32 #include "ui/base/x/x11_util.h" |
| 33 #include "ui/base/x/x11_util_internal.h" | 33 #include "ui/base/x/x11_util_internal.h" |
| 34 #include "ui/gfx/rect.h" | 34 #include "ui/gfx/rect.h" |
| 35 #include "ui/surface/transport_dib.h" | 35 #include "ui/surface/transport_dib.h" |
| 36 | 36 |
| 37 using content::RenderWidgetHost; | 37 namespace content { |
| 38 | |
| 39 namespace { | 38 namespace { |
| 40 | 39 |
| 41 // Assume that somewhere along the line, someone will do width * height * 4 | 40 // Assume that somewhere along the line, someone will do width * height * 4 |
| 42 // with signed numbers. If the maximum value is 2**31, then 2**31 / 4 = | 41 // with signed numbers. If the maximum value is 2**31, then 2**31 / 4 = |
| 43 // 2**29 and floor(sqrt(2**29)) = 23170. | 42 // 2**29 and floor(sqrt(2**29)) = 23170. |
| 44 | 43 |
| 45 // Max height and width for layers | 44 // Max height and width for layers |
| 46 static const int kMaxVideoLayerSize = 23170; | 45 static const int kMaxVideoLayerSize = 23170; |
| 47 | 46 |
| 48 | 47 |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 copy_rect.width(), // width | 322 copy_rect.width(), // width |
| 324 copy_rect.height(), // height | 323 copy_rect.height(), // height |
| 325 copy_rect.x(), // dest_x | 324 copy_rect.x(), // dest_x |
| 326 copy_rect.y()); // dest_y | 325 copy_rect.y()); // dest_y |
| 327 } | 326 } |
| 328 | 327 |
| 329 XFreePixmap(display_, pixmap); | 328 XFreePixmap(display_, pixmap); |
| 330 } | 329 } |
| 331 | 330 |
| 332 void BackingStoreGtk::PaintToBackingStore( | 331 void BackingStoreGtk::PaintToBackingStore( |
| 333 content::RenderProcessHost* process, | 332 RenderProcessHost* process, |
| 334 TransportDIB::Id bitmap, | 333 TransportDIB::Id bitmap, |
| 335 const gfx::Rect& bitmap_rect, | 334 const gfx::Rect& bitmap_rect, |
| 336 const std::vector<gfx::Rect>& copy_rects, | 335 const std::vector<gfx::Rect>& copy_rects, |
| 337 float scale_factor, | 336 float scale_factor, |
| 338 const base::Closure& completion_callback, | 337 const base::Closure& completion_callback, |
| 339 bool* scheduled_completion_callback) { | 338 bool* scheduled_completion_callback) { |
| 340 *scheduled_completion_callback = false; | 339 *scheduled_completion_callback = false; |
| 341 | 340 |
| 342 if (!display_) | 341 if (!display_) |
| 343 return; | 342 return; |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 656 cairo_set_source(cr, pattern); | 655 cairo_set_source(cr, pattern); |
| 657 cairo_pattern_destroy(pattern); | 656 cairo_pattern_destroy(pattern); |
| 658 | 657 |
| 659 cairo_identity_matrix(cr); | 658 cairo_identity_matrix(cr); |
| 660 | 659 |
| 661 cairo_rectangle(cr, rect.x(), rect.y(), rect.width(), rect.height()); | 660 cairo_rectangle(cr, rect.x(), rect.y(), rect.width(), rect.height()); |
| 662 cairo_fill(cr); | 661 cairo_fill(cr); |
| 663 cairo_destroy(cr); | 662 cairo_destroy(cr); |
| 664 } | 663 } |
| 665 #endif | 664 #endif |
| 665 |
| 666 } // namespace content |
| OLD | NEW |