Index: printing/pdf_metafile_skia.cc |
=================================================================== |
--- printing/pdf_metafile_skia.cc (revision 83060) |
+++ printing/pdf_metafile_skia.cc (working copy) |
@@ -37,26 +37,32 @@ |
} |
skia::PlatformDevice* PdfMetafileSkia::StartPageForVectorCanvas( |
- const gfx::Size& page_size, const gfx::Point& content_origin, |
+ const gfx::Size& page_size, const gfx::Rect& content_area, |
const float& scale_factor) { |
DCHECK(data_->current_page_.get() == NULL); |
// Adjust for the margins and apply the scale factor. |
SkMatrix transform; |
- transform.setTranslate(SkIntToScalar(content_origin.x()), |
- SkIntToScalar(content_origin.y())); |
+ transform.setTranslate(SkIntToScalar(content_area.x()), |
+ SkIntToScalar(content_area.y())); |
transform.preScale(SkFloatToScalar(scale_factor), |
SkFloatToScalar(scale_factor)); |
+ // TODO(ctguil): Refactor: don't create the PDF device explicitly here. |
+ SkRefPtr<SkPDFDevice> pdf_device = |
vandebo (ex-Chrome)
2011/04/27 22:11:34
This could be quiet a bit cleaner with a few varia
Chris Guillory
2011/04/29 18:25:44
Done.
|
+ new SkPDFDevice(SkISize::Make(page_size.width(), page_size.height()), |
+ SkISize::Make(content_area.width(), |
+ content_area.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()); |
data_->current_page_ = device->PdfDevice(); |
return device; |
} |
bool PdfMetafileSkia::StartPage(const gfx::Size& page_size, |
- const gfx::Point& content_origin, |
+ const gfx::Rect& content_area, |
const float& scale_factor) { |
NOTREACHED(); |
return NULL; |