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 "SkGpuDevice.h" | 8 #include "SkGpuDevice.h" |
9 | 9 |
10 #include "effects/GrBicubicEffect.h" | 10 #include "effects/GrBicubicEffect.h" |
11 #include "effects/GrDashingEffect.h" | 11 #include "effects/GrDashingEffect.h" |
12 #include "effects/GrTextureDomain.h" | 12 #include "effects/GrTextureDomain.h" |
13 #include "effects/GrSimpleTextureEffect.h" | 13 #include "effects/GrSimpleTextureEffect.h" |
14 | 14 |
15 #include "GrContext.h" | 15 #include "GrContext.h" |
16 #include "GrBitmapTextContext.h" | 16 #include "GrBitmapTextContext.h" |
17 #include "GrDistanceFieldTextContext.h" | 17 #include "GrDistanceFieldTextContext.h" |
18 #include "GrLayerCache.h" | 18 #include "GrLayerCache.h" |
19 #include "GrPictureUtils.h" | 19 #include "GrPictureUtils.h" |
20 #include "GrStrokeInfo.h" | |
20 | 21 |
21 #include "SkGrTexturePixelRef.h" | 22 #include "SkGrTexturePixelRef.h" |
22 | 23 |
23 #include "SkDeviceImageFilterProxy.h" | 24 #include "SkDeviceImageFilterProxy.h" |
24 #include "SkDrawProcs.h" | 25 #include "SkDrawProcs.h" |
25 #include "SkGlyphCache.h" | 26 #include "SkGlyphCache.h" |
26 #include "SkImageFilter.h" | 27 #include "SkImageFilter.h" |
27 #include "SkMaskFilter.h" | 28 #include "SkMaskFilter.h" |
28 #include "SkPathEffect.h" | 29 #include "SkPathEffect.h" |
29 #include "SkPicture.h" | 30 #include "SkPicture.h" |
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
459 SkScalar width = paint.getStrokeWidth(); | 460 SkScalar width = paint.getStrokeWidth(); |
460 | 461 |
461 /* | 462 /* |
462 We have special code for hairline strokes, miter-strokes, bevel-stroke | 463 We have special code for hairline strokes, miter-strokes, bevel-stroke |
463 and fills. Anything else we just call our path code. | 464 and fills. Anything else we just call our path code. |
464 */ | 465 */ |
465 bool usePath = doStroke && width > 0 && | 466 bool usePath = doStroke && width > 0 && |
466 (paint.getStrokeJoin() == SkPaint::kRound_Join || | 467 (paint.getStrokeJoin() == SkPaint::kRound_Join || |
467 (paint.getStrokeJoin() == SkPaint::kBevel_Join && rect.isEmp ty())); | 468 (paint.getStrokeJoin() == SkPaint::kBevel_Join && rect.isEmp ty())); |
468 // another two reasons we might need to call drawPath... | 469 // another two reasons we might need to call drawPath... |
469 if (paint.getMaskFilter() || paint.getPathEffect()) { | 470 |
471 if (paint.getMaskFilter()) { | |
470 usePath = true; | 472 usePath = true; |
471 } | 473 } |
474 | |
472 if (!usePath && paint.isAntiAlias() && !fContext->getMatrix().rectStaysRect( )) { | 475 if (!usePath && paint.isAntiAlias() && !fContext->getMatrix().rectStaysRect( )) { |
473 #if defined(SHADER_AA_FILL_RECT) || !defined(IGNORE_ROT_AA_RECT_OPT) | 476 #if defined(SHADER_AA_FILL_RECT) || !defined(IGNORE_ROT_AA_RECT_OPT) |
474 if (doStroke) { | 477 if (doStroke) { |
475 #endif | 478 #endif |
476 usePath = true; | 479 usePath = true; |
477 #if defined(SHADER_AA_FILL_RECT) || !defined(IGNORE_ROT_AA_RECT_OPT) | 480 #if defined(SHADER_AA_FILL_RECT) || !defined(IGNORE_ROT_AA_RECT_OPT) |
478 } else { | 481 } else { |
479 usePath = !fContext->getMatrix().preservesRightAngles(); | 482 usePath = !fContext->getMatrix().preservesRightAngles(); |
480 } | 483 } |
481 #endif | 484 #endif |
482 } | 485 } |
483 // until we can both stroke and fill rectangles | 486 // until we can both stroke and fill rectangles |
484 if (paint.getStyle() == SkPaint::kStrokeAndFill_Style) { | 487 if (paint.getStyle() == SkPaint::kStrokeAndFill_Style) { |
485 usePath = true; | 488 usePath = true; |
486 } | 489 } |
487 | 490 |
491 GrStrokeInfo strokeInfo(paint); | |
492 | |
493 SkPathEffect* pe = paint.getPathEffect(); | |
robertphillips
2014/06/05 18:28:02
NULL != pe ?
| |
494 if (!usePath && pe && !strokeInfo.setDashInfo(pe)) { | |
495 usePath = true; | |
496 } | |
497 | |
488 if (usePath) { | 498 if (usePath) { |
489 SkPath path; | 499 SkPath path; |
490 path.addRect(rect); | 500 path.addRect(rect); |
491 this->drawPath(draw, path, paint, NULL, true); | 501 this->drawPath(draw, path, paint, NULL, true); |
492 return; | 502 return; |
493 } | 503 } |
494 | 504 |
495 GrPaint grPaint; | 505 GrPaint grPaint; |
496 SkPaint2GrPaintShader(this->context(), paint, true, &grPaint); | 506 SkPaint2GrPaintShader(this->context(), paint, true, &grPaint); |
507 | |
508 SkAutoTArray<SkScalar> intervals(strokeInfo.dashCount()); | |
509 if (strokeInfo.isDashed()) { | |
510 strokeInfo.setDashInfo(pe, intervals.get()); | |
511 } | |
497 | 512 |
498 if (!doStroke) { | 513 fContext->drawRect(grPaint, rect, &strokeInfo); |
499 fContext->drawRect(grPaint, rect); | |
500 } else { | |
501 SkStrokeRec stroke(paint); | |
502 fContext->drawRect(grPaint, rect, &stroke); | |
503 } | |
504 } | 514 } |
505 | 515 |
506 /////////////////////////////////////////////////////////////////////////////// | 516 /////////////////////////////////////////////////////////////////////////////// |
507 | 517 |
508 void SkGpuDevice::drawRRect(const SkDraw& draw, const SkRRect& rect, | 518 void SkGpuDevice::drawRRect(const SkDraw& draw, const SkRRect& rect, |
509 const SkPaint& paint) { | 519 const SkPaint& paint) { |
510 CHECK_FOR_ANNOTATION(paint); | 520 CHECK_FOR_ANNOTATION(paint); |
511 CHECK_SHOULD_DRAW(draw, false); | 521 CHECK_SHOULD_DRAW(draw, false); |
512 | 522 |
513 GrPaint grPaint; | 523 GrPaint grPaint; |
514 SkPaint2GrPaintShader(this->context(), paint, true, &grPaint); | 524 SkPaint2GrPaintShader(this->context(), paint, true, &grPaint); |
515 | 525 |
516 SkStrokeRec stroke(paint); | 526 GrStrokeInfo strokeInfo(paint); |
517 if (paint.getMaskFilter()) { | 527 if (paint.getMaskFilter()) { |
518 // try to hit the fast path for drawing filtered round rects | 528 // try to hit the fast path for drawing filtered round rects |
519 | 529 |
520 SkRRect devRRect; | 530 SkRRect devRRect; |
521 if (rect.transform(fContext->getMatrix(), &devRRect)) { | 531 if (rect.transform(fContext->getMatrix(), &devRRect)) { |
522 if (devRRect.allCornersCircular()) { | 532 if (devRRect.allCornersCircular()) { |
523 SkRect maskRect; | 533 SkRect maskRect; |
524 if (paint.getMaskFilter()->canFilterMaskGPU(devRRect.rect(), | 534 if (paint.getMaskFilter()->canFilterMaskGPU(devRRect.rect(), |
525 draw.fClip->getBounds(), | 535 draw.fClip->getBounds(), |
526 fContext->getMatrix(), | 536 fContext->getMatrix(), |
527 &maskRect)) { | 537 &maskRect)) { |
528 SkIRect finalIRect; | 538 SkIRect finalIRect; |
529 maskRect.roundOut(&finalIRect); | 539 maskRect.roundOut(&finalIRect); |
530 if (draw.fClip->quickReject(finalIRect)) { | 540 if (draw.fClip->quickReject(finalIRect)) { |
531 // clipped out | 541 // clipped out |
532 return; | 542 return; |
533 } | 543 } |
534 if (paint.getMaskFilter()->directFilterRRectMaskGPU(fContext , &grPaint, | 544 if (paint.getMaskFilter()->directFilterRRectMaskGPU(fContext , &grPaint, |
535 stroke, devRRect)) { | 545 strokeIn fo.getStrokeRec(), |
546 devRRect )) { | |
536 return; | 547 return; |
537 } | 548 } |
538 } | 549 } |
539 | 550 |
540 } | 551 } |
541 } | 552 } |
542 | 553 |
543 } | 554 } |
544 | 555 |
545 if (paint.getMaskFilter() || paint.getPathEffect()) { | 556 bool usePath = false; |
557 | |
558 if (paint.getMaskFilter()) { | |
559 usePath = true; | |
560 } | |
561 | |
bsalomon
2014/06/05 19:22:54
else {
SkPathEffect* pe = paint.getPathEffect(
| |
562 SkPathEffect* pe = paint.getPathEffect(); | |
robertphillips
2014/06/05 18:28:02
NULL != pe ?
| |
563 if (!usePath && pe && !strokeInfo.setDashInfo(pe)) { | |
564 usePath = true; | |
565 } | |
566 | |
567 if (usePath) { | |
546 SkPath path; | 568 SkPath path; |
547 path.addRRect(rect); | 569 path.addRRect(rect); |
548 this->drawPath(draw, path, paint, NULL, true); | 570 this->drawPath(draw, path, paint, NULL, true); |
549 return; | 571 return; |
550 } | 572 } |
573 | |
574 SkAutoTArray<SkScalar> intervals(strokeInfo.dashCount()); | |
bsalomon
2014/06/05 19:22:54
This feels kinda ugly to me. Can StrokeInfo own th
| |
575 if (strokeInfo.isDashed()) { | |
576 strokeInfo.setDashInfo(pe, intervals.get()); | |
577 } | |
551 | 578 |
552 fContext->drawRRect(grPaint, rect, stroke); | 579 fContext->drawRRect(grPaint, rect, strokeInfo); |
553 } | 580 } |
554 | 581 |
555 void SkGpuDevice::drawDRRect(const SkDraw& draw, const SkRRect& outer, | 582 void SkGpuDevice::drawDRRect(const SkDraw& draw, const SkRRect& outer, |
556 const SkRRect& inner, const SkPaint& paint) { | 583 const SkRRect& inner, const SkPaint& paint) { |
557 SkStrokeRec stroke(paint); | 584 SkStrokeRec stroke(paint); |
558 if (stroke.isFillStyle()) { | 585 if (stroke.isFillStyle()) { |
559 | 586 |
560 CHECK_FOR_ANNOTATION(paint); | 587 CHECK_FOR_ANNOTATION(paint); |
561 CHECK_SHOULD_DRAW(draw, false); | 588 CHECK_SHOULD_DRAW(draw, false); |
562 | 589 |
(...skipping 20 matching lines...) Expand all Loading... | |
583 void SkGpuDevice::drawOval(const SkDraw& draw, const SkRect& oval, | 610 void SkGpuDevice::drawOval(const SkDraw& draw, const SkRect& oval, |
584 const SkPaint& paint) { | 611 const SkPaint& paint) { |
585 CHECK_FOR_ANNOTATION(paint); | 612 CHECK_FOR_ANNOTATION(paint); |
586 CHECK_SHOULD_DRAW(draw, false); | 613 CHECK_SHOULD_DRAW(draw, false); |
587 | 614 |
588 bool usePath = false; | 615 bool usePath = false; |
589 // some basic reasons we might need to call drawPath... | 616 // some basic reasons we might need to call drawPath... |
590 if (paint.getMaskFilter() || paint.getPathEffect()) { | 617 if (paint.getMaskFilter() || paint.getPathEffect()) { |
591 usePath = true; | 618 usePath = true; |
592 } | 619 } |
620 | |
621 GrStrokeInfo strokeInfo(paint); | |
622 | |
623 SkPathEffect* pe = paint.getPathEffect(); | |
robertphillips
2014/06/05 18:28:02
NULL != pe ?
| |
624 if (!usePath && pe && !strokeInfo.setDashInfo(pe)) { | |
625 usePath = true; | |
626 } | |
593 | 627 |
594 if (usePath) { | 628 if (usePath) { |
595 SkPath path; | 629 SkPath path; |
596 path.addOval(oval); | 630 path.addOval(oval); |
597 this->drawPath(draw, path, paint, NULL, true); | 631 this->drawPath(draw, path, paint, NULL, true); |
598 return; | 632 return; |
599 } | 633 } |
600 | 634 |
601 GrPaint grPaint; | 635 GrPaint grPaint; |
602 SkPaint2GrPaintShader(this->context(), paint, true, &grPaint); | 636 SkPaint2GrPaintShader(this->context(), paint, true, &grPaint); |
603 SkStrokeRec stroke(paint); | |
604 | 637 |
605 fContext->drawOval(grPaint, oval, stroke); | 638 SkAutoTArray<SkScalar> intervals(strokeInfo.dashCount()); |
639 if (strokeInfo.isDashed()) { | |
640 strokeInfo.setDashInfo(pe, intervals.get()); | |
641 } | |
642 | |
643 fContext->drawOval(grPaint, oval, strokeInfo); | |
606 } | 644 } |
607 | 645 |
608 #include "SkMaskFilter.h" | 646 #include "SkMaskFilter.h" |
609 | 647 |
610 /////////////////////////////////////////////////////////////////////////////// | 648 /////////////////////////////////////////////////////////////////////////////// |
611 | 649 |
612 // helpers for applying mask filters | 650 // helpers for applying mask filters |
613 namespace { | 651 namespace { |
614 | 652 |
615 // Draw a mask using the supplied paint. Since the coverage/geometry | 653 // Draw a mask using the supplied paint. Since the coverage/geometry |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
671 SkRect maskRect = SkRect::Make(dstM.fBounds); | 709 SkRect maskRect = SkRect::Make(dstM.fBounds); |
672 | 710 |
673 return draw_mask(context, maskRect, grp, texture); | 711 return draw_mask(context, maskRect, grp, texture); |
674 } | 712 } |
675 | 713 |
676 // Create a mask of 'devPath' and place the result in 'mask'. Return true on | 714 // Create a mask of 'devPath' and place the result in 'mask'. Return true on |
677 // success; false otherwise. | 715 // success; false otherwise. |
678 bool create_mask_GPU(GrContext* context, | 716 bool create_mask_GPU(GrContext* context, |
679 const SkRect& maskRect, | 717 const SkRect& maskRect, |
680 const SkPath& devPath, | 718 const SkPath& devPath, |
681 const SkStrokeRec& stroke, | 719 const GrStrokeInfo& strokeInfo, |
682 bool doAA, | 720 bool doAA, |
683 GrAutoScratchTexture* mask) { | 721 GrAutoScratchTexture* mask) { |
684 GrTextureDesc desc; | 722 GrTextureDesc desc; |
685 desc.fFlags = kRenderTarget_GrTextureFlagBit; | 723 desc.fFlags = kRenderTarget_GrTextureFlagBit; |
686 desc.fWidth = SkScalarCeilToInt(maskRect.width()); | 724 desc.fWidth = SkScalarCeilToInt(maskRect.width()); |
687 desc.fHeight = SkScalarCeilToInt(maskRect.height()); | 725 desc.fHeight = SkScalarCeilToInt(maskRect.height()); |
688 // We actually only need A8, but it often isn't supported as a | 726 // We actually only need A8, but it often isn't supported as a |
689 // render target so default to RGBA_8888 | 727 // render target so default to RGBA_8888 |
690 desc.fConfig = kRGBA_8888_GrPixelConfig; | 728 desc.fConfig = kRGBA_8888_GrPixelConfig; |
691 if (context->isConfigRenderable(kAlpha_8_GrPixelConfig, false)) { | 729 if (context->isConfigRenderable(kAlpha_8_GrPixelConfig, false)) { |
(...skipping 24 matching lines...) Expand all Loading... | |
716 // use a zero dst coeff when dual source blending isn't available. | 754 // use a zero dst coeff when dual source blending isn't available. |
717 tempPaint.setBlendFunc(kOne_GrBlendCoeff, kISC_GrBlendCoeff); | 755 tempPaint.setBlendFunc(kOne_GrBlendCoeff, kISC_GrBlendCoeff); |
718 } | 756 } |
719 | 757 |
720 GrContext::AutoMatrix am; | 758 GrContext::AutoMatrix am; |
721 | 759 |
722 // Draw the mask into maskTexture with the path's top-left at the origin usi ng tempPaint. | 760 // Draw the mask into maskTexture with the path's top-left at the origin usi ng tempPaint. |
723 SkMatrix translate; | 761 SkMatrix translate; |
724 translate.setTranslate(-maskRect.fLeft, -maskRect.fTop); | 762 translate.setTranslate(-maskRect.fLeft, -maskRect.fTop); |
725 am.set(context, translate); | 763 am.set(context, translate); |
726 context->drawPath(tempPaint, devPath, stroke); | 764 context->drawPath(tempPaint, devPath, strokeInfo); |
727 return true; | 765 return true; |
728 } | 766 } |
729 | 767 |
730 SkBitmap wrap_texture(GrTexture* texture) { | 768 SkBitmap wrap_texture(GrTexture* texture) { |
731 SkImageInfo info; | 769 SkImageInfo info; |
732 texture->asImageInfo(&info); | 770 texture->asImageInfo(&info); |
733 | 771 |
734 SkBitmap result; | 772 SkBitmap result; |
735 result.setInfo(info); | 773 result.setInfo(info); |
736 result.setPixelRef(SkNEW_ARGS(SkGrPixelRef, (info, texture)))->unref(); | 774 result.setPixelRef(SkNEW_ARGS(SkGrPixelRef, (info, texture)))->unref(); |
(...skipping 26 matching lines...) Expand all Loading... | |
763 pathIsMutable = true; | 801 pathIsMutable = true; |
764 } | 802 } |
765 // should I push prePathMatrix on our MV stack temporarily, instead | 803 // should I push prePathMatrix on our MV stack temporarily, instead |
766 // of applying it here? See SkDraw.cpp | 804 // of applying it here? See SkDraw.cpp |
767 pathPtr->transform(*prePathMatrix, result); | 805 pathPtr->transform(*prePathMatrix, result); |
768 pathPtr = result; | 806 pathPtr = result; |
769 } | 807 } |
770 // at this point we're done with prePathMatrix | 808 // at this point we're done with prePathMatrix |
771 SkDEBUGCODE(prePathMatrix = (const SkMatrix*)0x50FF8001;) | 809 SkDEBUGCODE(prePathMatrix = (const SkMatrix*)0x50FF8001;) |
772 | 810 |
773 SkStrokeRec stroke(paint); | 811 GrStrokeInfo strokeInfo(paint); |
774 SkPathEffect* pathEffect = paint.getPathEffect(); | 812 SkPathEffect* pathEffect = paint.getPathEffect(); |
775 const SkRect* cullRect = NULL; // TODO: what is our bounds? | 813 const SkRect* cullRect = NULL; // TODO: what is our bounds? |
776 if (pathEffect && pathEffect->filterPath(effectPath.init(), *pathPtr, &strok e, | 814 SkStrokeRec* strokePtr = strokeInfo.getStrokeRecPtr(); |
815 if (pathEffect && pathEffect->filterPath(effectPath.init(), *pathPtr, stroke Ptr, | |
777 cullRect)) { | 816 cullRect)) { |
778 pathPtr = effectPath.get(); | 817 pathPtr = effectPath.get(); |
779 pathIsMutable = true; | 818 pathIsMutable = true; |
780 } | 819 } |
781 | 820 |
821 const SkStrokeRec& stroke = strokeInfo.getStrokeRec(); | |
782 if (paint.getMaskFilter()) { | 822 if (paint.getMaskFilter()) { |
783 if (!stroke.isHairlineStyle()) { | 823 if (!stroke.isHairlineStyle()) { |
784 SkPath* strokedPath = pathIsMutable ? pathPtr : tmpPath.init(); | 824 SkPath* strokedPath = pathIsMutable ? pathPtr : tmpPath.init(); |
785 if (stroke.applyToPath(strokedPath, *pathPtr)) { | 825 if (stroke.applyToPath(strokedPath, *pathPtr)) { |
786 pathPtr = strokedPath; | 826 pathPtr = strokedPath; |
787 pathIsMutable = true; | 827 pathIsMutable = true; |
788 stroke.setFillStyle(); | 828 strokeInfo.setFillStyle(); |
789 } | 829 } |
790 } | 830 } |
791 | 831 |
792 // avoid possibly allocating a new path in transform if we can | 832 // avoid possibly allocating a new path in transform if we can |
793 SkPath* devPathPtr = pathIsMutable ? pathPtr : tmpPath.init(); | 833 SkPath* devPathPtr = pathIsMutable ? pathPtr : tmpPath.init(); |
794 | 834 |
795 // transform the path into device space | 835 // transform the path into device space |
796 pathPtr->transform(fContext->getMatrix(), devPathPtr); | 836 pathPtr->transform(fContext->getMatrix(), devPathPtr); |
797 | 837 |
798 SkRect maskRect; | 838 SkRect maskRect; |
(...skipping 14 matching lines...) Expand all Loading... | |
813 | 853 |
814 if (paint.getMaskFilter()->directFilterMaskGPU(fContext, &grPaint, | 854 if (paint.getMaskFilter()->directFilterMaskGPU(fContext, &grPaint, |
815 stroke, *devPathPtr)) { | 855 stroke, *devPathPtr)) { |
816 // the mask filter was able to draw itself directly, so there's nothing | 856 // the mask filter was able to draw itself directly, so there's nothing |
817 // left to do. | 857 // left to do. |
818 return; | 858 return; |
819 } | 859 } |
820 | 860 |
821 GrAutoScratchTexture mask; | 861 GrAutoScratchTexture mask; |
822 | 862 |
823 if (create_mask_GPU(fContext, maskRect, *devPathPtr, stroke, | 863 if (create_mask_GPU(fContext, maskRect, *devPathPtr, strokeInfo, |
824 grPaint.isAntiAlias(), &mask)) { | 864 grPaint.isAntiAlias(), &mask)) { |
825 GrTexture* filtered; | 865 GrTexture* filtered; |
826 | 866 |
827 if (paint.getMaskFilter()->filterMaskGPU(mask.texture(), | 867 if (paint.getMaskFilter()->filterMaskGPU(mask.texture(), |
828 ctm, maskRect, &filtere d, true)) { | 868 ctm, maskRect, &filtere d, true)) { |
829 // filterMaskGPU gives us ownership of a ref to the result | 869 // filterMaskGPU gives us ownership of a ref to the result |
830 SkAutoTUnref<GrTexture> atu(filtered); | 870 SkAutoTUnref<GrTexture> atu(filtered); |
831 | 871 |
832 // If the scratch texture that we used as the filter src als o holds the filter | 872 // If the scratch texture that we used as the filter src als o holds the filter |
833 // result then we must detach so that this texture isn't rec ycled for a later | 873 // result then we must detach so that this texture isn't rec ycled for a later |
834 // draw. | 874 // draw. |
835 if (filtered == mask.texture()) { | 875 if (filtered == mask.texture()) { |
836 mask.detach(); | 876 mask.detach(); |
837 filtered->unref(); // detach transfers GrAutoScratchText ure's ref to us. | 877 filtered->unref(); // detach transfers GrAutoScratchText ure's ref to us. |
838 } | 878 } |
839 | 879 |
840 if (draw_mask(fContext, maskRect, &grPaint, filtered)) { | 880 if (draw_mask(fContext, maskRect, &grPaint, filtered)) { |
841 // This path is completely drawn | 881 // This path is completely drawn |
842 return; | 882 return; |
843 } | 883 } |
844 } | 884 } |
845 } | 885 } |
846 } | 886 } |
847 | 887 |
848 // draw the mask on the CPU - this is a fallthrough path in case the | 888 // draw the mask on the CPU - this is a fallthrough path in case the |
849 // GPU path fails | 889 // GPU path fails |
850 SkPaint::Style style = stroke.isHairlineStyle() ? SkPaint::kStroke_Style : | 890 SkPaint::Style style = stroke.isHairlineStyle() ? SkPaint::kStroke_Style : |
robertphillips
2014/06/05 18:28:02
Fix this alignment?
| |
851 SkPaint::kFill_Style; | 891 SkPaint::kFill_St yle; |
852 draw_with_mask_filter(fContext, *devPathPtr, paint.getMaskFilter(), *dra w.fClip, &grPaint, | 892 draw_with_mask_filter(fContext, *devPathPtr, paint.getMaskFilter(), |
853 style); | 893 *draw.fClip, &grPaint, style); |
854 return; | 894 return; |
855 } | 895 } |
856 | 896 |
857 fContext->drawPath(grPaint, *pathPtr, stroke); | 897 fContext->drawPath(grPaint, *pathPtr, strokeInfo); |
858 } | 898 } |
859 | 899 |
860 static const int kBmpSmallTileSize = 1 << 10; | 900 static const int kBmpSmallTileSize = 1 << 10; |
861 | 901 |
862 static inline int get_tile_count(const SkIRect& srcRect, int tileSize) { | 902 static inline int get_tile_count(const SkIRect& srcRect, int tileSize) { |
863 int tilesX = (srcRect.fRight / tileSize) - (srcRect.fLeft / tileSize) + 1; | 903 int tilesX = (srcRect.fRight / tileSize) - (srcRect.fLeft / tileSize) + 1; |
864 int tilesY = (srcRect.fBottom / tileSize) - (srcRect.fTop / tileSize) + 1; | 904 int tilesY = (srcRect.fBottom / tileSize) - (srcRect.fTop / tileSize) + 1; |
865 return tilesX * tilesY; | 905 return tilesX * tilesY; |
866 } | 906 } |
867 | 907 |
(...skipping 1138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2006 GrCachedLayer* layer = fContext->getLayerCache()->findLayerOrCreate(pict ure, i); | 2046 GrCachedLayer* layer = fContext->getLayerCache()->findLayerOrCreate(pict ure, i); |
2007 | 2047 |
2008 if (NULL != layer->getTexture()) { | 2048 if (NULL != layer->getTexture()) { |
2009 fContext->unlockScratchTexture(layer->getTexture()); | 2049 fContext->unlockScratchTexture(layer->getTexture()); |
2010 layer->setTexture(NULL); | 2050 layer->setTexture(NULL); |
2011 } | 2051 } |
2012 } | 2052 } |
2013 | 2053 |
2014 return true; | 2054 return true; |
2015 } | 2055 } |
OLD | NEW |