OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_x.h" | 5 #include "content/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 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 DestroySharedImage(display_, image, &shminfo); | 368 DestroySharedImage(display_, image, &shminfo); |
369 else | 369 else |
370 XDestroyImage(image); | 370 XDestroyImage(image); |
371 return false; | 371 return false; |
372 } | 372 } |
373 | 373 |
374 // The X image might have a different row stride, so iterate through | 374 // The X image might have a different row stride, so iterate through |
375 // it and copy each row out, only up to the pixels we're actually | 375 // it and copy each row out, only up to the pixels we're actually |
376 // using. This code assumes a visual mode where a pixel is | 376 // using. This code assumes a visual mode where a pixel is |
377 // represented using a 32-bit unsigned int, with a byte per component. | 377 // represented using a 32-bit unsigned int, with a byte per component. |
378 SkBitmap bitmap = output->getTopPlatformDevice().accessBitmap(true); | 378 SkBitmap bitmap = skia::GetTopDevice(*output)->accessBitmap(true); |
379 for (int y = 0; y < height; y++) { | 379 for (int y = 0; y < height; y++) { |
380 const uint32* src_row = reinterpret_cast<uint32*>( | 380 const uint32* src_row = reinterpret_cast<uint32*>( |
381 &image->data[image->bytes_per_line * y]); | 381 &image->data[image->bytes_per_line * y]); |
382 uint32* dest_row = bitmap.getAddr32(0, y); | 382 uint32* dest_row = bitmap.getAddr32(0, y); |
383 for (int x = 0; x < width; ++x, ++dest_row) { | 383 for (int x = 0; x < width; ++x, ++dest_row) { |
384 // Force alpha to be 0xff, because otherwise it causes rendering problems. | 384 // Force alpha to be 0xff, because otherwise it causes rendering problems. |
385 *dest_row = src_row[x] | 0xff000000; | 385 *dest_row = src_row[x] | 0xff000000; |
386 } | 386 } |
387 } | 387 } |
388 | 388 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
468 cairo_set_source(cr, pattern); | 468 cairo_set_source(cr, pattern); |
469 cairo_pattern_destroy(pattern); | 469 cairo_pattern_destroy(pattern); |
470 | 470 |
471 cairo_identity_matrix(cr); | 471 cairo_identity_matrix(cr); |
472 | 472 |
473 cairo_rectangle(cr, rect.x(), rect.y(), rect.width(), rect.height()); | 473 cairo_rectangle(cr, rect.x(), rect.y(), rect.width(), rect.height()); |
474 cairo_fill(cr); | 474 cairo_fill(cr); |
475 cairo_destroy(cr); | 475 cairo_destroy(cr); |
476 } | 476 } |
477 #endif | 477 #endif |
OLD | NEW |