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

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

Issue 7465104: Remove dependency on VectorPlatformDeviceEmf. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 4 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 | « no previous file | skia/ext/platform_device_win.h » ('j') | skia/ext/platform_device_win.h » ('J')
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 "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"
11 #include "chrome/common/print_messages.h" 11 #include "chrome/common/print_messages.h"
12 #include "printing/metafile.h" 12 #include "printing/metafile.h"
13 #include "printing/metafile_impl.h" 13 #include "printing/metafile_impl.h"
14 #include "printing/metafile_skia_wrapper.h" 14 #include "printing/metafile_skia_wrapper.h"
15 #include "printing/units.h" 15 #include "printing/units.h"
16 #include "skia/ext/vector_canvas.h" 16 #include "skia/ext/vector_canvas.h"
17 #include "skia/ext/vector_platform_device_emf_win.h" 17 #include "skia/ext/platform_device.h"
18 #include "third_party/skia/include/core/SkRefCnt.h" 18 #include "third_party/skia/include/core/SkRefCnt.h"
19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" 19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
20 #include "ui/gfx/gdi_util.h" 20 #include "ui/gfx/gdi_util.h"
21 #include "ui/gfx/point.h" 21 #include "ui/gfx/point.h"
22 #include "ui/gfx/rect.h" 22 #include "ui/gfx/rect.h"
23 #include "ui/gfx/size.h" 23 #include "ui/gfx/size.h"
24 24
25 using printing::ConvertUnit; 25 using printing::ConvertUnit;
26 using printing::ConvertUnitDouble; 26 using printing::ConvertUnitDouble;
27 using printing::kPointsPerInch; 27 using printing::kPointsPerInch;
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 *scale_factor /= webkit_scale_factor; 199 *scale_factor /= webkit_scale_factor;
200 } 200 }
201 201
202 bool result = (*metafile)->FinishPage(); 202 bool result = (*metafile)->FinishPage();
203 DCHECK(result); 203 DCHECK(result);
204 204
205 if (!params.supports_alpha_blend) { 205 if (!params.supports_alpha_blend) {
206 // PreviewMetafile (PDF) supports alpha blend, so we only hit this case 206 // PreviewMetafile (PDF) supports alpha blend, so we only hit this case
207 // for NativeMetafile. 207 // for NativeMetafile.
208 DCHECK(!is_preview); 208 DCHECK(!is_preview);
209 skia::VectorPlatformDeviceEmf* platform_device = 209 skia::PlatformDevice* platform_device =skia::GetPlatformDevice(device);
alokp 2011/08/04 16:06:54 nit: space after =
Jeff Timanus 2011/08/04 16:30:33 Done.
210 static_cast<skia::VectorPlatformDeviceEmf*>(device); 210 if (platform_device && platform_device->AlphaBlendUsed()) {
211 if (platform_device->alpha_blend_used()) {
212 // Currently, we handle alpha blend transparency for a single page. 211 // Currently, we handle alpha blend transparency for a single page.
213 // Therefore, expecting a metafile with page count 1. 212 // Therefore, expecting a metafile with page count 1.
214 DCHECK_EQ(1U, (*metafile)->GetPageCount()); 213 DCHECK_EQ(1U, (*metafile)->GetPageCount());
215 214
216 // Close the device context to retrieve the compiled metafile. 215 // Close the device context to retrieve the compiled metafile.
217 if (!(*metafile)->FinishDocument()) 216 if (!(*metafile)->FinishDocument())
218 NOTREACHED(); 217 NOTREACHED();
219 218
220 // Page used alpha blend, but printer doesn't support it. Rewrite the 219 // Page used alpha blend, but printer doesn't support it. Rewrite the
221 // metafile and flatten out the transparency. 220 // metafile and flatten out the transparency.
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 shared_buf.Unmap(); 281 shared_buf.Unmap();
283 return false; 282 return false;
284 } 283 }
285 shared_buf.GiveToProcess(base::GetCurrentProcessHandle(), shared_mem_handle); 284 shared_buf.GiveToProcess(base::GetCurrentProcessHandle(), shared_mem_handle);
286 shared_buf.Unmap(); 285 shared_buf.Unmap();
287 286
288 Send(new PrintHostMsg_DuplicateSection(routing_id(), *shared_mem_handle, 287 Send(new PrintHostMsg_DuplicateSection(routing_id(), *shared_mem_handle,
289 shared_mem_handle)); 288 shared_mem_handle));
290 return true; 289 return true;
291 } 290 }
OLDNEW
« no previous file with comments | « no previous file | skia/ext/platform_device_win.h » ('j') | skia/ext/platform_device_win.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698