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

Side by Side Diff: src/pdf/SkPDFDevice.cpp

Issue 2197623002: SkPDF: flip saveLayer rightside up (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | src/pdf/SkPDFFormXObject.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkPDFDevice.h" 8 #include "SkPDFDevice.h"
9 #include "SkAnnotationKeys.h" 9 #include "SkAnnotationKeys.h"
10 #include "SkBitmapDevice.h" 10 #include "SkBitmapDevice.h"
(...skipping 1570 matching lines...) Expand 10 before | Expand all | Expand 10 after
1581 SkPoint p = fInitialTransform.mapXY(dest.point.x(), dest.point.y()); 1581 SkPoint p = fInitialTransform.mapXY(dest.point.x(), dest.point.y());
1582 pdfDest->appendScalar(p.x()); 1582 pdfDest->appendScalar(p.x());
1583 pdfDest->appendScalar(p.y()); 1583 pdfDest->appendScalar(p.y());
1584 pdfDest->appendInt(0); // Leave zoom unchanged 1584 pdfDest->appendInt(0); // Leave zoom unchanged
1585 SkString name(static_cast<const char*>(dest.nameData->data())); 1585 SkString name(static_cast<const char*>(dest.nameData->data()));
1586 dict->insertObject(name, std::move(pdfDest)); 1586 dict->insertObject(name, std::move(pdfDest));
1587 } 1587 }
1588 } 1588 }
1589 1589
1590 sk_sp<SkPDFObject> SkPDFDevice::makeFormXObjectFromDevice() { 1590 sk_sp<SkPDFObject> SkPDFDevice::makeFormXObjectFromDevice() {
1591 SkMatrix inverseTransform = SkMatrix::I();
1592 if (!this->initialTransform().isIdentity()) {
1593 if (!this->initialTransform().invert(&inverseTransform)) {
1594 SkDEBUGFAIL("Layer initial transform should be invertible.");
1595 inverseTransform.reset();
1596 }
1597 }
1591 sk_sp<SkPDFObject> xobject = 1598 sk_sp<SkPDFObject> xobject =
1592 SkPDFMakeFormXObject(this->content(), this->copyMediaBox(), 1599 SkPDFMakeFormXObject(this->content(), this->copyMediaBox(),
1593 this->makeResourceDict(), nullptr); 1600 this->makeResourceDict(), inverseTransform, nullptr );
1594 // We always draw the form xobjects that we create back into the device, so 1601 // We always draw the form xobjects that we create back into the device, so
1595 // we simply preserve the font usage instead of pulling it out and merging 1602 // we simply preserve the font usage instead of pulling it out and merging
1596 // it back in later. 1603 // it back in later.
1597 this->cleanUp(); // Reset this device to have no content. 1604 this->cleanUp(); // Reset this device to have no content.
1598 this->init(); 1605 this->init();
1599 return xobject; 1606 return xobject;
1600 } 1607 }
1601 1608
1602 void SkPDFDevice::drawFormXObjectWithMask(int xObjectIndex, 1609 void SkPDFDevice::drawFormXObjectWithMask(int xObjectIndex,
1603 SkPDFObject* mask, 1610 SkPDFObject* mask,
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after
2221 } 2228 }
2222 2229
2223 sk_sp<SkSpecialImage> SkPDFDevice::makeSpecial(const SkImage* image) { 2230 sk_sp<SkSpecialImage> SkPDFDevice::makeSpecial(const SkImage* image) {
2224 return SkSpecialImage::MakeFromImage(SkIRect::MakeWH(image->width(), image-> height()), 2231 return SkSpecialImage::MakeFromImage(SkIRect::MakeWH(image->width(), image-> height()),
2225 image->makeNonTextureImage()); 2232 image->makeNonTextureImage());
2226 } 2233 }
2227 2234
2228 sk_sp<SkSpecialImage> SkPDFDevice::snapSpecial() { 2235 sk_sp<SkSpecialImage> SkPDFDevice::snapSpecial() {
2229 return nullptr; 2236 return nullptr;
2230 } 2237 }
OLDNEW
« no previous file with comments | « no previous file | src/pdf/SkPDFFormXObject.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698