| 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 "chrome/browser/ui/views/panels/taskbar_window_thumbnailer_win.h" | 5 #include "chrome/browser/ui/views/panels/taskbar_window_thumbnailer_win.h" |
| 6 | 6 |
| 7 #include <dwmapi.h> | 7 #include <dwmapi.h> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/win/scoped_hdc.h" | 10 #include "base/win/scoped_hdc.h" |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 if (bounds.bottom > enclosing_bottom) | 181 if (bounds.bottom > enclosing_bottom) |
| 182 enclosing_bottom = bounds.bottom; | 182 enclosing_bottom = bounds.bottom; |
| 183 } | 183 } |
| 184 } | 184 } |
| 185 | 185 |
| 186 int width = enclosing_right - enclosing_x; | 186 int width = enclosing_right - enclosing_x; |
| 187 int height = enclosing_bottom - enclosing_y; | 187 int height = enclosing_bottom - enclosing_y; |
| 188 if (!width || !height) | 188 if (!width || !height) |
| 189 return NULL; | 189 return NULL; |
| 190 | 190 |
| 191 gfx::Canvas canvas(gfx::Size(width, height), ui::SCALE_FACTOR_100P, false); | 191 gfx::Canvas canvas(gfx::Size(width, height), 1.0f, false); |
| 192 { | 192 { |
| 193 skia::ScopedPlatformPaint scoped_platform_paint(canvas.sk_canvas()); | 193 skia::ScopedPlatformPaint scoped_platform_paint(canvas.sk_canvas()); |
| 194 HDC target_dc = scoped_platform_paint.GetPlatformSurface(); | 194 HDC target_dc = scoped_platform_paint.GetPlatformSurface(); |
| 195 for (std::vector<HWND>::const_iterator iter = snapshot_hwnds.begin(); | 195 for (std::vector<HWND>::const_iterator iter = snapshot_hwnds.begin(); |
| 196 iter != snapshot_hwnds.end(); ++iter) { | 196 iter != snapshot_hwnds.end(); ++iter) { |
| 197 HWND current_hwnd = *iter; | 197 HWND current_hwnd = *iter; |
| 198 RECT current_bounds; | 198 RECT current_bounds; |
| 199 if (!::GetWindowRect(current_hwnd, ¤t_bounds)) | 199 if (!::GetWindowRect(current_hwnd, ¤t_bounds)) |
| 200 continue; | 200 continue; |
| 201 base::win::ScopedGetDC source_dc(current_hwnd); | 201 base::win::ScopedGetDC source_dc(current_hwnd); |
| 202 ::BitBlt(target_dc, | 202 ::BitBlt(target_dc, |
| 203 current_bounds.left - enclosing_x, | 203 current_bounds.left - enclosing_x, |
| 204 current_bounds.top - enclosing_y, | 204 current_bounds.top - enclosing_y, |
| 205 current_bounds.right - current_bounds.left, | 205 current_bounds.right - current_bounds.left, |
| 206 current_bounds.bottom - current_bounds.top, | 206 current_bounds.bottom - current_bounds.top, |
| 207 source_dc, | 207 source_dc, |
| 208 0, | 208 0, |
| 209 0, | 209 0, |
| 210 SRCCOPY); | 210 SRCCOPY); |
| 211 ::ReleaseDC(current_hwnd, source_dc); | 211 ::ReleaseDC(current_hwnd, source_dc); |
| 212 } | 212 } |
| 213 } | 213 } |
| 214 return new SkBitmap(canvas.ExtractImageRep().sk_bitmap()); | 214 return new SkBitmap(canvas.ExtractImageRep().sk_bitmap()); |
| 215 } | 215 } |
| OLD | NEW |