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 "chrome/browser/aeropeek_manager.h" | 5 #include "chrome/browser/aeropeek_manager.h" |
6 | 6 |
7 #include <dwmapi.h> | 7 #include <dwmapi.h> |
8 #include <shobjidl.h> | 8 #include <shobjidl.h> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 thumbnail_bitmap = skia::ImageOperations::Resize( | 217 thumbnail_bitmap = skia::ImageOperations::Resize( |
218 tab_bitmap_, | 218 tab_bitmap_, |
219 skia::ImageOperations::RESIZE_LANCZOS3, | 219 skia::ImageOperations::RESIZE_LANCZOS3, |
220 thumbnail_size.width(), | 220 thumbnail_size.width(), |
221 thumbnail_size.height()); | 221 thumbnail_size.height()); |
222 } | 222 } |
223 | 223 |
224 // Create a DIB, copy the resized image, and send the DIB to Windows. | 224 // Create a DIB, copy the resized image, and send the DIB to Windows. |
225 // We can delete this DIB after sending it to Windows since Windows creates | 225 // We can delete this DIB after sending it to Windows since Windows creates |
226 // a copy of the DIB and use it. | 226 // a copy of the DIB and use it. |
227 base::win::ScopedHDC hdc(CreateCompatibleDC(NULL)); | 227 base::win::ScopedCreateDC hdc(CreateCompatibleDC(NULL)); |
228 if (!hdc.Get()) { | 228 if (!hdc.Get()) { |
229 LOG(ERROR) << "cannot create a memory DC: " << GetLastError(); | 229 LOG(ERROR) << "cannot create a memory DC: " << GetLastError(); |
230 return; | 230 return; |
231 } | 231 } |
232 | 232 |
233 BITMAPINFOHEADER header; | 233 BITMAPINFOHEADER header; |
234 gfx::CreateBitmapHeader(thumbnail_size.width(), thumbnail_size.height(), | 234 gfx::CreateBitmapHeader(thumbnail_size.width(), thumbnail_size.height(), |
235 &header); | 235 &header); |
236 | 236 |
237 void* bitmap_data = NULL; | 237 void* bitmap_data = NULL; |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 | 332 |
333 ~SendLivePreviewTask() { | 333 ~SendLivePreviewTask() { |
334 } | 334 } |
335 | 335 |
336 private: | 336 private: |
337 void Run() { | 337 void Run() { |
338 // Create a DIB for the user-perceived content area of the tab, copy the | 338 // Create a DIB for the user-perceived content area of the tab, copy the |
339 // tab image into the DIB, and send it to Windows. | 339 // tab image into the DIB, and send it to Windows. |
340 // We don't need to paste this tab image onto the frame image since Windows | 340 // We don't need to paste this tab image onto the frame image since Windows |
341 // automatically pastes it for us. | 341 // automatically pastes it for us. |
342 base::win::ScopedHDC hdc(CreateCompatibleDC(NULL)); | 342 base::win::ScopedCreateDC hdc(CreateCompatibleDC(NULL)); |
343 if (!hdc.Get()) { | 343 if (!hdc.Get()) { |
344 LOG(ERROR) << "cannot create a memory DC: " << GetLastError(); | 344 LOG(ERROR) << "cannot create a memory DC: " << GetLastError(); |
345 return; | 345 return; |
346 } | 346 } |
347 | 347 |
348 BITMAPINFOHEADER header; | 348 BITMAPINFOHEADER header; |
349 gfx::CreateBitmapHeader(content_bounds_.width(), content_bounds_.height(), | 349 gfx::CreateBitmapHeader(content_bounds_.width(), content_bounds_.height(), |
350 &header); | 350 &header); |
351 | 351 |
352 void* bitmap_data = NULL; | 352 void* bitmap_data = NULL; |
(...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1117 // This code is just copied from "thumbnail_generator.cc". | 1117 // This code is just copied from "thumbnail_generator.cc". |
1118 skia::PlatformCanvas canvas; | 1118 skia::PlatformCanvas canvas; |
1119 if (!backing_store->CopyFromBackingStore(gfx::Rect(backing_store->size()), | 1119 if (!backing_store->CopyFromBackingStore(gfx::Rect(backing_store->size()), |
1120 &canvas)) | 1120 &canvas)) |
1121 return false; | 1121 return false; |
1122 | 1122 |
1123 const SkBitmap& bitmap = skia::GetTopDevice(canvas)->accessBitmap(false); | 1123 const SkBitmap& bitmap = skia::GetTopDevice(canvas)->accessBitmap(false); |
1124 bitmap.copyTo(preview, SkBitmap::kARGB_8888_Config); | 1124 bitmap.copyTo(preview, SkBitmap::kARGB_8888_Config); |
1125 return true; | 1125 return true; |
1126 } | 1126 } |
OLD | NEW |