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/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 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 LOG(ERROR) << "cannot create a memory DC: " << GetLastError(); | 215 LOG(ERROR) << "cannot create a memory DC: " << GetLastError(); |
216 return; | 216 return; |
217 } | 217 } |
218 | 218 |
219 BITMAPINFOHEADER header; | 219 BITMAPINFOHEADER header; |
220 gfx::CreateBitmapHeader(thumbnail_size.width(), thumbnail_size.height(), | 220 gfx::CreateBitmapHeader(thumbnail_size.width(), thumbnail_size.height(), |
221 &header); | 221 &header); |
222 | 222 |
223 void* bitmap_data = NULL; | 223 void* bitmap_data = NULL; |
224 base::win::ScopedBitmap bitmap( | 224 base::win::ScopedBitmap bitmap( |
225 CreateDIBSection(hdc, reinterpret_cast<BITMAPINFO*>(&header), | 225 CreateDIBSection(hdc.Get(), reinterpret_cast<BITMAPINFO*>(&header), |
226 DIB_RGB_COLORS, &bitmap_data, NULL, 0)); | 226 DIB_RGB_COLORS, &bitmap_data, NULL, 0)); |
227 | 227 |
228 if (!bitmap.Get() || !bitmap_data) { | 228 if (!bitmap.Get() || !bitmap_data) { |
229 LOG(ERROR) << "cannot create a bitmap: " << GetLastError(); | 229 LOG(ERROR) << "cannot create a bitmap: " << GetLastError(); |
230 return; | 230 return; |
231 } | 231 } |
232 | 232 |
233 SkAutoLockPixels lock(thumbnail_bitmap); | 233 SkAutoLockPixels lock(thumbnail_bitmap); |
234 int* content_pixels = reinterpret_cast<int*>(bitmap_data); | 234 int* content_pixels = reinterpret_cast<int*>(bitmap_data); |
235 for (int y = 0; y < thumbnail_size.height(); ++y) { | 235 for (int y = 0; y < thumbnail_size.height(); ++y) { |
(...skipping 768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1004 // This code is just copied from "thumbnail_generator.cc". | 1004 // This code is just copied from "thumbnail_generator.cc". |
1005 skia::PlatformCanvas canvas; | 1005 skia::PlatformCanvas canvas; |
1006 if (!backing_store->CopyFromBackingStore(gfx::Rect(backing_store->size()), | 1006 if (!backing_store->CopyFromBackingStore(gfx::Rect(backing_store->size()), |
1007 &canvas)) | 1007 &canvas)) |
1008 return false; | 1008 return false; |
1009 | 1009 |
1010 const SkBitmap& bitmap = skia::GetTopDevice(canvas)->accessBitmap(false); | 1010 const SkBitmap& bitmap = skia::GetTopDevice(canvas)->accessBitmap(false); |
1011 bitmap.copyTo(preview, SkBitmap::kARGB_8888_Config); | 1011 bitmap.copyTo(preview, SkBitmap::kARGB_8888_Config); |
1012 return true; | 1012 return true; |
1013 } | 1013 } |
OLD | NEW |