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

Unified Diff: src/pdf/SkPDFDevice.cpp

Issue 24615006: rebaseline drawbitmap gms (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: remove expectation included by mistake in another cl Created 7 years, 3 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: src/pdf/SkPDFDevice.cpp
diff --git a/src/pdf/SkPDFDevice.cpp b/src/pdf/SkPDFDevice.cpp
index d13d30cbfb46efbbbe29f6bc3f22522190af75de..b279e59d0c2acc8d1dfff2c09edd6c6a86fe018c 100644
--- a/src/pdf/SkPDFDevice.cpp
+++ b/src/pdf/SkPDFDevice.cpp
@@ -707,6 +707,32 @@ SkPDFDevice::SkPDFDevice(const SkISize& pageSize, const SkISize& contentSize,
this->init();
}
+SkISize SkSizeToISize(const SkSize& size) {
+ return SkISize::Make(SkScalarRoundToInt(size.width()), SkScalarRoundToInt(size.height()));
+}
+
+SkPDFDevice::SkPDFDevice(const SkSize& trimBox, const SkRect& content)
+ : SkBitmapDevice(makeContentBitmap(SkSizeToISize(SkSize::Make(content.width(), content.height())), NULL)),
+ fPageSize(SkSizeToISize(trimBox)),
+ fContentSize(SkSizeToISize(SkSize::Make(content.width(), content.height()))),
+ fLastContentEntry(NULL),
+ fLastMarginContentEntry(NULL),
+ fClipStack(NULL),
+ fEncoder(NULL) {
+ // Skia generally uses the top left as the origin but PDF natively has the
+ // origin at the bottom left. This matrix corrects for that. But that only
+ // needs to be done once, we don't do it when layering.
+ fInitialTransform.reset();
+ fInitialTransform.setTranslate(0, SkIntToScalar(trimBox.height()));
+ fInitialTransform.preScale(SK_Scalar1, -SK_Scalar1);
+
+ SkIRect existingClip = SkIRect::MakeWH(this->width(), this->height());
+ fExistingClipRegion.setRect(existingClip);
+
+ this->init();
+}
+
+
// TODO(vandebo) change layerSize to SkSize.
SkPDFDevice::SkPDFDevice(const SkISize& layerSize,
const SkClipStack& existingClipStack,

Powered by Google App Engine
This is Rietveld 408576698