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

Unified Diff: printing/pdf_metafile_skia.cc

Issue 6879098: Fix print preview clipping issues due to scaling. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Proposed modification to metafile interface. Created 9 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: printing/pdf_metafile_skia.cc
===================================================================
--- printing/pdf_metafile_skia.cc (revision 82287)
+++ printing/pdf_metafile_skia.cc (working copy)
@@ -37,8 +37,8 @@
}
skia::PlatformDevice* PdfMetafileSkia::StartPageForVectorCanvas(
- const gfx::Size& page_size, const gfx::Point& content_origin,
- const float& scale_factor) {
+ const gfx::Size& page_size, const gfx::Size& content_size,
+ const gfx::Point& content_origin, const float& scale_factor) {
DCHECK(data_->current_page_.get() == NULL);
// Adjust for the margins and apply the scale factor.
@@ -48,9 +48,16 @@
transform.preScale(SkFloatToScalar(scale_factor),
SkFloatToScalar(scale_factor));
+ SkRefPtr<SkPDFDevice> pdf_device =
+ new SkPDFDevice(SkSize::Make(
+ SkIntToScalar(page_size.width()),
+ SkIntToScalar(page_size.height())),
+ SkSize::Make(
+ SkIntToScalar(content_size.width()),
+ SkIntToScalar(content_size.height())), transform);
+ pdf_device->unref(); // SkRefPtr and new both took a reference.
skia::VectorPlatformDeviceSkia* device =
- new skia::VectorPlatformDeviceSkia(page_size.width(), page_size.height(),
- transform);
+ new skia::VectorPlatformDeviceSkia(pdf_device.get(), transform);
data_->current_page_ = device->PdfDevice();
return device;
}

Powered by Google App Engine
This is Rietveld 408576698