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

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

Issue 1774633002: SkPDF Create working move constructor for inner classes (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 9 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
« src/pdf/SkPDFDevice.h ('K') | « src/pdf/SkPDFDevice.h ('k') | no next file » | 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 9
10 #include "SkAnnotationKeys.h" 10 #include "SkAnnotationKeys.h"
(...skipping 1398 matching lines...) Expand 10 before | Expand all | Expand 10 after
1409 1409
1410 void SkPDFDevice::drawDevice(const SkDraw& d, SkBaseDevice* device, 1410 void SkPDFDevice::drawDevice(const SkDraw& d, SkBaseDevice* device,
1411 int x, int y, const SkPaint& paint) { 1411 int x, int y, const SkPaint& paint) {
1412 // our onCreateCompatibleDevice() always creates SkPDFDevice subclasses. 1412 // our onCreateCompatibleDevice() always creates SkPDFDevice subclasses.
1413 SkPDFDevice* pdfDevice = static_cast<SkPDFDevice*>(device); 1413 SkPDFDevice* pdfDevice = static_cast<SkPDFDevice*>(device);
1414 1414
1415 SkScalar scalarX = SkIntToScalar(x); 1415 SkScalar scalarX = SkIntToScalar(x);
1416 SkScalar scalarY = SkIntToScalar(y); 1416 SkScalar scalarY = SkIntToScalar(y);
1417 for (const RectWithData& l : pdfDevice->fLinkToURLs) { 1417 for (const RectWithData& l : pdfDevice->fLinkToURLs) {
1418 SkRect r = l.rect.makeOffset(scalarX, scalarY); 1418 SkRect r = l.rect.makeOffset(scalarX, scalarY);
1419 fLinkToURLs.emplace_back(r, l.data); 1419 fLinkToURLs.emplace_back(r, l.data.get());
1420 } 1420 }
1421 for (const RectWithData& l : pdfDevice->fLinkToDestinations) { 1421 for (const RectWithData& l : pdfDevice->fLinkToDestinations) {
1422 SkRect r = l.rect.makeOffset(scalarX, scalarY); 1422 SkRect r = l.rect.makeOffset(scalarX, scalarY);
1423 fLinkToDestinations.emplace_back(r, l.data); 1423 fLinkToDestinations.emplace_back(r, l.data.get());
1424 } 1424 }
1425 for (const NamedDestination& d : pdfDevice->fNamedDestinations) { 1425 for (const NamedDestination& d : pdfDevice->fNamedDestinations) {
1426 SkPoint p = d.point + SkPoint::Make(scalarX, scalarY); 1426 SkPoint p = d.point + SkPoint::Make(scalarX, scalarY);
1427 fNamedDestinations.emplace_back(d.nameData, p); 1427 fNamedDestinations.emplace_back(d.nameData.get(), p);
1428 } 1428 }
1429 1429
1430 if (pdfDevice->isContentEmpty()) { 1430 if (pdfDevice->isContentEmpty()) {
1431 return; 1431 return;
1432 } 1432 }
1433 1433
1434 SkMatrix matrix; 1434 SkMatrix matrix;
1435 matrix.setTranslate(SkIntToScalar(x), SkIntToScalar(y)); 1435 matrix.setTranslate(SkIntToScalar(x), SkIntToScalar(y));
1436 ScopedContentEntry content(this, d.fClipStack, *d.fClip, matrix, paint); 1436 ScopedContentEntry content(this, d.fClipStack, *d.fClip, matrix, paint);
1437 if (!content.entry()) { 1437 if (!content.entry()) {
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
1692 fLinkToDestinations.emplace_back(transformedRect, value); 1692 fLinkToDestinations.emplace_back(transformedRect, value);
1693 } 1693 }
1694 } 1694 }
1695 } 1695 }
1696 1696
1697 void SkPDFDevice::appendAnnotations(SkPDFArray* array) const { 1697 void SkPDFDevice::appendAnnotations(SkPDFArray* array) const {
1698 array->reserve(fLinkToURLs.count() + fLinkToDestinations.count()); 1698 array->reserve(fLinkToURLs.count() + fLinkToDestinations.count());
1699 for (const RectWithData& rectWithURL : fLinkToURLs) { 1699 for (const RectWithData& rectWithURL : fLinkToURLs) {
1700 SkRect r; 1700 SkRect r;
1701 fInitialTransform.mapRect(&r, rectWithURL.rect); 1701 fInitialTransform.mapRect(&r, rectWithURL.rect);
1702 array->appendObject(create_link_to_url(rectWithURL.data, r)); 1702 array->appendObject(create_link_to_url(rectWithURL.data.get(), r));
1703 } 1703 }
1704 for (const RectWithData& linkToDestination : fLinkToDestinations) { 1704 for (const RectWithData& linkToDestination : fLinkToDestinations) {
1705 SkRect r; 1705 SkRect r;
1706 fInitialTransform.mapRect(&r, linkToDestination.rect); 1706 fInitialTransform.mapRect(&r, linkToDestination.rect);
1707 array->appendObject(create_link_named_dest(linkToDestination.data, r)); 1707 array->appendObject(
1708 create_link_named_dest(linkToDestination.data.get(), r));
1708 } 1709 }
1709 } 1710 }
1710 1711
1711 void SkPDFDevice::appendDestinations(SkPDFDict* dict, SkPDFObject* page) const { 1712 void SkPDFDevice::appendDestinations(SkPDFDict* dict, SkPDFObject* page) const {
1712 for (const NamedDestination& dest : fNamedDestinations) { 1713 for (const NamedDestination& dest : fNamedDestinations) {
1713 SkAutoTUnref<SkPDFArray> pdfDest(new SkPDFArray); 1714 SkAutoTUnref<SkPDFArray> pdfDest(new SkPDFArray);
1714 pdfDest->reserve(5); 1715 pdfDest->reserve(5);
1715 pdfDest->appendObjRef(SkRef(page)); 1716 pdfDest->appendObjRef(SkRef(page));
1716 pdfDest->appendName("XYZ"); 1717 pdfDest->appendName("XYZ");
1717 SkPoint p = fInitialTransform.mapXY(dest.point.x(), dest.point.y()); 1718 SkPoint p = fInitialTransform.mapXY(dest.point.x(), dest.point.y());
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after
2327 pdfimage.reset(SkPDFCreateBitmapObject( 2328 pdfimage.reset(SkPDFCreateBitmapObject(
2328 image, fCanon->getPixelSerializer())); 2329 image, fCanon->getPixelSerializer()));
2329 if (!pdfimage) { 2330 if (!pdfimage) {
2330 return; 2331 return;
2331 } 2332 }
2332 fCanon->addPDFBitmap(image->uniqueID(), pdfimage.get()); 2333 fCanon->addPDFBitmap(image->uniqueID(), pdfimage.get());
2333 } 2334 }
2334 SkPDFUtils::DrawFormXObject(this->addXObjectResource(pdfimage.get()), 2335 SkPDFUtils::DrawFormXObject(this->addXObjectResource(pdfimage.get()),
2335 &content.entry()->fContent); 2336 &content.entry()->fContent);
2336 } 2337 }
OLDNEW
« src/pdf/SkPDFDevice.h ('K') | « src/pdf/SkPDFDevice.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698