| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2008 The Android Open Source Project | 3 * Copyright 2008 The Android Open Source Project |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 | 9 |
| 10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 SkBool8 fSkipEmptyClips; | 328 SkBool8 fSkipEmptyClips; |
| 329 | 329 |
| 330 typedef SkDraw INHERITED; | 330 typedef SkDraw INHERITED; |
| 331 }; | 331 }; |
| 332 | 332 |
| 333 ///////////////////////////////////////////////////////////////////////////// | 333 ///////////////////////////////////////////////////////////////////////////// |
| 334 | 334 |
| 335 class AutoDrawLooper { | 335 class AutoDrawLooper { |
| 336 public: | 336 public: |
| 337 AutoDrawLooper(SkCanvas* canvas, const SkPaint& paint, | 337 AutoDrawLooper(SkCanvas* canvas, const SkPaint& paint, |
| 338 bool skipLayerForImageFilter = false) : fOrigPaint(paint) { | 338 bool skipLayerForImageFilter = false, |
| 339 const SkRect* bounds = NULL) : fOrigPaint(paint) { |
| 339 fCanvas = canvas; | 340 fCanvas = canvas; |
| 340 fLooper = paint.getLooper(); | 341 fLooper = paint.getLooper(); |
| 341 fFilter = canvas->getDrawFilter(); | 342 fFilter = canvas->getDrawFilter(); |
| 342 fPaint = NULL; | 343 fPaint = NULL; |
| 343 fSaveCount = canvas->getSaveCount(); | 344 fSaveCount = canvas->getSaveCount(); |
| 344 fDoClearImageFilter = false; | 345 fDoClearImageFilter = false; |
| 345 fDone = false; | 346 fDone = false; |
| 346 | 347 |
| 347 if (!skipLayerForImageFilter && fOrigPaint.getImageFilter()) { | 348 if (!skipLayerForImageFilter && fOrigPaint.getImageFilter()) { |
| 348 SkPaint tmp; | 349 SkPaint tmp; |
| 349 tmp.setImageFilter(fOrigPaint.getImageFilter()); | 350 tmp.setImageFilter(fOrigPaint.getImageFilter()); |
| 350 // it would be nice if we had a guess at the bounds, instead of null | 351 (void)canvas->internalSaveLayer(bounds, &tmp, |
| 351 (void)canvas->internalSaveLayer(NULL, &tmp, | |
| 352 SkCanvas::kARGB_ClipLayer_SaveFlag, true); | 352 SkCanvas::kARGB_ClipLayer_SaveFlag, true); |
| 353 // we'll clear the imageFilter for the actual draws in next(), so | 353 // we'll clear the imageFilter for the actual draws in next(), so |
| 354 // it will only be applied during the restore(). | 354 // it will only be applied during the restore(). |
| 355 fDoClearImageFilter = true; | 355 fDoClearImageFilter = true; |
| 356 } | 356 } |
| 357 | 357 |
| 358 if (fLooper) { | 358 if (fLooper) { |
| 359 fLooper->init(canvas); | 359 fLooper->init(canvas); |
| 360 fIsSimple = false; | 360 fIsSimple = false; |
| 361 } else { | 361 } else { |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 464 | 464 |
| 465 ////////// macros to place around the internal draw calls ////////////////// | 465 ////////// macros to place around the internal draw calls ////////////////// |
| 466 | 466 |
| 467 #define LOOPER_BEGIN_DRAWDEVICE(paint, type) \ | 467 #define LOOPER_BEGIN_DRAWDEVICE(paint, type) \ |
| 468 this->predrawNotify(); \ | 468 this->predrawNotify(); \ |
| 469 AutoDrawLooper looper(this, paint, true); \ | 469 AutoDrawLooper looper(this, paint, true); \ |
| 470 while (looper.next(type)) { \ | 470 while (looper.next(type)) { \ |
| 471 SkAutoBounderCommit ac(fBounder); \ | 471 SkAutoBounderCommit ac(fBounder); \ |
| 472 SkDrawIter iter(this); | 472 SkDrawIter iter(this); |
| 473 | 473 |
| 474 #define LOOPER_BEGIN(paint, type) \ | 474 #define LOOPER_BEGIN(paint, type, bounds) \ |
| 475 this->predrawNotify(); \ | 475 this->predrawNotify(); \ |
| 476 AutoDrawLooper looper(this, paint); \ | 476 AutoDrawLooper looper(this, paint, false, bounds); \ |
| 477 while (looper.next(type)) { \ | 477 while (looper.next(type)) { \ |
| 478 SkAutoBounderCommit ac(fBounder); \ | 478 SkAutoBounderCommit ac(fBounder); \ |
| 479 SkDrawIter iter(this); | 479 SkDrawIter iter(this); |
| 480 | 480 |
| 481 #define LOOPER_END } | 481 #define LOOPER_END } |
| 482 | 482 |
| 483 //////////////////////////////////////////////////////////////////////////// | 483 //////////////////////////////////////////////////////////////////////////// |
| 484 | 484 |
| 485 SkBaseDevice* SkCanvas::init(SkBaseDevice* device) { | 485 SkBaseDevice* SkCanvas::init(SkBaseDevice* device) { |
| 486 fBounder = NULL; | 486 fBounder = NULL; |
| (...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 965 } | 965 } |
| 966 | 966 |
| 967 SkLazyPaint lazy; | 967 SkLazyPaint lazy; |
| 968 if (NULL == paint) { | 968 if (NULL == paint) { |
| 969 paint = lazy.init(); | 969 paint = lazy.init(); |
| 970 } | 970 } |
| 971 | 971 |
| 972 SkDEBUGCODE(bitmap.validate();) | 972 SkDEBUGCODE(bitmap.validate();) |
| 973 CHECK_LOCKCOUNT_BALANCE(bitmap); | 973 CHECK_LOCKCOUNT_BALANCE(bitmap); |
| 974 | 974 |
| 975 LOOPER_BEGIN(*paint, SkDrawFilter::kBitmap_Type) | 975 SkRect storage; |
| 976 const SkRect* bounds = NULL; |
| 977 if (paint && paint->canComputeFastBounds()) { |
| 978 bitmap.getBounds(&storage); |
| 979 matrix.mapRect(&storage); |
| 980 bounds = &paint->computeFastBounds(storage, &storage); |
| 981 } |
| 982 |
| 983 LOOPER_BEGIN(*paint, SkDrawFilter::kBitmap_Type, bounds) |
| 976 | 984 |
| 977 while (iter.next()) { | 985 while (iter.next()) { |
| 978 iter.fDevice->drawBitmap(iter, bitmap, matrix, looper.paint()); | 986 iter.fDevice->drawBitmap(iter, bitmap, matrix, looper.paint()); |
| 979 } | 987 } |
| 980 | 988 |
| 981 LOOPER_END | 989 LOOPER_END |
| 982 } | 990 } |
| 983 | 991 |
| 984 void SkCanvas::internalDrawDevice(SkBaseDevice* srcDev, int x, int y, | 992 void SkCanvas::internalDrawDevice(SkBaseDevice* srcDev, int x, int y, |
| 985 const SkPaint* paint) { | 993 const SkPaint* paint) { |
| (...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1565 } | 1573 } |
| 1566 } | 1574 } |
| 1567 | 1575 |
| 1568 void SkCanvas::drawPaint(const SkPaint& paint) { | 1576 void SkCanvas::drawPaint(const SkPaint& paint) { |
| 1569 this->internalDrawPaint(paint); | 1577 this->internalDrawPaint(paint); |
| 1570 } | 1578 } |
| 1571 | 1579 |
| 1572 void SkCanvas::internalDrawPaint(const SkPaint& paint) { | 1580 void SkCanvas::internalDrawPaint(const SkPaint& paint) { |
| 1573 CHECK_SHADER_NOSETCONTEXT(paint); | 1581 CHECK_SHADER_NOSETCONTEXT(paint); |
| 1574 | 1582 |
| 1575 LOOPER_BEGIN(paint, SkDrawFilter::kPaint_Type) | 1583 LOOPER_BEGIN(paint, SkDrawFilter::kPaint_Type, NULL) |
| 1576 | 1584 |
| 1577 while (iter.next()) { | 1585 while (iter.next()) { |
| 1578 iter.fDevice->drawPaint(iter, looper.paint()); | 1586 iter.fDevice->drawPaint(iter, looper.paint()); |
| 1579 } | 1587 } |
| 1580 | 1588 |
| 1581 LOOPER_END | 1589 LOOPER_END |
| 1582 } | 1590 } |
| 1583 | 1591 |
| 1584 void SkCanvas::drawPoints(PointMode mode, size_t count, const SkPoint pts[], | 1592 void SkCanvas::drawPoints(PointMode mode, size_t count, const SkPoint pts[], |
| 1585 const SkPaint& paint) { | 1593 const SkPaint& paint) { |
| 1586 if ((long)count <= 0) { | 1594 if ((long)count <= 0) { |
| 1587 return; | 1595 return; |
| 1588 } | 1596 } |
| 1589 | 1597 |
| 1590 CHECK_SHADER_NOSETCONTEXT(paint); | 1598 CHECK_SHADER_NOSETCONTEXT(paint); |
| 1591 | 1599 |
| 1600 SkRect r, storage; |
| 1601 const SkRect* bounds = NULL; |
| 1592 if (paint.canComputeFastBounds()) { | 1602 if (paint.canComputeFastBounds()) { |
| 1593 SkRect r; | |
| 1594 // special-case 2 points (common for drawing a single line) | 1603 // special-case 2 points (common for drawing a single line) |
| 1595 if (2 == count) { | 1604 if (2 == count) { |
| 1596 r.set(pts[0], pts[1]); | 1605 r.set(pts[0], pts[1]); |
| 1597 } else { | 1606 } else { |
| 1598 r.set(pts, SkToInt(count)); | 1607 r.set(pts, SkToInt(count)); |
| 1599 } | 1608 } |
| 1600 SkRect storage; | 1609 bounds = &paint.computeFastStrokeBounds(r, &storage); |
| 1601 if (this->quickReject(paint.computeFastStrokeBounds(r, &storage))) { | 1610 if (this->quickReject(*bounds)) { |
| 1602 return; | 1611 return; |
| 1603 } | 1612 } |
| 1604 } | 1613 } |
| 1605 | 1614 |
| 1606 SkASSERT(pts != NULL); | 1615 SkASSERT(pts != NULL); |
| 1607 | 1616 |
| 1608 LOOPER_BEGIN(paint, SkDrawFilter::kPoint_Type) | 1617 LOOPER_BEGIN(paint, SkDrawFilter::kPoint_Type, bounds) |
| 1609 | 1618 |
| 1610 while (iter.next()) { | 1619 while (iter.next()) { |
| 1611 iter.fDevice->drawPoints(iter, mode, count, pts, looper.paint()); | 1620 iter.fDevice->drawPoints(iter, mode, count, pts, looper.paint()); |
| 1612 } | 1621 } |
| 1613 | 1622 |
| 1614 LOOPER_END | 1623 LOOPER_END |
| 1615 } | 1624 } |
| 1616 | 1625 |
| 1617 void SkCanvas::drawRect(const SkRect& r, const SkPaint& paint) { | 1626 void SkCanvas::drawRect(const SkRect& r, const SkPaint& paint) { |
| 1618 CHECK_SHADER_NOSETCONTEXT(paint); | 1627 CHECK_SHADER_NOSETCONTEXT(paint); |
| 1619 | 1628 |
| 1629 SkRect storage; |
| 1630 const SkRect* bounds = NULL; |
| 1620 if (paint.canComputeFastBounds()) { | 1631 if (paint.canComputeFastBounds()) { |
| 1621 SkRect storage; | 1632 bounds = &paint.computeFastBounds(r, &storage); |
| 1622 if (this->quickReject(paint.computeFastBounds(r, &storage))) { | 1633 if (this->quickReject(*bounds)) { |
| 1623 return; | 1634 return; |
| 1624 } | 1635 } |
| 1625 } | 1636 } |
| 1626 | 1637 |
| 1627 LOOPER_BEGIN(paint, SkDrawFilter::kRect_Type) | 1638 LOOPER_BEGIN(paint, SkDrawFilter::kRect_Type, bounds) |
| 1628 | 1639 |
| 1629 while (iter.next()) { | 1640 while (iter.next()) { |
| 1630 iter.fDevice->drawRect(iter, r, looper.paint()); | 1641 iter.fDevice->drawRect(iter, r, looper.paint()); |
| 1631 } | 1642 } |
| 1632 | 1643 |
| 1633 LOOPER_END | 1644 LOOPER_END |
| 1634 } | 1645 } |
| 1635 | 1646 |
| 1636 void SkCanvas::drawOval(const SkRect& oval, const SkPaint& paint) { | 1647 void SkCanvas::drawOval(const SkRect& oval, const SkPaint& paint) { |
| 1637 CHECK_SHADER_NOSETCONTEXT(paint); | 1648 CHECK_SHADER_NOSETCONTEXT(paint); |
| 1638 | 1649 |
| 1650 SkRect storage; |
| 1651 const SkRect* bounds = NULL; |
| 1639 if (paint.canComputeFastBounds()) { | 1652 if (paint.canComputeFastBounds()) { |
| 1640 SkRect storage; | 1653 bounds = &paint.computeFastBounds(oval, &storage); |
| 1641 if (this->quickReject(paint.computeFastBounds(oval, &storage))) { | 1654 if (this->quickReject(*bounds)) { |
| 1642 return; | 1655 return; |
| 1643 } | 1656 } |
| 1644 } | 1657 } |
| 1645 | 1658 |
| 1646 LOOPER_BEGIN(paint, SkDrawFilter::kOval_Type) | 1659 LOOPER_BEGIN(paint, SkDrawFilter::kOval_Type, bounds) |
| 1647 | 1660 |
| 1648 while (iter.next()) { | 1661 while (iter.next()) { |
| 1649 iter.fDevice->drawOval(iter, oval, looper.paint()); | 1662 iter.fDevice->drawOval(iter, oval, looper.paint()); |
| 1650 } | 1663 } |
| 1651 | 1664 |
| 1652 LOOPER_END | 1665 LOOPER_END |
| 1653 } | 1666 } |
| 1654 | 1667 |
| 1655 void SkCanvas::drawRRect(const SkRRect& rrect, const SkPaint& paint) { | 1668 void SkCanvas::drawRRect(const SkRRect& rrect, const SkPaint& paint) { |
| 1656 CHECK_SHADER_NOSETCONTEXT(paint); | 1669 CHECK_SHADER_NOSETCONTEXT(paint); |
| 1657 | 1670 |
| 1671 SkRect storage; |
| 1672 const SkRect* bounds = NULL; |
| 1658 if (paint.canComputeFastBounds()) { | 1673 if (paint.canComputeFastBounds()) { |
| 1659 SkRect storage; | 1674 bounds = &paint.computeFastBounds(rrect.getBounds(), &storage); |
| 1660 if (this->quickReject(paint.computeFastBounds(rrect.getBounds(), &storag
e))) { | 1675 if (this->quickReject(*bounds)) { |
| 1661 return; | 1676 return; |
| 1662 } | 1677 } |
| 1663 } | 1678 } |
| 1664 | 1679 |
| 1665 if (rrect.isRect()) { | 1680 if (rrect.isRect()) { |
| 1666 // call the non-virtual version | 1681 // call the non-virtual version |
| 1667 this->SkCanvas::drawRect(rrect.getBounds(), paint); | 1682 this->SkCanvas::drawRect(rrect.getBounds(), paint); |
| 1668 return; | 1683 return; |
| 1669 } else if (rrect.isOval()) { | 1684 } else if (rrect.isOval()) { |
| 1670 // call the non-virtual version | 1685 // call the non-virtual version |
| 1671 this->SkCanvas::drawOval(rrect.getBounds(), paint); | 1686 this->SkCanvas::drawOval(rrect.getBounds(), paint); |
| 1672 return; | 1687 return; |
| 1673 } | 1688 } |
| 1674 | 1689 |
| 1675 LOOPER_BEGIN(paint, SkDrawFilter::kRRect_Type) | 1690 LOOPER_BEGIN(paint, SkDrawFilter::kRRect_Type, bounds) |
| 1676 | 1691 |
| 1677 while (iter.next()) { | 1692 while (iter.next()) { |
| 1678 iter.fDevice->drawRRect(iter, rrect, looper.paint()); | 1693 iter.fDevice->drawRRect(iter, rrect, looper.paint()); |
| 1679 } | 1694 } |
| 1680 | 1695 |
| 1681 LOOPER_END | 1696 LOOPER_END |
| 1682 } | 1697 } |
| 1683 | 1698 |
| 1684 | 1699 |
| 1685 void SkCanvas::drawPath(const SkPath& path, const SkPaint& paint) { | 1700 void SkCanvas::drawPath(const SkPath& path, const SkPaint& paint) { |
| 1686 CHECK_SHADER_NOSETCONTEXT(paint); | 1701 CHECK_SHADER_NOSETCONTEXT(paint); |
| 1687 | 1702 |
| 1688 if (!path.isFinite()) { | 1703 if (!path.isFinite()) { |
| 1689 return; | 1704 return; |
| 1690 } | 1705 } |
| 1691 | 1706 |
| 1707 SkRect storage; |
| 1708 const SkRect* bounds = NULL; |
| 1692 if (!path.isInverseFillType() && paint.canComputeFastBounds()) { | 1709 if (!path.isInverseFillType() && paint.canComputeFastBounds()) { |
| 1693 SkRect storage; | 1710 const SkRect& pathBounds = path.getBounds(); |
| 1694 const SkRect& bounds = path.getBounds(); | 1711 bounds = &paint.computeFastBounds(pathBounds, &storage); |
| 1695 if (this->quickReject(paint.computeFastBounds(bounds, &storage))) { | 1712 if (this->quickReject(*bounds)) { |
| 1696 return; | 1713 return; |
| 1697 } | 1714 } |
| 1698 } | 1715 } |
| 1699 if (path.isEmpty()) { | 1716 if (path.isEmpty()) { |
| 1700 if (path.isInverseFillType()) { | 1717 if (path.isInverseFillType()) { |
| 1701 this->internalDrawPaint(paint); | 1718 this->internalDrawPaint(paint); |
| 1702 } | 1719 } |
| 1703 return; | 1720 return; |
| 1704 } | 1721 } |
| 1705 | 1722 |
| 1706 LOOPER_BEGIN(paint, SkDrawFilter::kPath_Type) | 1723 LOOPER_BEGIN(paint, SkDrawFilter::kPath_Type, bounds) |
| 1707 | 1724 |
| 1708 while (iter.next()) { | 1725 while (iter.next()) { |
| 1709 iter.fDevice->drawPath(iter, path, looper.paint()); | 1726 iter.fDevice->drawPath(iter, path, looper.paint()); |
| 1710 } | 1727 } |
| 1711 | 1728 |
| 1712 LOOPER_END | 1729 LOOPER_END |
| 1713 } | 1730 } |
| 1714 | 1731 |
| 1715 void SkCanvas::drawBitmap(const SkBitmap& bitmap, SkScalar x, SkScalar y, | 1732 void SkCanvas::drawBitmap(const SkBitmap& bitmap, SkScalar x, SkScalar y, |
| 1716 const SkPaint* paint) { | 1733 const SkPaint* paint) { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 1738 // this one is non-virtual, so it can be called safely by other canvas apis | 1755 // this one is non-virtual, so it can be called safely by other canvas apis |
| 1739 void SkCanvas::internalDrawBitmapRect(const SkBitmap& bitmap, const SkRect* src, | 1756 void SkCanvas::internalDrawBitmapRect(const SkBitmap& bitmap, const SkRect* src, |
| 1740 const SkRect& dst, const SkPaint* paint, | 1757 const SkRect& dst, const SkPaint* paint, |
| 1741 DrawBitmapRectFlags flags) { | 1758 DrawBitmapRectFlags flags) { |
| 1742 if (bitmap.width() == 0 || bitmap.height() == 0 || dst.isEmpty()) { | 1759 if (bitmap.width() == 0 || bitmap.height() == 0 || dst.isEmpty()) { |
| 1743 return; | 1760 return; |
| 1744 } | 1761 } |
| 1745 | 1762 |
| 1746 CHECK_LOCKCOUNT_BALANCE(bitmap); | 1763 CHECK_LOCKCOUNT_BALANCE(bitmap); |
| 1747 | 1764 |
| 1765 SkRect storage; |
| 1766 const SkRect* bounds = &dst; |
| 1748 if (NULL == paint || paint->canComputeFastBounds()) { | 1767 if (NULL == paint || paint->canComputeFastBounds()) { |
| 1749 SkRect storage; | |
| 1750 const SkRect* bounds = &dst; | |
| 1751 if (paint) { | 1768 if (paint) { |
| 1752 bounds = &paint->computeFastBounds(dst, &storage); | 1769 bounds = &paint->computeFastBounds(dst, &storage); |
| 1753 } | 1770 } |
| 1754 if (this->quickReject(*bounds)) { | 1771 if (this->quickReject(*bounds)) { |
| 1755 return; | 1772 return; |
| 1756 } | 1773 } |
| 1757 } | 1774 } |
| 1758 | 1775 |
| 1759 SkLazyPaint lazy; | 1776 SkLazyPaint lazy; |
| 1760 if (NULL == paint) { | 1777 if (NULL == paint) { |
| 1761 paint = lazy.init(); | 1778 paint = lazy.init(); |
| 1762 } | 1779 } |
| 1763 | 1780 |
| 1764 LOOPER_BEGIN(*paint, SkDrawFilter::kBitmap_Type) | 1781 LOOPER_BEGIN(*paint, SkDrawFilter::kBitmap_Type, bounds) |
| 1765 | 1782 |
| 1766 while (iter.next()) { | 1783 while (iter.next()) { |
| 1767 iter.fDevice->drawBitmapRect(iter, bitmap, src, dst, looper.paint(), fla
gs); | 1784 iter.fDevice->drawBitmapRect(iter, bitmap, src, dst, looper.paint(), fla
gs); |
| 1768 } | 1785 } |
| 1769 | 1786 |
| 1770 LOOPER_END | 1787 LOOPER_END |
| 1771 } | 1788 } |
| 1772 | 1789 |
| 1773 void SkCanvas::drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect* src, | 1790 void SkCanvas::drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect* src, |
| 1774 const SkRect& dst, const SkPaint* paint, | 1791 const SkRect& dst, const SkPaint* paint, |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1948 r.fBottom = offset + height; | 1965 r.fBottom = offset + height; |
| 1949 DrawRect(draw, paint, r, textSize); | 1966 DrawRect(draw, paint, r, textSize); |
| 1950 } | 1967 } |
| 1951 } | 1968 } |
| 1952 } | 1969 } |
| 1953 | 1970 |
| 1954 void SkCanvas::drawText(const void* text, size_t byteLength, | 1971 void SkCanvas::drawText(const void* text, size_t byteLength, |
| 1955 SkScalar x, SkScalar y, const SkPaint& paint) { | 1972 SkScalar x, SkScalar y, const SkPaint& paint) { |
| 1956 CHECK_SHADER_NOSETCONTEXT(paint); | 1973 CHECK_SHADER_NOSETCONTEXT(paint); |
| 1957 | 1974 |
| 1958 LOOPER_BEGIN(paint, SkDrawFilter::kText_Type) | 1975 LOOPER_BEGIN(paint, SkDrawFilter::kText_Type, NULL) |
| 1959 | 1976 |
| 1960 while (iter.next()) { | 1977 while (iter.next()) { |
| 1961 SkDeviceFilteredPaint dfp(iter.fDevice, looper.paint()); | 1978 SkDeviceFilteredPaint dfp(iter.fDevice, looper.paint()); |
| 1962 iter.fDevice->drawText(iter, text, byteLength, x, y, dfp.paint()); | 1979 iter.fDevice->drawText(iter, text, byteLength, x, y, dfp.paint()); |
| 1963 DrawTextDecorations(iter, dfp.paint(), | 1980 DrawTextDecorations(iter, dfp.paint(), |
| 1964 static_cast<const char*>(text), byteLength, x, y); | 1981 static_cast<const char*>(text), byteLength, x, y); |
| 1965 } | 1982 } |
| 1966 | 1983 |
| 1967 LOOPER_END | 1984 LOOPER_END |
| 1968 } | 1985 } |
| 1969 | 1986 |
| 1970 void SkCanvas::drawPosText(const void* text, size_t byteLength, | 1987 void SkCanvas::drawPosText(const void* text, size_t byteLength, |
| 1971 const SkPoint pos[], const SkPaint& paint) { | 1988 const SkPoint pos[], const SkPaint& paint) { |
| 1972 CHECK_SHADER_NOSETCONTEXT(paint); | 1989 CHECK_SHADER_NOSETCONTEXT(paint); |
| 1973 | 1990 |
| 1974 LOOPER_BEGIN(paint, SkDrawFilter::kText_Type) | 1991 LOOPER_BEGIN(paint, SkDrawFilter::kText_Type, NULL) |
| 1975 | 1992 |
| 1976 while (iter.next()) { | 1993 while (iter.next()) { |
| 1977 SkDeviceFilteredPaint dfp(iter.fDevice, looper.paint()); | 1994 SkDeviceFilteredPaint dfp(iter.fDevice, looper.paint()); |
| 1978 iter.fDevice->drawPosText(iter, text, byteLength, &pos->fX, 0, 2, | 1995 iter.fDevice->drawPosText(iter, text, byteLength, &pos->fX, 0, 2, |
| 1979 dfp.paint()); | 1996 dfp.paint()); |
| 1980 } | 1997 } |
| 1981 | 1998 |
| 1982 LOOPER_END | 1999 LOOPER_END |
| 1983 } | 2000 } |
| 1984 | 2001 |
| 1985 void SkCanvas::drawPosTextH(const void* text, size_t byteLength, | 2002 void SkCanvas::drawPosTextH(const void* text, size_t byteLength, |
| 1986 const SkScalar xpos[], SkScalar constY, | 2003 const SkScalar xpos[], SkScalar constY, |
| 1987 const SkPaint& paint) { | 2004 const SkPaint& paint) { |
| 1988 CHECK_SHADER_NOSETCONTEXT(paint); | 2005 CHECK_SHADER_NOSETCONTEXT(paint); |
| 1989 | 2006 |
| 1990 LOOPER_BEGIN(paint, SkDrawFilter::kText_Type) | 2007 LOOPER_BEGIN(paint, SkDrawFilter::kText_Type, NULL) |
| 1991 | 2008 |
| 1992 while (iter.next()) { | 2009 while (iter.next()) { |
| 1993 SkDeviceFilteredPaint dfp(iter.fDevice, looper.paint()); | 2010 SkDeviceFilteredPaint dfp(iter.fDevice, looper.paint()); |
| 1994 iter.fDevice->drawPosText(iter, text, byteLength, xpos, constY, 1, | 2011 iter.fDevice->drawPosText(iter, text, byteLength, xpos, constY, 1, |
| 1995 dfp.paint()); | 2012 dfp.paint()); |
| 1996 } | 2013 } |
| 1997 | 2014 |
| 1998 LOOPER_END | 2015 LOOPER_END |
| 1999 } | 2016 } |
| 2000 | 2017 |
| 2001 void SkCanvas::drawTextOnPath(const void* text, size_t byteLength, | 2018 void SkCanvas::drawTextOnPath(const void* text, size_t byteLength, |
| 2002 const SkPath& path, const SkMatrix* matrix, | 2019 const SkPath& path, const SkMatrix* matrix, |
| 2003 const SkPaint& paint) { | 2020 const SkPaint& paint) { |
| 2004 CHECK_SHADER_NOSETCONTEXT(paint); | 2021 CHECK_SHADER_NOSETCONTEXT(paint); |
| 2005 | 2022 |
| 2006 LOOPER_BEGIN(paint, SkDrawFilter::kText_Type) | 2023 LOOPER_BEGIN(paint, SkDrawFilter::kText_Type, NULL) |
| 2007 | 2024 |
| 2008 while (iter.next()) { | 2025 while (iter.next()) { |
| 2009 iter.fDevice->drawTextOnPath(iter, text, byteLength, path, | 2026 iter.fDevice->drawTextOnPath(iter, text, byteLength, path, |
| 2010 matrix, looper.paint()); | 2027 matrix, looper.paint()); |
| 2011 } | 2028 } |
| 2012 | 2029 |
| 2013 LOOPER_END | 2030 LOOPER_END |
| 2014 } | 2031 } |
| 2015 | 2032 |
| 2016 void SkCanvas::drawVertices(VertexMode vmode, int vertexCount, | 2033 void SkCanvas::drawVertices(VertexMode vmode, int vertexCount, |
| 2017 const SkPoint verts[], const SkPoint texs[], | 2034 const SkPoint verts[], const SkPoint texs[], |
| 2018 const SkColor colors[], SkXfermode* xmode, | 2035 const SkColor colors[], SkXfermode* xmode, |
| 2019 const uint16_t indices[], int indexCount, | 2036 const uint16_t indices[], int indexCount, |
| 2020 const SkPaint& paint) { | 2037 const SkPaint& paint) { |
| 2021 CHECK_SHADER_NOSETCONTEXT(paint); | 2038 CHECK_SHADER_NOSETCONTEXT(paint); |
| 2022 | 2039 |
| 2023 LOOPER_BEGIN(paint, SkDrawFilter::kPath_Type) | 2040 LOOPER_BEGIN(paint, SkDrawFilter::kPath_Type, NULL) |
| 2024 | 2041 |
| 2025 while (iter.next()) { | 2042 while (iter.next()) { |
| 2026 iter.fDevice->drawVertices(iter, vmode, vertexCount, verts, texs, | 2043 iter.fDevice->drawVertices(iter, vmode, vertexCount, verts, texs, |
| 2027 colors, xmode, indices, indexCount, | 2044 colors, xmode, indices, indexCount, |
| 2028 looper.paint()); | 2045 looper.paint()); |
| 2029 } | 2046 } |
| 2030 | 2047 |
| 2031 LOOPER_END | 2048 LOOPER_END |
| 2032 } | 2049 } |
| 2033 | 2050 |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2188 return *paint; | 2205 return *paint; |
| 2189 } | 2206 } |
| 2190 | 2207 |
| 2191 const SkRegion& SkCanvas::LayerIter::clip() const { return fImpl->getClip(); } | 2208 const SkRegion& SkCanvas::LayerIter::clip() const { return fImpl->getClip(); } |
| 2192 int SkCanvas::LayerIter::x() const { return fImpl->getX(); } | 2209 int SkCanvas::LayerIter::x() const { return fImpl->getX(); } |
| 2193 int SkCanvas::LayerIter::y() const { return fImpl->getY(); } | 2210 int SkCanvas::LayerIter::y() const { return fImpl->getY(); } |
| 2194 | 2211 |
| 2195 /////////////////////////////////////////////////////////////////////////////// | 2212 /////////////////////////////////////////////////////////////////////////////// |
| 2196 | 2213 |
| 2197 SkCanvas::ClipVisitor::~ClipVisitor() { } | 2214 SkCanvas::ClipVisitor::~ClipVisitor() { } |
| OLD | NEW |