OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "SkCanvas.h" | 8 #include "SkCanvas.h" |
9 #include "SkDevice.h" | 9 #include "SkDevice.h" |
10 #include "SkForceLinking.h" | 10 #include "SkForceLinking.h" |
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
651 SkMatrix flip; | 651 SkMatrix flip; |
652 SkAssertResult(flip.setPolyToPoly(from, to, 4)); | 652 SkAssertResult(flip.setPolyToPoly(from, to, 4)); |
653 SkMatrix solveImageFlip = pdfContext->fGraphicsState.fCTM; | 653 SkMatrix solveImageFlip = pdfContext->fGraphicsState.fCTM; |
654 solveImageFlip.preConcat(flip); | 654 solveImageFlip.preConcat(flip); |
655 canvas->setMatrix(solveImageFlip); | 655 canvas->setMatrix(solveImageFlip); |
656 #endif | 656 #endif |
657 | 657 |
658 SkRect dst = SkRect::MakeXYWH(SkDoubleToScalar(0.0), SkDoubleToScalar(0.0),
SkDoubleToScalar(1.0), SkDoubleToScalar(1.0)); | 658 SkRect dst = SkRect::MakeXYWH(SkDoubleToScalar(0.0), SkDoubleToScalar(0.0),
SkDoubleToScalar(1.0), SkDoubleToScalar(1.0)); |
659 | 659 |
660 // TODO(edisonn): soft mask type? alpha/luminosity. | 660 // TODO(edisonn): soft mask type? alpha/luminosity. |
| 661 SkPaint paint; |
| 662 pdfContext->fGraphicsState.applyGraphicsState(&paint, false); |
| 663 |
661 if (!sMask || sMask->empty()) { | 664 if (!sMask || sMask->empty()) { |
662 canvas->drawBitmapRect(*image, dst, NULL); | 665 canvas->drawBitmapRect(*image, dst, &paint); |
663 } else { | 666 } else { |
664 canvas->saveLayer(&dst, NULL); | 667 canvas->saveLayer(&dst, &paint); |
665 canvas->drawBitmapRect(*image, dst, NULL); | 668 canvas->drawBitmapRect(*image, dst, NULL); |
666 SkPaint xfer; | 669 SkPaint xfer; |
667 pdfContext->fGraphicsState.applyGraphicsState(&xfer, false); | |
668 // TODO(edisonn): is the blend mode specified already implicitly/explici
tly in pdf? | 670 // TODO(edisonn): is the blend mode specified already implicitly/explici
tly in pdf? |
669 xfer.setXfermodeMode(SkXfermode::kSrcOut_Mode); // SkXfermode::kSdtOut_M
ode | 671 xfer.setXfermodeMode(SkXfermode::kSrcOut_Mode); // SkXfermode::kSdtOut_M
ode |
670 canvas->drawBitmapRect(*sMask, dst, &xfer); | 672 canvas->drawBitmapRect(*sMask, dst, &xfer); |
671 canvas->restore(); | 673 canvas->restore(); |
672 } | 674 } |
673 | 675 |
674 canvas->restore(); | 676 canvas->restore(); |
675 | 677 |
676 return kPartial_PdfResult; | 678 return kPartial_PdfResult; |
677 } | 679 } |
(...skipping 1941 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2619 | 2621 |
2620 rect = SkRect::MakeWH(width, height); | 2622 rect = SkRect::MakeWH(width, height); |
2621 | 2623 |
2622 setup_bitmap(output, (int)SkScalarToDouble(width), (int)SkScalarToDouble(hei
ght)); | 2624 setup_bitmap(output, (int)SkScalarToDouble(width), (int)SkScalarToDouble(hei
ght)); |
2623 | 2625 |
2624 SkAutoTUnref<SkDevice> device(SkNEW_ARGS(SkDevice, (*output))); | 2626 SkAutoTUnref<SkDevice> device(SkNEW_ARGS(SkDevice, (*output))); |
2625 SkCanvas canvas(device); | 2627 SkCanvas canvas(device); |
2626 | 2628 |
2627 return renderer.renderPage(page, &canvas, rect); | 2629 return renderer.renderPage(page, &canvas, rect); |
2628 } | 2630 } |
OLD | NEW |