summaryrefslogtreecommitdiffstats
path: root/printing
diff options
context:
space:
mode:
authorvandebo@chromium.org <vandebo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-12 17:36:39 +0000
committervandebo@chromium.org <vandebo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-12 17:36:39 +0000
commita34f012a19f0915ba5ebc9ba8049763651839515 (patch)
tree00a4e4b273478b9655bbea4c5bcf7253262eab62 /printing
parent3035828750f79776b5aa13019663316ecfb8f582 (diff)
downloadchromium_src-a34f012a19f0915ba5ebc9ba8049763651839515.zip
chromium_src-a34f012a19f0915ba5ebc9ba8049763651839515.tar.gz
chromium_src-a34f012a19f0915ba5ebc9ba8049763651839515.tar.bz2
Push the initial transform down into SkPDFDevice. (Chrome side).
This change also rolls skis to r1111 to get the Skia side of the change. BUG=NONE TEST=NONE Review URL: http://codereview.chromium.org/6820038 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@81267 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'printing')
-rw-r--r--printing/pdf_metafile_skia.cc12
1 files changed, 9 insertions, 3 deletions
diff --git a/printing/pdf_metafile_skia.cc b/printing/pdf_metafile_skia.cc
index 72d8908..1d2b0798 100644
--- a/printing/pdf_metafile_skia.cc
+++ b/printing/pdf_metafile_skia.cc
@@ -9,6 +9,7 @@
#include "base/file_util.h"
#include "skia/ext/vector_platform_device_skia.h"
#include "third_party/skia/include/core/SkRefCnt.h"
+#include "third_party/skia/include/core/SkScalar.h"
#include "third_party/skia/include/core/SkStream.h"
#include "third_party/skia/include/pdf/SkPDFDevice.h"
#include "third_party/skia/include/pdf/SkPDFDocument.h"
@@ -40,11 +41,16 @@ skia::PlatformDevice* PdfMetafileSkia::StartPageForVectorCanvas(
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.preScale(SkFloatToScalar(scale_factor),
+ SkFloatToScalar(scale_factor));
+
skia::VectorPlatformDeviceSkia* device =
new skia::VectorPlatformDeviceSkia(page_size.width(), page_size.height(),
- SkPDFDevice::kFlip_OriginTransform);
- device->setInitialTransform(content_origin.x(), content_origin.y(),
- scale_factor);
+ transform);
data_->current_page_ = device->PdfDevice();
return device;
}