OLD | NEW |
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 1397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1408 SkMatrix identity; | 1408 SkMatrix identity; |
1409 identity.reset(); | 1409 identity.reset(); |
1410 SkDraw draw; | 1410 SkDraw draw; |
1411 draw.fMatrix = &identity; | 1411 draw.fMatrix = &identity; |
1412 draw.fClip = &clipRegion; | 1412 draw.fClip = &clipRegion; |
1413 draw.fClipStack = clipStack; | 1413 draw.fClipStack = clipStack; |
1414 SkPaint stockPaint; | 1414 SkPaint stockPaint; |
1415 this->drawPaint(draw, stockPaint); | 1415 this->drawPaint(draw, stockPaint); |
1416 SkAutoTUnref<SkPDFFormXObject> maskFormXObject(createFormXObjectFromDevice()
); | 1416 SkAutoTUnref<SkPDFFormXObject> maskFormXObject(createFormXObjectFromDevice()
); |
1417 SkAutoTUnref<SkPDFGraphicState> sMaskGS( | 1417 SkAutoTUnref<SkPDFGraphicState> sMaskGS( |
1418 SkPDFGraphicState::GetSMaskGraphicState(maskFormXObject, invertClip)); | 1418 SkPDFGraphicState::GetSMaskGraphicState(maskFormXObject, invertClip, |
| 1419 SkPDFGraphicState::kAlpha_SMaskM
ode)); |
1419 | 1420 |
1420 // Draw the xobject with the clip as a mask. | 1421 // Draw the xobject with the clip as a mask. |
1421 ScopedContentEntry content(this, &fExistingClipStack, fExistingClipRegion, | 1422 ScopedContentEntry content(this, &fExistingClipStack, fExistingClipRegion, |
1422 identity, stockPaint); | 1423 identity, stockPaint); |
1423 if (!content.entry()) { | 1424 if (!content.entry()) { |
1424 return; | 1425 return; |
1425 } | 1426 } |
1426 SkPDFUtils::ApplyGraphicState(addGraphicStateResource(sMaskGS.get()), | 1427 SkPDFUtils::ApplyGraphicState(addGraphicStateResource(sMaskGS.get()), |
1427 &content.entry()->fContent); | 1428 &content.entry()->fContent); |
1428 SkPDFUtils::DrawFormXObject(fXObjectResources.count(), | 1429 SkPDFUtils::DrawFormXObject(fXObjectResources.count(), |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1564 fExistingClipRegion, identity, | 1565 fExistingClipRegion, identity, |
1565 stockPaint); | 1566 stockPaint); |
1566 if (!inClipContentEntry.entry()) { | 1567 if (!inClipContentEntry.entry()) { |
1567 return; | 1568 return; |
1568 } | 1569 } |
1569 | 1570 |
1570 SkAutoTUnref<SkPDFGraphicState> sMaskGS; | 1571 SkAutoTUnref<SkPDFGraphicState> sMaskGS; |
1571 if (xfermode == SkXfermode::kSrcIn_Mode || | 1572 if (xfermode == SkXfermode::kSrcIn_Mode || |
1572 xfermode == SkXfermode::kSrcOut_Mode) { | 1573 xfermode == SkXfermode::kSrcOut_Mode) { |
1573 sMaskGS.reset(SkPDFGraphicState::GetSMaskGraphicState( | 1574 sMaskGS.reset(SkPDFGraphicState::GetSMaskGraphicState( |
1574 dst, xfermode == SkXfermode::kSrcOut_Mode)); | 1575 dst, |
| 1576 xfermode == SkXfermode::kSrcOut_Mode, |
| 1577 SkPDFGraphicState::kAlpha_SMaskMode)); |
1575 fXObjectResources.push(srcFormXObject.get()); | 1578 fXObjectResources.push(srcFormXObject.get()); |
1576 srcFormXObject.get()->ref(); | 1579 srcFormXObject.get()->ref(); |
1577 } else { | 1580 } else { |
1578 sMaskGS.reset(SkPDFGraphicState::GetSMaskGraphicState( | 1581 sMaskGS.reset(SkPDFGraphicState::GetSMaskGraphicState( |
1579 srcFormXObject.get(), xfermode == SkXfermode::kDstOut_Mode)); | 1582 srcFormXObject.get(), |
| 1583 xfermode == SkXfermode::kDstOut_Mode, |
| 1584 SkPDFGraphicState::kAlpha_SMaskMode)); |
1580 // dst already added to fXObjectResources in drawFormXObjectWithClip. | 1585 // dst already added to fXObjectResources in drawFormXObjectWithClip. |
1581 } | 1586 } |
1582 SkPDFUtils::ApplyGraphicState(addGraphicStateResource(sMaskGS.get()), | 1587 SkPDFUtils::ApplyGraphicState(addGraphicStateResource(sMaskGS.get()), |
1583 &inClipContentEntry.entry()->fContent); | 1588 &inClipContentEntry.entry()->fContent); |
1584 | 1589 |
1585 SkPDFUtils::DrawFormXObject(fXObjectResources.count() - 1, | 1590 SkPDFUtils::DrawFormXObject(fXObjectResources.count() - 1, |
1586 &inClipContentEntry.entry()->fContent); | 1591 &inClipContentEntry.entry()->fContent); |
1587 | 1592 |
1588 sMaskGS.reset(SkPDFGraphicState::GetNoSMaskGraphicState()); | 1593 sMaskGS.reset(SkPDFGraphicState::GetNoSMaskGraphicState()); |
1589 SkPDFUtils::ApplyGraphicState(addGraphicStateResource(sMaskGS.get()), | 1594 SkPDFUtils::ApplyGraphicState(addGraphicStateResource(sMaskGS.get()), |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1761 } | 1766 } |
1762 | 1767 |
1763 bool SkPDFDevice::onReadPixels(const SkBitmap& bitmap, int x, int y, | 1768 bool SkPDFDevice::onReadPixels(const SkBitmap& bitmap, int x, int y, |
1764 SkCanvas::Config8888) { | 1769 SkCanvas::Config8888) { |
1765 return false; | 1770 return false; |
1766 } | 1771 } |
1767 | 1772 |
1768 bool SkPDFDevice::allowImageFilter(SkImageFilter*) { | 1773 bool SkPDFDevice::allowImageFilter(SkImageFilter*) { |
1769 return false; | 1774 return false; |
1770 } | 1775 } |
OLD | NEW |