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

Side by Side Diff: printing/printing_context_win_unittest.cc

Issue 1488933002: Misc fixes for gn builds with VS 2015 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Disable warning 4267 which is the VC++ 2015 4244 Created 5 years 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) 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/printing_context_win.h" 5 #include "printing/printing_context_win.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/win/scoped_handle.h" 9 #include "base/win/scoped_handle.h"
10 #include "base/win/scoped_hdc.h" 10 #include "base/win/scoped_hdc.h"
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 return E_FAIL; 111 return E_FAIL;
112 void* dev_names_ptr = GlobalLock(dev_names_mem.Get()); 112 void* dev_names_ptr = GlobalLock(dev_names_mem.Get());
113 if (!dev_names_ptr) 113 if (!dev_names_ptr)
114 return E_FAIL; 114 return E_FAIL;
115 DEVNAMES* dev_names = reinterpret_cast<DEVNAMES*>(dev_names_ptr); 115 DEVNAMES* dev_names = reinterpret_cast<DEVNAMES*>(dev_names_ptr);
116 dev_names->wDefault = 1; 116 dev_names->wDefault = 1;
117 dev_names->wDriverOffset = sizeof(DEVNAMES) / sizeof(wchar_t); 117 dev_names->wDriverOffset = sizeof(DEVNAMES) / sizeof(wchar_t);
118 memcpy(reinterpret_cast<uint8*>(dev_names_ptr) + dev_names->wDriverOffset, 118 memcpy(reinterpret_cast<uint8*>(dev_names_ptr) + dev_names->wDriverOffset,
119 info_2.get()->pDriverName, 119 info_2.get()->pDriverName,
120 driver_size); 120 driver_size);
121 dev_names->wDeviceOffset = 121 dev_names->wDeviceOffset = base::checked_cast<WORD>(
122 dev_names->wDriverOffset + driver_size / sizeof(wchar_t); 122 dev_names->wDriverOffset + driver_size / sizeof(wchar_t));
123 memcpy(reinterpret_cast<uint8*>(dev_names_ptr) + dev_names->wDeviceOffset, 123 memcpy(reinterpret_cast<uint8*>(dev_names_ptr) + dev_names->wDeviceOffset,
124 info_2.get()->pPrinterName, 124 info_2.get()->pPrinterName,
125 printer_size); 125 printer_size);
126 dev_names->wOutputOffset = 126 dev_names->wOutputOffset = base::checked_cast<WORD>(
127 dev_names->wDeviceOffset + printer_size / sizeof(wchar_t); 127 dev_names->wDeviceOffset + printer_size / sizeof(wchar_t));
128 memcpy(reinterpret_cast<uint8*>(dev_names_ptr) + dev_names->wOutputOffset, 128 memcpy(reinterpret_cast<uint8*>(dev_names_ptr) + dev_names->wOutputOffset,
129 info_2.get()->pPortName, 129 info_2.get()->pPortName,
130 port_size); 130 port_size);
131 GlobalUnlock(dev_names_mem.Get()); 131 GlobalUnlock(dev_names_mem.Get());
132 dev_names_ptr = NULL; 132 dev_names_ptr = NULL;
133 133
134 lppd->hDC = hdc.Take(); 134 lppd->hDC = hdc.Take();
135 lppd->hDevMode = dev_mode_mem.Take(); 135 lppd->hDevMode = dev_mode_mem.Take();
136 lppd->hDevNames = dev_names_mem.Take(); 136 lppd->hDevNames = dev_names_mem.Take();
137 return S_OK; 137 return S_OK;
(...skipping 28 matching lines...) Expand all
166 EXPECT_EQ(PrintingContext::OK, context->InitWithSettings(settings)); 166 EXPECT_EQ(PrintingContext::OK, context->InitWithSettings(settings));
167 167
168 // The print may lie to use and may not support world transformation. 168 // The print may lie to use and may not support world transformation.
169 // Verify right now. 169 // Verify right now.
170 XFORM random_matrix = { 1, 0.1f, 0, 1.5f, 0, 1 }; 170 XFORM random_matrix = { 1, 0.1f, 0, 1.5f, 0, 1 };
171 EXPECT_TRUE(SetWorldTransform(context->context(), &random_matrix)); 171 EXPECT_TRUE(SetWorldTransform(context->context(), &random_matrix));
172 EXPECT_TRUE(ModifyWorldTransform(context->context(), NULL, MWT_IDENTITY)); 172 EXPECT_TRUE(ModifyWorldTransform(context->context(), NULL, MWT_IDENTITY));
173 } 173 }
174 174
175 } // namespace printing 175 } // namespace printing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698