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

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

Issue 1788263002: SkPDF: remove all globally references SkPDFObjects (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add explanatory comments 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
« no previous file with comments | « src/pdf/SkPDFCanon.cpp ('k') | src/pdf/SkPDFGraphicState.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 9
10 #include "SkAnnotationKeys.h" 10 #include "SkAnnotationKeys.h"
(...skipping 1724 matching lines...) Expand 10 before | Expand all | Expand 10 after
1735 void SkPDFDevice::drawFormXObjectWithMask(int xObjectIndex, 1735 void SkPDFDevice::drawFormXObjectWithMask(int xObjectIndex,
1736 SkPDFFormXObject* mask, 1736 SkPDFFormXObject* mask,
1737 const SkClipStack* clipStack, 1737 const SkClipStack* clipStack,
1738 const SkRegion& clipRegion, 1738 const SkRegion& clipRegion,
1739 SkXfermode::Mode mode, 1739 SkXfermode::Mode mode,
1740 bool invertClip) { 1740 bool invertClip) {
1741 if (clipRegion.isEmpty() && !invertClip) { 1741 if (clipRegion.isEmpty() && !invertClip) {
1742 return; 1742 return;
1743 } 1743 }
1744 1744
1745 sk_sp<SkPDFObject> sMaskGS(SkPDFGraphicState::GetSMaskGraphicState( 1745 auto sMaskGS = SkPDFGraphicState::GetSMaskGraphicState(
1746 mask, invertClip, SkPDFGraphicState::kAlpha_SMaskMode)); 1746 mask, invertClip, SkPDFGraphicState::kAlpha_SMaskMode, fCanon);
1747 1747
1748 SkMatrix identity; 1748 SkMatrix identity;
1749 identity.reset(); 1749 identity.reset();
1750 SkPaint paint; 1750 SkPaint paint;
1751 paint.setXfermodeMode(mode); 1751 paint.setXfermodeMode(mode);
1752 ScopedContentEntry content(this, clipStack, clipRegion, identity, paint); 1752 ScopedContentEntry content(this, clipStack, clipRegion, identity, paint);
1753 if (!content.entry()) { 1753 if (!content.entry()) {
1754 return; 1754 return;
1755 } 1755 }
1756 SkPDFUtils::ApplyGraphicState(addGraphicStateResource(sMaskGS.get()), 1756 SkPDFUtils::ApplyGraphicState(addGraphicStateResource(sMaskGS.get()),
1757 &content.entry()->fContent); 1757 &content.entry()->fContent);
1758 SkPDFUtils::DrawFormXObject(xObjectIndex, &content.entry()->fContent); 1758 SkPDFUtils::DrawFormXObject(xObjectIndex, &content.entry()->fContent);
1759 1759
1760 sMaskGS.reset(SkPDFGraphicState::GetNoSMaskGraphicState()); 1760 // Call makeNoSmaskGraphicState() instead of
1761 // SkPDFGraphicState::MakeNoSmaskGraphicState so that the canon
1762 // can deduplicate.
1763 sMaskGS = fCanon->makeNoSmaskGraphicState();
1761 SkPDFUtils::ApplyGraphicState(addGraphicStateResource(sMaskGS.get()), 1764 SkPDFUtils::ApplyGraphicState(addGraphicStateResource(sMaskGS.get()),
1762 &content.entry()->fContent); 1765 &content.entry()->fContent);
1763 } 1766 }
1764 1767
1765 ContentEntry* SkPDFDevice::setUpContentEntry(const SkClipStack* clipStack, 1768 ContentEntry* SkPDFDevice::setUpContentEntry(const SkClipStack* clipStack,
1766 const SkRegion& clipRegion, 1769 const SkRegion& clipRegion,
1767 const SkMatrix& matrix, 1770 const SkMatrix& matrix,
1768 const SkPaint& paint, 1771 const SkPaint& paint,
1769 bool hasText, 1772 bool hasText,
1770 SkPDFFormXObject** dst) { 1773 SkPDFFormXObject** dst) {
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after
2326 pdfimage.reset(SkPDFCreateBitmapObject( 2329 pdfimage.reset(SkPDFCreateBitmapObject(
2327 image, fCanon->getPixelSerializer())); 2330 image, fCanon->getPixelSerializer()));
2328 if (!pdfimage) { 2331 if (!pdfimage) {
2329 return; 2332 return;
2330 } 2333 }
2331 fCanon->addPDFBitmap(image->uniqueID(), pdfimage.get()); 2334 fCanon->addPDFBitmap(image->uniqueID(), pdfimage.get());
2332 } 2335 }
2333 SkPDFUtils::DrawFormXObject(this->addXObjectResource(pdfimage.get()), 2336 SkPDFUtils::DrawFormXObject(this->addXObjectResource(pdfimage.get()),
2334 &content.entry()->fContent); 2337 &content.entry()->fContent);
2335 } 2338 }
OLDNEW
« no previous file with comments | « src/pdf/SkPDFCanon.cpp ('k') | src/pdf/SkPDFGraphicState.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698