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

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

Issue 18585002: Implemented transparent gradients (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | src/pdf/SkPDFFormXObject.h » ('j') | src/pdf/SkPDFFormXObject.h » ('J')
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 "SkAnnotation.h" 10 #include "SkAnnotation.h"
(...skipping 1473 matching lines...) Expand 10 before | Expand all | Expand 10 after
1484 SkMatrix identity; 1484 SkMatrix identity;
1485 identity.reset(); 1485 identity.reset();
1486 SkDraw draw; 1486 SkDraw draw;
1487 draw.fMatrix = &identity; 1487 draw.fMatrix = &identity;
1488 draw.fClip = &clipRegion; 1488 draw.fClip = &clipRegion;
1489 draw.fClipStack = clipStack; 1489 draw.fClipStack = clipStack;
1490 SkPaint stockPaint; 1490 SkPaint stockPaint;
1491 this->drawPaint(draw, stockPaint); 1491 this->drawPaint(draw, stockPaint);
1492 SkAutoTUnref<SkPDFFormXObject> maskFormXObject(createFormXObjectFromDevice() ); 1492 SkAutoTUnref<SkPDFFormXObject> maskFormXObject(createFormXObjectFromDevice() );
1493 SkAutoTUnref<SkPDFGraphicState> sMaskGS( 1493 SkAutoTUnref<SkPDFGraphicState> sMaskGS(
1494 SkPDFGraphicState::GetSMaskGraphicState(maskFormXObject, invertClip)); 1494 SkPDFGraphicState::GetSMaskGraphicState(maskFormXObject, invertClip, fal se));
1495 1495
1496 // Draw the xobject with the clip as a mask. 1496 // Draw the xobject with the clip as a mask.
1497 ScopedContentEntry content(this, &fExistingClipStack, fExistingClipRegion, 1497 ScopedContentEntry content(this, &fExistingClipStack, fExistingClipRegion,
1498 identity, stockPaint); 1498 identity, stockPaint);
1499 if (!content.entry()) { 1499 if (!content.entry()) {
1500 return; 1500 return;
1501 } 1501 }
1502 SkPDFUtils::ApplyGraphicState(addGraphicStateResource(sMaskGS.get()), 1502 SkPDFUtils::ApplyGraphicState(addGraphicStateResource(sMaskGS.get()),
1503 &content.entry()->fContent); 1503 &content.entry()->fContent);
1504 SkPDFUtils::DrawFormXObject(fXObjectResources.count(), 1504 SkPDFUtils::DrawFormXObject(fXObjectResources.count(),
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
1640 fExistingClipRegion, identity, 1640 fExistingClipRegion, identity,
1641 stockPaint); 1641 stockPaint);
1642 if (!inClipContentEntry.entry()) { 1642 if (!inClipContentEntry.entry()) {
1643 return; 1643 return;
1644 } 1644 }
1645 1645
1646 SkAutoTUnref<SkPDFGraphicState> sMaskGS; 1646 SkAutoTUnref<SkPDFGraphicState> sMaskGS;
1647 if (xfermode == SkXfermode::kSrcIn_Mode || 1647 if (xfermode == SkXfermode::kSrcIn_Mode ||
1648 xfermode == SkXfermode::kSrcOut_Mode) { 1648 xfermode == SkXfermode::kSrcOut_Mode) {
1649 sMaskGS.reset(SkPDFGraphicState::GetSMaskGraphicState( 1649 sMaskGS.reset(SkPDFGraphicState::GetSMaskGraphicState(
1650 dst, xfermode == SkXfermode::kSrcOut_Mode)); 1650 dst,
1651 xfermode == SkXfermode::kSrcOut_Mode, true));
1651 fXObjectResources.push(srcFormXObject.get()); 1652 fXObjectResources.push(srcFormXObject.get());
1652 srcFormXObject.get()->ref(); 1653 srcFormXObject.get()->ref();
1653 } else { 1654 } else {
1654 sMaskGS.reset(SkPDFGraphicState::GetSMaskGraphicState( 1655 sMaskGS.reset(SkPDFGraphicState::GetSMaskGraphicState(
1655 srcFormXObject.get(), xfermode == SkXfermode::kDstOut_Mode)); 1656 srcFormXObject.get(),
1657 xfermode == SkXfermode::kDstOut_Mode, true));
1656 // dst already added to fXObjectResources in drawFormXObjectWithClip. 1658 // dst already added to fXObjectResources in drawFormXObjectWithClip.
1657 } 1659 }
1658 SkPDFUtils::ApplyGraphicState(addGraphicStateResource(sMaskGS.get()), 1660 SkPDFUtils::ApplyGraphicState(addGraphicStateResource(sMaskGS.get()),
1659 &inClipContentEntry.entry()->fContent); 1661 &inClipContentEntry.entry()->fContent);
1660 1662
1661 SkPDFUtils::DrawFormXObject(fXObjectResources.count() - 1, 1663 SkPDFUtils::DrawFormXObject(fXObjectResources.count() - 1,
1662 &inClipContentEntry.entry()->fContent); 1664 &inClipContentEntry.entry()->fContent);
1663 1665
1664 sMaskGS.reset(SkPDFGraphicState::GetNoSMaskGraphicState()); 1666 sMaskGS.reset(SkPDFGraphicState::GetNoSMaskGraphicState());
1665 SkPDFUtils::ApplyGraphicState(addGraphicStateResource(sMaskGS.get()), 1667 SkPDFUtils::ApplyGraphicState(addGraphicStateResource(sMaskGS.get()),
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
1837 } 1839 }
1838 1840
1839 bool SkPDFDevice::onReadPixels(const SkBitmap& bitmap, int x, int y, 1841 bool SkPDFDevice::onReadPixels(const SkBitmap& bitmap, int x, int y,
1840 SkCanvas::Config8888) { 1842 SkCanvas::Config8888) {
1841 return false; 1843 return false;
1842 } 1844 }
1843 1845
1844 bool SkPDFDevice::allowImageFilter(SkImageFilter*) { 1846 bool SkPDFDevice::allowImageFilter(SkImageFilter*) {
1845 return false; 1847 return false;
1846 } 1848 }
OLDNEW
« no previous file with comments | « no previous file | src/pdf/SkPDFFormXObject.h » ('j') | src/pdf/SkPDFFormXObject.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698