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

Side by Side Diff: chrome/renderer/print_web_view_helper_win.cc

Issue 8139022: Rename ScopedHDC to ScopedCreateDC (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update a comment of ScopedCreateDC Created 9 years, 2 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
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 "chrome/renderer/print_web_view_helper.h" 5 #include "chrome/renderer/print_web_view_helper.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/process_util.h" 10 #include "base/process_util.h"
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 // Therefore, expecting a metafile with page count 1. 251 // Therefore, expecting a metafile with page count 1.
252 DCHECK_EQ(1U, metafile->GetPageCount()); 252 DCHECK_EQ(1U, metafile->GetPageCount());
253 253
254 // Close the device context to retrieve the compiled metafile. 254 // Close the device context to retrieve the compiled metafile.
255 if (!metafile->FinishDocument()) 255 if (!metafile->FinishDocument())
256 NOTREACHED(); 256 NOTREACHED();
257 257
258 // Page used alpha blend, but printer doesn't support it. Rewrite the 258 // Page used alpha blend, but printer doesn't support it. Rewrite the
259 // metafile and flatten out the transparency. 259 // metafile and flatten out the transparency.
260 base::win::ScopedGetDC screen_dc(NULL); 260 base::win::ScopedGetDC screen_dc(NULL);
261 base::win::ScopedHDC bitmap_dc(CreateCompatibleDC(screen_dc)); 261 base::win::ScopedCreateDC bitmap_dc(CreateCompatibleDC(screen_dc));
262 if (!bitmap_dc) 262 if (!bitmap_dc)
263 NOTREACHED() << "Bitmap DC creation failed"; 263 NOTREACHED() << "Bitmap DC creation failed";
264 SetGraphicsMode(bitmap_dc, GM_ADVANCED); 264 SetGraphicsMode(bitmap_dc, GM_ADVANCED);
265 void* bits = NULL; 265 void* bits = NULL;
266 BITMAPINFO hdr; 266 BITMAPINFO hdr;
267 gfx::CreateBitmapHeader(width, height, &hdr.bmiHeader); 267 gfx::CreateBitmapHeader(width, height, &hdr.bmiHeader);
268 base::win::ScopedBitmap hbitmap(CreateDIBSection( 268 base::win::ScopedBitmap hbitmap(CreateDIBSection(
269 bitmap_dc, &hdr, DIB_RGB_COLORS, &bits, NULL, 0)); 269 bitmap_dc, &hdr, DIB_RGB_COLORS, &bits, NULL, 0));
270 if (!hbitmap) 270 if (!hbitmap)
271 NOTREACHED() << "Raster bitmap creation for printing failed"; 271 NOTREACHED() << "Raster bitmap creation for printing failed";
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 shared_buf.Unmap(); 320 shared_buf.Unmap();
321 return false; 321 return false;
322 } 322 }
323 shared_buf.GiveToProcess(base::GetCurrentProcessHandle(), shared_mem_handle); 323 shared_buf.GiveToProcess(base::GetCurrentProcessHandle(), shared_mem_handle);
324 shared_buf.Unmap(); 324 shared_buf.Unmap();
325 325
326 Send(new PrintHostMsg_DuplicateSection(routing_id(), *shared_mem_handle, 326 Send(new PrintHostMsg_DuplicateSection(routing_id(), *shared_mem_handle,
327 shared_mem_handle)); 327 shared_mem_handle));
328 return true; 328 return true;
329 } 329 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698