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

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: Fix mac build. 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
« no previous file with comments | « printing/pdf_metafile_skia.h ('k') | skia/ext/vector_platform_device_skia.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: printing/pdf_metafile_skia.cc
===================================================================
--- printing/pdf_metafile_skia.cc (revision 83537)
+++ 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.
+ SkISize pdf_page_size = SkISize::Make(page_size.width(), page_size.height());
+ SkISize pdf_content_size =
+ SkISize::Make(content_area.width(), content_area.height());
+ SkRefPtr<SkPDFDevice> pdf_device =
+ new SkPDFDevice(pdf_page_size, pdf_content_size, 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;
« no previous file with comments | « printing/pdf_metafile_skia.h ('k') | skia/ext/vector_platform_device_skia.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698