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