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

Unified Diff: chrome/browser/renderer_host/backing_store_x.cc

Issue 144006: Add Linux support for getting the thumbnail and wire into the switcher. (Closed)
Patch Set: For checkin Created 11 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/renderer_host/backing_store.h ('k') | chrome/browser/tab_contents/thumbnail_generator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/renderer_host/backing_store_x.cc
diff --git a/chrome/browser/renderer_host/backing_store_x.cc b/chrome/browser/renderer_host/backing_store_x.cc
index 9083dfcb8753892e0b99ac572b9b43c16e0e9b0a..a2397a2dd3857465a3b85a3dc1eae40377987616 100644
--- a/chrome/browser/renderer_host/backing_store_x.cc
+++ b/chrome/browser/renderer_host/backing_store_x.cc
@@ -313,7 +313,7 @@ void BackingStore::ShowRect(const gfx::Rect& rect, XID target) {
rect.x(), rect.y());
}
-SkBitmap* BackingStore::PaintRectToBitmap(const gfx::Rect& rect) {
+SkBitmap BackingStore::PaintRectToBitmap(const gfx::Rect& rect) {
static const int kBytesPerPixel = 4;
const int width = rect.width();
@@ -322,18 +322,20 @@ SkBitmap* BackingStore::PaintRectToBitmap(const gfx::Rect& rect) {
rect.x(), rect.y(),
width, height,
AllPlanes, ZPixmap);
+
+ SkBitmap bitmap;
+
// TODO(jhawkins): Need to convert the image data if the image bits per pixel
// is not 32.
if (image->bits_per_pixel != 32) {
XFree(image);
- return NULL;
+ return bitmap; // Return the empty bitmap to indicate failure.
}
- SkBitmap* bitmap = new SkBitmap();
- bitmap->setConfig(SkBitmap::kARGB_8888_Config, width, height);
- bitmap->allocPixels();
+ bitmap.setConfig(SkBitmap::kARGB_8888_Config, width, height);
+ bitmap.allocPixels();
unsigned char* bitmap_data =
- reinterpret_cast<unsigned char*>(bitmap->getAddr32(0, 0));
+ reinterpret_cast<unsigned char*>(bitmap.getAddr32(0, 0));
memcpy(bitmap_data, image->data, width * height * kBytesPerPixel);
XFree(image);
« no previous file with comments | « chrome/browser/renderer_host/backing_store.h ('k') | chrome/browser/tab_contents/thumbnail_generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698