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

Side by Side Diff: printing/image_win.cc

Issue 7019013: Removal of dependencies on PlatformDevice classes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Syncing merge conflicts. Created 9 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « printing/emf_win.cc ('k') | printing/metafile.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "printing/image.h" 5 #include "printing/image.h"
6 6
7 #include "printing/metafile.h" 7 #include "printing/metafile.h"
8 #include "skia/ext/platform_device.h" 8 #include "skia/ext/platform_device.h"
9 #include "ui/gfx/gdi_util.h" // EMF support 9 #include "ui/gfx/gdi_util.h" // EMF support
10 #include "ui/gfx/rect.h" 10 #include "ui/gfx/rect.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 62
63 size_ = rect.size(); 63 size_ = rect.size();
64 gfx::CreateBitmapV4Header(rect.width(), rect.height(), &hdr); 64 gfx::CreateBitmapV4Header(rect.width(), rect.height(), &hdr);
65 void* bits; 65 void* bits;
66 HBITMAP bitmap = CreateDIBSection(hdc, 66 HBITMAP bitmap = CreateDIBSection(hdc,
67 reinterpret_cast<BITMAPINFO*>(&hdr), 0, 67 reinterpret_cast<BITMAPINFO*>(&hdr), 0,
68 &bits, NULL, 0); 68 &bits, NULL, 0);
69 DCHECK(bitmap); 69 DCHECK(bitmap);
70 DCHECK(SelectObject(hdc, bitmap)); 70 DCHECK(SelectObject(hdc, bitmap));
71 71
72 skia::PlatformDevice::InitializeDC(hdc); 72 skia::InitializeDC(hdc);
73 73
74 bool success = metafile.Playback(hdc, NULL); 74 bool success = metafile.Playback(hdc, NULL);
75 75
76 row_length_ = size_.width() * sizeof(uint32); 76 row_length_ = size_.width() * sizeof(uint32);
77 size_t bytes = row_length_ * size_.height(); 77 size_t bytes = row_length_ * size_.height();
78 DCHECK(bytes); 78 DCHECK(bytes);
79 79
80 data_.resize(bytes); 80 data_.resize(bytes);
81 memcpy(&*data_.begin(), bits, bytes); 81 memcpy(&*data_.begin(), bits, bytes);
82 82
83 DeleteDC(hdc); 83 DeleteDC(hdc);
84 DeleteObject(bitmap); 84 DeleteObject(bitmap);
85 85
86 return success; 86 return success;
87 } 87 }
88 88
89 } // namespace printing 89 } // namespace printing
OLDNEW
« no previous file with comments | « printing/emf_win.cc ('k') | printing/metafile.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698