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; |
} |