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

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

Issue 2904010: Fix acquisition of thumbnail images in Linux (Closed) Base URL: git@github.com:litl/big-chromium.git
Patch Set: Added my name to AUTHORS Created 10 years, 5 months 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
« no previous file with comments | « AUTHORS ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 // Use shared memory for faster copies when it's available. 319 // Use shared memory for faster copies when it's available.
320 Visual* visual = static_cast<Visual*>(visual_); 320 Visual* visual = static_cast<Visual*>(visual_);
321 memset(&shminfo, 0, sizeof(shminfo)); 321 memset(&shminfo, 0, sizeof(shminfo));
322 image = XShmCreateImage(display_, visual, 32, 322 image = XShmCreateImage(display_, visual, 32,
323 ZPixmap, NULL, &shminfo, width, height); 323 ZPixmap, NULL, &shminfo, width, height);
324 if (!image) { 324 if (!image) {
325 return false; 325 return false;
326 } 326 }
327 // Create the shared memory segment for the image and map it. 327 // Create the shared memory segment for the image and map it.
328 if (image->bytes_per_line == 0 || image->height == 0 || 328 if (image->bytes_per_line == 0 || image->height == 0 ||
329 (std::numeric_limits<size_t>::max() / image->bytes_per_line) > 329 static_cast<size_t>(image->height) >
330 static_cast<size_t>(image->height)) { 330 (std::numeric_limits<size_t>::max() / image->bytes_per_line)) {
331 XDestroyImage(image); 331 XDestroyImage(image);
332 return false; 332 return false;
333 } 333 }
334 shminfo.shmid = shmget(IPC_PRIVATE, image->bytes_per_line * image->height, 334 shminfo.shmid = shmget(IPC_PRIVATE, image->bytes_per_line * image->height,
335 IPC_CREAT|0666); 335 IPC_CREAT|0666);
336 if (shminfo.shmid == -1) { 336 if (shminfo.shmid == -1) {
337 XDestroyImage(image); 337 XDestroyImage(image);
338 return false; 338 return false;
339 } 339 }
340 340
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 cairo_set_source(cr, pattern); 467 cairo_set_source(cr, pattern);
468 cairo_pattern_destroy(pattern); 468 cairo_pattern_destroy(pattern);
469 469
470 cairo_identity_matrix(cr); 470 cairo_identity_matrix(cr);
471 471
472 cairo_rectangle(cr, rect.x(), rect.y(), rect.width(), rect.height()); 472 cairo_rectangle(cr, rect.x(), rect.y(), rect.width(), rect.height());
473 cairo_fill(cr); 473 cairo_fill(cr);
474 cairo_destroy(cr); 474 cairo_destroy(cr);
475 } 475 }
476 #endif 476 #endif
OLDNEW
« no previous file with comments | « AUTHORS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698