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

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

Issue 126101: Adds kind-of-live thumbnail generation for a potential tab switcher. (Closed)
Patch Set: For Checking hopefully 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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.h" 5 #include "chrome/browser/renderer_host/backing_store.h"
6 6
7 #include "base/gfx/gdi_util.h" 7 #include "base/gfx/gdi_util.h"
8 #include "chrome/browser/renderer_host/render_widget_host.h" 8 #include "chrome/browser/renderer_host/render_widget_host.h"
9 #include "chrome/common/transport_dib.h" 9 #include "chrome/common/transport_dib.h"
10 10
11 namespace { 11 namespace {
12 12
13 // Creates a dib conforming to the height/width/section parameters passed in. 13 // Creates a dib conforming to the height/width/section parameters passed in.
14 HANDLE CreateDIB(HDC dc, int width, int height, int color_depth) { 14 HANDLE CreateDIB(HDC dc, int width, int height, int color_depth) {
15 BITMAPINFOHEADER hdr; 15 BITMAPINFOHEADER hdr;
16 gfx::CreateBitmapHeaderWithColorDepth(width, height, color_depth, &hdr); 16 gfx::CreateBitmapHeaderWithColorDepth(width, height, color_depth, &hdr);
17 void* data = NULL; 17 void* data = NULL;
18 HANDLE dib = CreateDIBSection(dc, reinterpret_cast<BITMAPINFO*>(&hdr), 18 HANDLE dib = CreateDIBSection(dc, reinterpret_cast<BITMAPINFO*>(&hdr),
19 0, &data, NULL, 0); 19 0, &data, NULL, 0);
20 DCHECK(data); 20 DCHECK(data);
21 return dib; 21 return dib;
22 } 22 }
23 23
24 } // namespace 24 } // namespace
25 25
26 // BackingStore (Windows) ------------------------------------------------------ 26 // BackingStore (Windows) ------------------------------------------------------
27 27
28 BackingStore::BackingStore(const gfx::Size& size) 28 BackingStore::BackingStore(RenderWidgetHost* widget, const gfx::Size& size)
29 : size_(size), 29 : render_widget_host_(widget),
30 size_(size),
30 backing_store_dib_(NULL), 31 backing_store_dib_(NULL),
31 original_bitmap_(NULL) { 32 original_bitmap_(NULL) {
32 HDC screen_dc = ::GetDC(NULL); 33 HDC screen_dc = ::GetDC(NULL);
33 color_depth_ = ::GetDeviceCaps(screen_dc, BITSPIXEL); 34 color_depth_ = ::GetDeviceCaps(screen_dc, BITSPIXEL);
34 // Color depths less than 16 bpp require a palette to be specified. Instead, 35 // Color depths less than 16 bpp require a palette to be specified. Instead,
35 // we specify the desired color depth as 16 which lets the OS to come up 36 // we specify the desired color depth as 16 which lets the OS to come up
36 // with an approximation. 37 // with an approximation.
37 if (color_depth_ < 16) 38 if (color_depth_ < 16)
38 color_depth_ = 16; 39 color_depth_ = 16;
39 hdc_ = CreateCompatibleDC(screen_dc); 40 hdc_ = CreateCompatibleDC(screen_dc);
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 ScrollDC(hdc_, dx, dy, NULL, &r, NULL, &damaged_rect); 93 ScrollDC(hdc_, dx, dy, NULL, &r, NULL, &damaged_rect);
93 94
94 // TODO(darin): this doesn't work if dx and dy are both non-zero! 95 // TODO(darin): this doesn't work if dx and dy are both non-zero!
95 DCHECK(dx == 0 || dy == 0); 96 DCHECK(dx == 0 || dy == 0);
96 97
97 // We expect that damaged_rect should equal bitmap_rect. 98 // We expect that damaged_rect should equal bitmap_rect.
98 DCHECK(gfx::Rect(damaged_rect) == bitmap_rect); 99 DCHECK(gfx::Rect(damaged_rect) == bitmap_rect);
99 100
100 PaintRect(process, bitmap, bitmap_rect); 101 PaintRect(process, bitmap, bitmap_rect);
101 } 102 }
OLDNEW
« no previous file with comments | « chrome/browser/renderer_host/backing_store_manager.cc ('k') | chrome/browser/renderer_host/backing_store_x.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698