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

Side by Side Diff: src/gpu/SkGpuDevice.cpp

Issue 1925693002: remove 'deprecated' region from SkDraw (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update dox Created 4 years, 7 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
« no previous file with comments | « src/gpu/GrSWMaskHelper.cpp ('k') | src/gpu/batches/GrAADistanceFieldPathRenderer.cpp » ('j') | no next file with comments »
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 "SkGpuDevice.h" 8 #include "SkGpuDevice.h"
9 9
10 #include "GrBlurUtils.h" 10 #include "GrBlurUtils.h"
(...skipping 14 matching lines...) Expand all
25 #include "SkGrPriv.h" 25 #include "SkGrPriv.h"
26 #include "SkImage_Base.h" 26 #include "SkImage_Base.h"
27 #include "SkImageCacherator.h" 27 #include "SkImageCacherator.h"
28 #include "SkImageFilter.h" 28 #include "SkImageFilter.h"
29 #include "SkLayerInfo.h" 29 #include "SkLayerInfo.h"
30 #include "SkMaskFilter.h" 30 #include "SkMaskFilter.h"
31 #include "SkNinePatchIter.h" 31 #include "SkNinePatchIter.h"
32 #include "SkPathEffect.h" 32 #include "SkPathEffect.h"
33 #include "SkPicture.h" 33 #include "SkPicture.h"
34 #include "SkPictureData.h" 34 #include "SkPictureData.h"
35 #include "SkRasterClip.h"
35 #include "SkRRect.h" 36 #include "SkRRect.h"
36 #include "SkRecord.h" 37 #include "SkRecord.h"
37 #include "SkStroke.h" 38 #include "SkStroke.h"
38 #include "SkSurface.h" 39 #include "SkSurface.h"
39 #include "SkSurface_Gpu.h" 40 #include "SkSurface_Gpu.h"
40 #include "SkTLazy.h" 41 #include "SkTLazy.h"
41 #include "SkUtils.h" 42 #include "SkUtils.h"
42 #include "SkVertState.h" 43 #include "SkVertState.h"
43 #include "SkXfermode.h" 44 #include "SkXfermode.h"
44 #include "batches/GrRectBatchFactory.h" 45 #include "batches/GrRectBatchFactory.h"
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 usePath = true; 509 usePath = true;
509 } 510 }
510 511
511 if (usePath) { 512 if (usePath) {
512 SkPath path; 513 SkPath path;
513 path.setIsVolatile(true); 514 path.setIsVolatile(true);
514 path.addRect(rect); 515 path.addRect(rect);
515 GrBlurUtils::drawPathWithMaskFilter(fContext, fDrawContext, 516 GrBlurUtils::drawPathWithMaskFilter(fContext, fDrawContext,
516 fClip, path, paint, 517 fClip, path, paint,
517 *draw.fMatrix, nullptr, 518 *draw.fMatrix, nullptr,
518 draw.fClip->getBounds(), true); 519 draw.fRC->getBounds(), true);
519 return; 520 return;
520 } 521 }
521 522
522 GrPaint grPaint; 523 GrPaint grPaint;
523 if (!SkPaintToGrPaint(this->context(), paint, *draw.fMatrix, 524 if (!SkPaintToGrPaint(this->context(), paint, *draw.fMatrix,
524 this->surfaceProps().isGammaCorrect(), &grPaint)) { 525 this->surfaceProps().isGammaCorrect(), &grPaint)) {
525 return; 526 return;
526 } 527 }
527 528
528 GrStrokeInfo strokeInfo(paint); 529 GrStrokeInfo strokeInfo(paint);
(...skipping 17 matching lines...) Expand all
546 547
547 GrStrokeInfo strokeInfo(paint); 548 GrStrokeInfo strokeInfo(paint);
548 if (paint.getMaskFilter()) { 549 if (paint.getMaskFilter()) {
549 // try to hit the fast path for drawing filtered round rects 550 // try to hit the fast path for drawing filtered round rects
550 551
551 SkRRect devRRect; 552 SkRRect devRRect;
552 if (rect.transform(*draw.fMatrix, &devRRect)) { 553 if (rect.transform(*draw.fMatrix, &devRRect)) {
553 if (devRRect.allCornersCircular()) { 554 if (devRRect.allCornersCircular()) {
554 SkRect maskRect; 555 SkRect maskRect;
555 if (paint.getMaskFilter()->canFilterMaskGPU(devRRect, 556 if (paint.getMaskFilter()->canFilterMaskGPU(devRRect,
556 draw.fClip->getBound s(), 557 draw.fRC->getBounds( ),
557 *draw.fMatrix, 558 *draw.fMatrix,
558 &maskRect)) { 559 &maskRect)) {
559 SkIRect finalIRect; 560 SkIRect finalIRect;
560 maskRect.roundOut(&finalIRect); 561 maskRect.roundOut(&finalIRect);
561 if (draw.fClip->quickReject(finalIRect)) { 562 if (draw.fRC->quickReject(finalIRect)) {
562 // clipped out 563 // clipped out
563 return; 564 return;
564 } 565 }
565 if (paint.getMaskFilter()->directFilterRRectMaskGPU(fContext ->textureProvider(), 566 if (paint.getMaskFilter()->directFilterRRectMaskGPU(fContext ->textureProvider(),
566 fDrawCon text, 567 fDrawCon text,
567 &grPaint , 568 &grPaint ,
568 fClip, 569 fClip,
569 *draw.fM atrix, 570 *draw.fM atrix,
570 strokeIn fo, 571 strokeIn fo,
571 devRRect )) { 572 devRRect )) {
572 return; 573 return;
573 } 574 }
574 } 575 }
575 576
576 } 577 }
577 } 578 }
578 } 579 }
579 580
580 if (paint.getMaskFilter() || paint.getPathEffect()) { 581 if (paint.getMaskFilter() || paint.getPathEffect()) {
581 // The only mask filter the native rrect drawing code could've handle wa s taken 582 // The only mask filter the native rrect drawing code could've handle wa s taken
582 // care of above. 583 // care of above.
583 // A path effect will presumably transform this rrect into something els e. 584 // A path effect will presumably transform this rrect into something els e.
584 SkPath path; 585 SkPath path;
585 path.setIsVolatile(true); 586 path.setIsVolatile(true);
586 path.addRRect(rect); 587 path.addRRect(rect);
587 GrBlurUtils::drawPathWithMaskFilter(fContext, fDrawContext, 588 GrBlurUtils::drawPathWithMaskFilter(fContext, fDrawContext,
588 fClip, path, paint, 589 fClip, path, paint,
589 *draw.fMatrix, nullptr, 590 *draw.fMatrix, nullptr,
590 draw.fClip->getBounds(), true); 591 draw.fRC->getBounds(), true);
591 return; 592 return;
592 } 593 }
593 594
594 SkASSERT(!strokeInfo.isDashed()); 595 SkASSERT(!strokeInfo.isDashed());
595 596
596 fDrawContext->drawRRect(fClip, grPaint, *draw.fMatrix, rect, strokeInfo); 597 fDrawContext->drawRRect(fClip, grPaint, *draw.fMatrix, rect, strokeInfo);
597 } 598 }
598 599
599 600
600 void SkGpuDevice::drawDRRect(const SkDraw& draw, const SkRRect& outer, 601 void SkGpuDevice::drawDRRect(const SkDraw& draw, const SkRRect& outer,
(...skipping 25 matching lines...) Expand all
626 627
627 SkPath path; 628 SkPath path;
628 path.setIsVolatile(true); 629 path.setIsVolatile(true);
629 path.addRRect(outer); 630 path.addRRect(outer);
630 path.addRRect(inner); 631 path.addRRect(inner);
631 path.setFillType(SkPath::kEvenOdd_FillType); 632 path.setFillType(SkPath::kEvenOdd_FillType);
632 633
633 GrBlurUtils::drawPathWithMaskFilter(fContext, fDrawContext, 634 GrBlurUtils::drawPathWithMaskFilter(fContext, fDrawContext,
634 fClip, path, paint, 635 fClip, path, paint,
635 *draw.fMatrix, nullptr, 636 *draw.fMatrix, nullptr,
636 draw.fClip->getBounds(), true); 637 draw.fRC->getBounds(), true);
637 } 638 }
638 639
639 640
640 ///////////////////////////////////////////////////////////////////////////// 641 /////////////////////////////////////////////////////////////////////////////
641 642
642 void SkGpuDevice::drawOval(const SkDraw& draw, const SkRect& oval, const SkPaint & paint) { 643 void SkGpuDevice::drawOval(const SkDraw& draw, const SkRect& oval, const SkPaint & paint) {
643 ASSERT_SINGLE_OWNER 644 ASSERT_SINGLE_OWNER
644 GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawOval", fContext); 645 GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawOval", fContext);
645 CHECK_SHOULD_DRAW(draw); 646 CHECK_SHOULD_DRAW(draw);
646 647
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
696 return; 697 return;
697 } 698 }
698 } 699 }
699 700
700 CHECK_SHOULD_DRAW(draw); 701 CHECK_SHOULD_DRAW(draw);
701 GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawPath", fContext); 702 GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawPath", fContext);
702 703
703 GrBlurUtils::drawPathWithMaskFilter(fContext, fDrawContext, 704 GrBlurUtils::drawPathWithMaskFilter(fContext, fDrawContext,
704 fClip, origSrcPath, paint, 705 fClip, origSrcPath, paint,
705 *draw.fMatrix, prePathMatrix, 706 *draw.fMatrix, prePathMatrix,
706 draw.fClip->getBounds(), pathIsMutable); 707 draw.fRC->getBounds(), pathIsMutable);
707 } 708 }
708 709
709 static const int kBmpSmallTileSize = 1 << 10; 710 static const int kBmpSmallTileSize = 1 << 10;
710 711
711 static inline int get_tile_count(const SkIRect& srcRect, int tileSize) { 712 static inline int get_tile_count(const SkIRect& srcRect, int tileSize) {
712 int tilesX = (srcRect.fRight / tileSize) - (srcRect.fLeft / tileSize) + 1; 713 int tilesX = (srcRect.fRight / tileSize) - (srcRect.fLeft / tileSize) + 1;
713 int tilesY = (srcRect.fBottom / tileSize) - (srcRect.fTop / tileSize) + 1; 714 int tilesY = (srcRect.fBottom / tileSize) - (srcRect.fTop / tileSize) + 1;
714 return tilesX * tilesY; 715 return tilesX * tilesY;
715 } 716 }
716 717
(...skipping 952 matching lines...) Expand 10 before | Expand all | Expand 10 after
1669 1670
1670 GrPaint grPaint; 1671 GrPaint grPaint;
1671 if (!SkPaintToGrPaint(this->context(), paint, *draw.fMatrix, 1672 if (!SkPaintToGrPaint(this->context(), paint, *draw.fMatrix,
1672 this->surfaceProps().isGammaCorrect(), &grPaint)) { 1673 this->surfaceProps().isGammaCorrect(), &grPaint)) {
1673 return; 1674 return;
1674 } 1675 }
1675 1676
1676 SkDEBUGCODE(this->validate();) 1677 SkDEBUGCODE(this->validate();)
1677 1678
1678 fDrawContext->drawText(fClip, grPaint, paint, *draw.fMatrix, 1679 fDrawContext->drawText(fClip, grPaint, paint, *draw.fMatrix,
1679 (const char *)text, byteLength, x, y, draw.fClip->get Bounds()); 1680 (const char *)text, byteLength, x, y, draw.fRC->getBo unds());
1680 } 1681 }
1681 1682
1682 void SkGpuDevice::drawPosText(const SkDraw& draw, const void* text, size_t byteL ength, 1683 void SkGpuDevice::drawPosText(const SkDraw& draw, const void* text, size_t byteL ength,
1683 const SkScalar pos[], int scalarsPerPos, 1684 const SkScalar pos[], int scalarsPerPos,
1684 const SkPoint& offset, const SkPaint& paint) { 1685 const SkPoint& offset, const SkPaint& paint) {
1685 ASSERT_SINGLE_OWNER 1686 ASSERT_SINGLE_OWNER
1686 GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawPosText", fContext); 1687 GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawPosText", fContext);
1687 CHECK_SHOULD_DRAW(draw); 1688 CHECK_SHOULD_DRAW(draw);
1688 1689
1689 GrPaint grPaint; 1690 GrPaint grPaint;
1690 if (!SkPaintToGrPaint(this->context(), paint, *draw.fMatrix, 1691 if (!SkPaintToGrPaint(this->context(), paint, *draw.fMatrix,
1691 this->surfaceProps().isGammaCorrect(), &grPaint)) { 1692 this->surfaceProps().isGammaCorrect(), &grPaint)) {
1692 return; 1693 return;
1693 } 1694 }
1694 1695
1695 SkDEBUGCODE(this->validate();) 1696 SkDEBUGCODE(this->validate();)
1696 1697
1697 fDrawContext->drawPosText(fClip, grPaint, paint, *draw.fMatrix, 1698 fDrawContext->drawPosText(fClip, grPaint, paint, *draw.fMatrix,
1698 (const char *)text, byteLength, pos, scalarsPerPos , offset, 1699 (const char *)text, byteLength, pos, scalarsPerPos , offset,
1699 draw.fClip->getBounds()); 1700 draw.fRC->getBounds());
1700 } 1701 }
1701 1702
1702 void SkGpuDevice::drawTextBlob(const SkDraw& draw, const SkTextBlob* blob, SkSca lar x, SkScalar y, 1703 void SkGpuDevice::drawTextBlob(const SkDraw& draw, const SkTextBlob* blob, SkSca lar x, SkScalar y,
1703 const SkPaint& paint, SkDrawFilter* drawFilter) { 1704 const SkPaint& paint, SkDrawFilter* drawFilter) {
1704 ASSERT_SINGLE_OWNER 1705 ASSERT_SINGLE_OWNER
1705 GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawTextBlob", fContext); 1706 GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawTextBlob", fContext);
1706 CHECK_SHOULD_DRAW(draw); 1707 CHECK_SHOULD_DRAW(draw);
1707 1708
1708 SkDEBUGCODE(this->validate();) 1709 SkDEBUGCODE(this->validate();)
1709 1710
1710 fDrawContext->drawTextBlob(fClip, paint, *draw.fMatrix, 1711 fDrawContext->drawTextBlob(fClip, paint, *draw.fMatrix,
1711 blob, x, y, drawFilter, draw.fClip->getBounds()); 1712 blob, x, y, drawFilter, draw.fRC->getBounds());
1712 } 1713 }
1713 1714
1714 /////////////////////////////////////////////////////////////////////////////// 1715 ///////////////////////////////////////////////////////////////////////////////
1715 1716
1716 bool SkGpuDevice::onShouldDisableLCD(const SkPaint& paint) const { 1717 bool SkGpuDevice::onShouldDisableLCD(const SkPaint& paint) const {
1717 return GrTextUtils::ShouldDisableLCD(paint); 1718 return GrTextUtils::ShouldDisableLCD(paint);
1718 } 1719 }
1719 1720
1720 void SkGpuDevice::flush() { 1721 void SkGpuDevice::flush() {
1721 ASSERT_SINGLE_OWNER 1722 ASSERT_SINGLE_OWNER
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
1838 } 1839 }
1839 1840
1840 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() { 1841 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() {
1841 ASSERT_SINGLE_OWNER 1842 ASSERT_SINGLE_OWNER
1842 // We always return a transient cache, so it is freed after each 1843 // We always return a transient cache, so it is freed after each
1843 // filter traversal. 1844 // filter traversal.
1844 return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize); 1845 return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize);
1845 } 1846 }
1846 1847
1847 #endif 1848 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrSWMaskHelper.cpp ('k') | src/gpu/batches/GrAADistanceFieldPathRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698