| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2008 The Android Open Source Project | 2 * Copyright 2008 The Android Open Source Project |
| 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 "SkCanvasDrawable.h" | 9 #include "SkCanvasDrawable.h" |
| 10 #include "SkCanvasPriv.h" | 10 #include "SkCanvasPriv.h" |
| (...skipping 1178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1189 dstDev->drawSprite(iter, dst, pos.x() + offset.x(), pos.y() + of
fset.y(), | 1189 dstDev->drawSprite(iter, dst, pos.x() + offset.x(), pos.y() + of
fset.y(), |
| 1190 tmpUnfiltered); | 1190 tmpUnfiltered); |
| 1191 } | 1191 } |
| 1192 } else { | 1192 } else { |
| 1193 dstDev->drawDevice(iter, srcDev, pos.x(), pos.y(), *paint); | 1193 dstDev->drawDevice(iter, srcDev, pos.x(), pos.y(), *paint); |
| 1194 } | 1194 } |
| 1195 } | 1195 } |
| 1196 LOOPER_END | 1196 LOOPER_END |
| 1197 } | 1197 } |
| 1198 | 1198 |
| 1199 void SkCanvas::drawSprite(const SkBitmap& bitmap, int x, int y, | 1199 void SkCanvas::onDrawSprite(const SkBitmap& bitmap, int x, int y, const SkPaint*
paint) { |
| 1200 const SkPaint* paint) { | |
| 1201 if (gTreatSpriteAsBitmap) { | 1200 if (gTreatSpriteAsBitmap) { |
| 1202 this->save(); | 1201 this->save(); |
| 1203 this->resetMatrix(); | 1202 this->resetMatrix(); |
| 1204 this->drawBitmap(bitmap, SkIntToScalar(x), SkIntToScalar(y), paint); | 1203 this->drawBitmap(bitmap, SkIntToScalar(x), SkIntToScalar(y), paint); |
| 1205 this->restore(); | 1204 this->restore(); |
| 1206 return; | 1205 return; |
| 1207 } | 1206 } |
| 1208 | 1207 |
| 1209 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawSprite()"); | 1208 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawSprite()"); |
| 1210 if (bitmap.drawsNothing()) { | 1209 if (bitmap.drawsNothing()) { |
| (...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1664 // We don't have this method (yet), but technically this is what we should | 1663 // We don't have this method (yet), but technically this is what we should |
| 1665 // be able to assert... | 1664 // be able to assert... |
| 1666 // SkASSERT(outer.contains(inner)); | 1665 // SkASSERT(outer.contains(inner)); |
| 1667 // | 1666 // |
| 1668 // For now at least check for containment of bounds | 1667 // For now at least check for containment of bounds |
| 1669 SkASSERT(outer.getBounds().contains(inner.getBounds())); | 1668 SkASSERT(outer.getBounds().contains(inner.getBounds())); |
| 1670 | 1669 |
| 1671 this->onDrawDRRect(outer, inner, paint); | 1670 this->onDrawDRRect(outer, inner, paint); |
| 1672 } | 1671 } |
| 1673 | 1672 |
| 1673 // These need to stop being virtual -- clients need to override the onDraw... ve
rsions |
| 1674 |
| 1675 void SkCanvas::drawPaint(const SkPaint& paint) { |
| 1676 this->onDrawPaint(paint); |
| 1677 } |
| 1678 |
| 1679 void SkCanvas::drawRect(const SkRect& r, const SkPaint& paint) { |
| 1680 this->onDrawRect(r, paint); |
| 1681 } |
| 1682 |
| 1683 void SkCanvas::drawOval(const SkRect& r, const SkPaint& paint) { |
| 1684 this->onDrawOval(r, paint); |
| 1685 } |
| 1686 |
| 1687 void SkCanvas::drawRRect(const SkRRect& rrect, const SkPaint& paint) { |
| 1688 this->onDrawRRect(rrect, paint); |
| 1689 } |
| 1690 |
| 1691 void SkCanvas::drawPoints(PointMode mode, size_t count, const SkPoint pts[], con
st SkPaint& paint) { |
| 1692 this->onDrawPoints(mode, count, pts, paint); |
| 1693 } |
| 1694 |
| 1695 void SkCanvas::drawVertices(VertexMode vmode, int vertexCount, const SkPoint ver
tices[], |
| 1696 const SkPoint texs[], const SkColor colors[], SkXfer
mode* xmode, |
| 1697 const uint16_t indices[], int indexCount, const SkPa
int& paint) { |
| 1698 this->onDrawVertices(vmode, vertexCount, vertices, texs, colors, xmode, |
| 1699 indices, indexCount, paint); |
| 1700 } |
| 1701 |
| 1702 void SkCanvas::drawPath(const SkPath& path, const SkPaint& paint) { |
| 1703 this->onDrawPath(path, paint); |
| 1704 } |
| 1705 |
| 1706 void SkCanvas::drawImage(const SkImage* image, SkScalar dx, SkScalar dy, const S
kPaint* paint) { |
| 1707 this->onDrawImage(image, dx, dy, paint); |
| 1708 } |
| 1709 |
| 1710 void SkCanvas::drawImageRect(const SkImage* image, const SkRect* src, const SkRe
ct& dst, |
| 1711 const SkPaint* paint) { |
| 1712 this->onDrawImageRect(image, src, dst, paint); |
| 1713 } |
| 1714 |
| 1715 void SkCanvas::drawBitmap(const SkBitmap& bitmap, SkScalar dx, SkScalar dy, cons
t SkPaint* paint) { |
| 1716 this->onDrawBitmap(bitmap, dx, dy, paint); |
| 1717 } |
| 1718 |
| 1719 void SkCanvas::drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect* src, c
onst SkRect& dst, |
| 1720 const SkPaint* paint, DrawBitmapRectFlags fl
ags) { |
| 1721 this->onDrawBitmapRect(bitmap, src, dst, paint, flags); |
| 1722 } |
| 1723 |
| 1724 void SkCanvas::drawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, con
st SkRect& dst, |
| 1725 const SkPaint* paint) { |
| 1726 this->onDrawBitmapNine(bitmap, center, dst, paint); |
| 1727 } |
| 1728 |
| 1729 void SkCanvas::drawSprite(const SkBitmap& bitmap, int left, int top, const SkPai
nt* paint) { |
| 1730 this->onDrawSprite(bitmap, left, top, paint); |
| 1731 } |
| 1732 |
| 1674 ////////////////////////////////////////////////////////////////////////////// | 1733 ////////////////////////////////////////////////////////////////////////////// |
| 1675 // These are the virtual drawing methods | 1734 // These are the virtual drawing methods |
| 1676 ////////////////////////////////////////////////////////////////////////////// | 1735 ////////////////////////////////////////////////////////////////////////////// |
| 1677 | 1736 |
| 1678 void SkCanvas::onDiscard() { | 1737 void SkCanvas::onDiscard() { |
| 1679 if (fSurfaceBase) { | 1738 if (fSurfaceBase) { |
| 1680 fSurfaceBase->aboutToDraw(SkSurface::kDiscard_ContentChangeMode); | 1739 fSurfaceBase->aboutToDraw(SkSurface::kDiscard_ContentChangeMode); |
| 1681 } | 1740 } |
| 1682 } | 1741 } |
| 1683 | 1742 |
| 1684 void SkCanvas::drawPaint(const SkPaint& paint) { | 1743 void SkCanvas::onDrawPaint(const SkPaint& paint) { |
| 1685 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawPaint()"); | 1744 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawPaint()"); |
| 1686 this->internalDrawPaint(paint); | 1745 this->internalDrawPaint(paint); |
| 1687 } | 1746 } |
| 1688 | 1747 |
| 1689 void SkCanvas::internalDrawPaint(const SkPaint& paint) { | 1748 void SkCanvas::internalDrawPaint(const SkPaint& paint) { |
| 1690 LOOPER_BEGIN(paint, SkDrawFilter::kPaint_Type, NULL) | 1749 LOOPER_BEGIN(paint, SkDrawFilter::kPaint_Type, NULL) |
| 1691 | 1750 |
| 1692 while (iter.next()) { | 1751 while (iter.next()) { |
| 1693 iter.fDevice->drawPaint(iter, looper.paint()); | 1752 iter.fDevice->drawPaint(iter, looper.paint()); |
| 1694 } | 1753 } |
| 1695 | 1754 |
| 1696 LOOPER_END | 1755 LOOPER_END |
| 1697 } | 1756 } |
| 1698 | 1757 |
| 1699 void SkCanvas::drawPoints(PointMode mode, size_t count, const SkPoint pts[], | 1758 void SkCanvas::onDrawPoints(PointMode mode, size_t count, const SkPoint pts[], |
| 1700 const SkPaint& paint) { | 1759 const SkPaint& paint) { |
| 1701 TRACE_EVENT1("disabled-by-default-skia", "SkCanvas::drawPoints()", "count",
static_cast<uint64_t>(count)); | 1760 TRACE_EVENT1("disabled-by-default-skia", "SkCanvas::drawPoints()", "count",
static_cast<uint64_t>(count)); |
| 1702 if ((long)count <= 0) { | 1761 if ((long)count <= 0) { |
| 1703 return; | 1762 return; |
| 1704 } | 1763 } |
| 1705 | 1764 |
| 1706 SkRect r, storage; | 1765 SkRect r, storage; |
| 1707 const SkRect* bounds = NULL; | 1766 const SkRect* bounds = NULL; |
| 1708 if (paint.canComputeFastBounds()) { | 1767 if (paint.canComputeFastBounds()) { |
| 1709 // special-case 2 points (common for drawing a single line) | 1768 // special-case 2 points (common for drawing a single line) |
| 1710 if (2 == count) { | 1769 if (2 == count) { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1722 | 1781 |
| 1723 LOOPER_BEGIN(paint, SkDrawFilter::kPoint_Type, bounds) | 1782 LOOPER_BEGIN(paint, SkDrawFilter::kPoint_Type, bounds) |
| 1724 | 1783 |
| 1725 while (iter.next()) { | 1784 while (iter.next()) { |
| 1726 iter.fDevice->drawPoints(iter, mode, count, pts, looper.paint()); | 1785 iter.fDevice->drawPoints(iter, mode, count, pts, looper.paint()); |
| 1727 } | 1786 } |
| 1728 | 1787 |
| 1729 LOOPER_END | 1788 LOOPER_END |
| 1730 } | 1789 } |
| 1731 | 1790 |
| 1732 void SkCanvas::drawRect(const SkRect& r, const SkPaint& paint) { | 1791 void SkCanvas::onDrawRect(const SkRect& r, const SkPaint& paint) { |
| 1733 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawRect()"); | 1792 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawRect()"); |
| 1734 SkRect storage; | 1793 SkRect storage; |
| 1735 const SkRect* bounds = NULL; | 1794 const SkRect* bounds = NULL; |
| 1736 if (paint.canComputeFastBounds()) { | 1795 if (paint.canComputeFastBounds()) { |
| 1737 bounds = &paint.computeFastBounds(r, &storage); | 1796 bounds = &paint.computeFastBounds(r, &storage); |
| 1738 if (this->quickReject(*bounds)) { | 1797 if (this->quickReject(*bounds)) { |
| 1739 return; | 1798 return; |
| 1740 } | 1799 } |
| 1741 } | 1800 } |
| 1742 | 1801 |
| 1743 LOOPER_BEGIN(paint, SkDrawFilter::kRect_Type, bounds) | 1802 LOOPER_BEGIN(paint, SkDrawFilter::kRect_Type, bounds) |
| 1744 | 1803 |
| 1745 while (iter.next()) { | 1804 while (iter.next()) { |
| 1746 iter.fDevice->drawRect(iter, r, looper.paint()); | 1805 iter.fDevice->drawRect(iter, r, looper.paint()); |
| 1747 } | 1806 } |
| 1748 | 1807 |
| 1749 LOOPER_END | 1808 LOOPER_END |
| 1750 } | 1809 } |
| 1751 | 1810 |
| 1752 void SkCanvas::drawOval(const SkRect& oval, const SkPaint& paint) { | 1811 void SkCanvas::onDrawOval(const SkRect& oval, const SkPaint& paint) { |
| 1753 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawOval()"); | 1812 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawOval()"); |
| 1754 SkRect storage; | 1813 SkRect storage; |
| 1755 const SkRect* bounds = NULL; | 1814 const SkRect* bounds = NULL; |
| 1756 if (paint.canComputeFastBounds()) { | 1815 if (paint.canComputeFastBounds()) { |
| 1757 bounds = &paint.computeFastBounds(oval, &storage); | 1816 bounds = &paint.computeFastBounds(oval, &storage); |
| 1758 if (this->quickReject(*bounds)) { | 1817 if (this->quickReject(*bounds)) { |
| 1759 return; | 1818 return; |
| 1760 } | 1819 } |
| 1761 } | 1820 } |
| 1762 | 1821 |
| 1763 LOOPER_BEGIN(paint, SkDrawFilter::kOval_Type, bounds) | 1822 LOOPER_BEGIN(paint, SkDrawFilter::kOval_Type, bounds) |
| 1764 | 1823 |
| 1765 while (iter.next()) { | 1824 while (iter.next()) { |
| 1766 iter.fDevice->drawOval(iter, oval, looper.paint()); | 1825 iter.fDevice->drawOval(iter, oval, looper.paint()); |
| 1767 } | 1826 } |
| 1768 | 1827 |
| 1769 LOOPER_END | 1828 LOOPER_END |
| 1770 } | 1829 } |
| 1771 | 1830 |
| 1772 void SkCanvas::drawRRect(const SkRRect& rrect, const SkPaint& paint) { | 1831 void SkCanvas::onDrawRRect(const SkRRect& rrect, const SkPaint& paint) { |
| 1773 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawRRect()"); | 1832 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawRRect()"); |
| 1774 SkRect storage; | 1833 SkRect storage; |
| 1775 const SkRect* bounds = NULL; | 1834 const SkRect* bounds = NULL; |
| 1776 if (paint.canComputeFastBounds()) { | 1835 if (paint.canComputeFastBounds()) { |
| 1777 bounds = &paint.computeFastBounds(rrect.getBounds(), &storage); | 1836 bounds = &paint.computeFastBounds(rrect.getBounds(), &storage); |
| 1778 if (this->quickReject(*bounds)) { | 1837 if (this->quickReject(*bounds)) { |
| 1779 return; | 1838 return; |
| 1780 } | 1839 } |
| 1781 } | 1840 } |
| 1782 | 1841 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 1812 | 1871 |
| 1813 LOOPER_BEGIN(paint, SkDrawFilter::kRRect_Type, bounds) | 1872 LOOPER_BEGIN(paint, SkDrawFilter::kRRect_Type, bounds) |
| 1814 | 1873 |
| 1815 while (iter.next()) { | 1874 while (iter.next()) { |
| 1816 iter.fDevice->drawDRRect(iter, outer, inner, looper.paint()); | 1875 iter.fDevice->drawDRRect(iter, outer, inner, looper.paint()); |
| 1817 } | 1876 } |
| 1818 | 1877 |
| 1819 LOOPER_END | 1878 LOOPER_END |
| 1820 } | 1879 } |
| 1821 | 1880 |
| 1822 void SkCanvas::drawPath(const SkPath& path, const SkPaint& paint) { | 1881 void SkCanvas::onDrawPath(const SkPath& path, const SkPaint& paint) { |
| 1823 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawPath()"); | 1882 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawPath()"); |
| 1824 if (!path.isFinite()) { | 1883 if (!path.isFinite()) { |
| 1825 return; | 1884 return; |
| 1826 } | 1885 } |
| 1827 | 1886 |
| 1828 SkRect storage; | 1887 SkRect storage; |
| 1829 const SkRect* bounds = NULL; | 1888 const SkRect* bounds = NULL; |
| 1830 if (!path.isInverseFillType() && paint.canComputeFastBounds()) { | 1889 if (!path.isInverseFillType() && paint.canComputeFastBounds()) { |
| 1831 const SkRect& pathBounds = path.getBounds(); | 1890 const SkRect& pathBounds = path.getBounds(); |
| 1832 bounds = &paint.computeFastBounds(pathBounds, &storage); | 1891 bounds = &paint.computeFastBounds(pathBounds, &storage); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1845 | 1904 |
| 1846 LOOPER_BEGIN(paint, SkDrawFilter::kPath_Type, bounds) | 1905 LOOPER_BEGIN(paint, SkDrawFilter::kPath_Type, bounds) |
| 1847 | 1906 |
| 1848 while (iter.next()) { | 1907 while (iter.next()) { |
| 1849 iter.fDevice->drawPath(iter, path, looper.paint()); | 1908 iter.fDevice->drawPath(iter, path, looper.paint()); |
| 1850 } | 1909 } |
| 1851 | 1910 |
| 1852 LOOPER_END | 1911 LOOPER_END |
| 1853 } | 1912 } |
| 1854 | 1913 |
| 1855 void SkCanvas::drawImage(const SkImage* image, SkScalar left, SkScalar top, | 1914 void SkCanvas::onDrawImage(const SkImage* image, SkScalar dx, SkScalar dy, const
SkPaint* paint) { |
| 1856 const SkPaint* paint) { | |
| 1857 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawImage()"); | 1915 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawImage()"); |
| 1858 image->draw(this, left, top, paint); | 1916 image->draw(this, dx, dy, paint); |
| 1859 } | 1917 } |
| 1860 | 1918 |
| 1861 void SkCanvas::drawImageRect(const SkImage* image, const SkRect* src, | 1919 void SkCanvas::onDrawImageRect(const SkImage* image, const SkRect* src, const Sk
Rect& dst, |
| 1862 const SkRect& dst, | 1920 const SkPaint* paint) { |
| 1863 const SkPaint* paint) { | |
| 1864 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawImageRect()"); | 1921 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawImageRect()"); |
| 1865 image->drawRect(this, src, dst, paint); | 1922 image->drawRect(this, src, dst, paint); |
| 1866 } | 1923 } |
| 1867 | 1924 |
| 1868 void SkCanvas::drawBitmap(const SkBitmap& bitmap, SkScalar x, SkScalar y, | 1925 void SkCanvas::onDrawBitmap(const SkBitmap& bitmap, SkScalar x, SkScalar y, cons
t SkPaint* paint) { |
| 1869 const SkPaint* paint) { | |
| 1870 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawBitmap()"); | 1926 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawBitmap()"); |
| 1871 SkDEBUGCODE(bitmap.validate();) | 1927 SkDEBUGCODE(bitmap.validate();) |
| 1872 | 1928 |
| 1873 if (NULL == paint || paint->canComputeFastBounds()) { | 1929 if (NULL == paint || paint->canComputeFastBounds()) { |
| 1874 SkRect bounds = { | 1930 SkRect bounds = { |
| 1875 x, y, | 1931 x, y, |
| 1876 x + SkIntToScalar(bitmap.width()), | 1932 x + SkIntToScalar(bitmap.width()), |
| 1877 y + SkIntToScalar(bitmap.height()) | 1933 y + SkIntToScalar(bitmap.height()) |
| 1878 }; | 1934 }; |
| 1879 if (paint) { | 1935 if (paint) { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1915 | 1971 |
| 1916 LOOPER_BEGIN(*paint, SkDrawFilter::kBitmap_Type, bounds) | 1972 LOOPER_BEGIN(*paint, SkDrawFilter::kBitmap_Type, bounds) |
| 1917 | 1973 |
| 1918 while (iter.next()) { | 1974 while (iter.next()) { |
| 1919 iter.fDevice->drawBitmapRect(iter, bitmap, src, dst, looper.paint(), fla
gs); | 1975 iter.fDevice->drawBitmapRect(iter, bitmap, src, dst, looper.paint(), fla
gs); |
| 1920 } | 1976 } |
| 1921 | 1977 |
| 1922 LOOPER_END | 1978 LOOPER_END |
| 1923 } | 1979 } |
| 1924 | 1980 |
| 1925 void SkCanvas::drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect* src, | 1981 void SkCanvas::onDrawBitmapRect(const SkBitmap& bitmap, const SkRect* src, const
SkRect& dst, |
| 1926 const SkRect& dst, const SkPaint* paint, | 1982 const SkPaint* paint, DrawBitmapRectFlags flags)
{ |
| 1927 DrawBitmapRectFlags flags) { | |
| 1928 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawBitmapRectToRect()")
; | 1983 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawBitmapRectToRect()")
; |
| 1929 SkDEBUGCODE(bitmap.validate();) | 1984 SkDEBUGCODE(bitmap.validate();) |
| 1930 this->internalDrawBitmapRect(bitmap, src, dst, paint, flags); | 1985 this->internalDrawBitmapRect(bitmap, src, dst, paint, flags); |
| 1931 } | 1986 } |
| 1932 | 1987 |
| 1933 void SkCanvas::internalDrawBitmapNine(const SkBitmap& bitmap, | 1988 void SkCanvas::internalDrawBitmapNine(const SkBitmap& bitmap, |
| 1934 const SkIRect& center, const SkRect& dst, | 1989 const SkIRect& center, const SkRect& dst, |
| 1935 const SkPaint* paint) { | 1990 const SkPaint* paint) { |
| 1936 if (bitmap.drawsNothing()) { | 1991 if (bitmap.drawsNothing()) { |
| 1937 return; | 1992 return; |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1993 s.fLeft = srcX[x]; | 2048 s.fLeft = srcX[x]; |
| 1994 s.fRight = srcX[x+1]; | 2049 s.fRight = srcX[x+1]; |
| 1995 d.fLeft = dstX[x]; | 2050 d.fLeft = dstX[x]; |
| 1996 d.fRight = dstX[x+1]; | 2051 d.fRight = dstX[x+1]; |
| 1997 this->internalDrawBitmapRect(bitmap, &s, d, paint, | 2052 this->internalDrawBitmapRect(bitmap, &s, d, paint, |
| 1998 kNone_DrawBitmapRectFlag); | 2053 kNone_DrawBitmapRectFlag); |
| 1999 } | 2054 } |
| 2000 } | 2055 } |
| 2001 } | 2056 } |
| 2002 | 2057 |
| 2003 void SkCanvas::drawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, | 2058 void SkCanvas::onDrawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, c
onst SkRect& dst, |
| 2004 const SkRect& dst, const SkPaint* paint) { | 2059 const SkPaint* paint) { |
| 2005 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawBitmapNine()"); | 2060 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawBitmapNine()"); |
| 2006 SkDEBUGCODE(bitmap.validate();) | 2061 SkDEBUGCODE(bitmap.validate();) |
| 2007 | 2062 |
| 2008 // Need a device entry-point, so gpu can use a mesh | 2063 // Need a device entry-point, so gpu can use a mesh |
| 2009 this->internalDrawBitmapNine(bitmap, center, dst, paint); | 2064 this->internalDrawBitmapNine(bitmap, center, dst, paint); |
| 2010 } | 2065 } |
| 2011 | 2066 |
| 2012 class SkDeviceFilteredPaint { | 2067 class SkDeviceFilteredPaint { |
| 2013 public: | 2068 public: |
| 2014 SkDeviceFilteredPaint(SkBaseDevice* device, const SkPaint& paint) { | 2069 SkDeviceFilteredPaint(SkBaseDevice* device, const SkPaint& paint) { |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2201 this->onDrawTextOnPath(text, byteLength, path, matrix, paint); | 2256 this->onDrawTextOnPath(text, byteLength, path, matrix, paint); |
| 2202 } | 2257 } |
| 2203 void SkCanvas::drawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y, | 2258 void SkCanvas::drawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y, |
| 2204 const SkPaint& paint) { | 2259 const SkPaint& paint) { |
| 2205 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawTextBlob()"); | 2260 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawTextBlob()"); |
| 2206 if (blob) { | 2261 if (blob) { |
| 2207 this->onDrawTextBlob(blob, x, y, paint); | 2262 this->onDrawTextBlob(blob, x, y, paint); |
| 2208 } | 2263 } |
| 2209 } | 2264 } |
| 2210 | 2265 |
| 2211 void SkCanvas::drawVertices(VertexMode vmode, int vertexCount, | 2266 void SkCanvas::onDrawVertices(VertexMode vmode, int vertexCount, |
| 2212 const SkPoint verts[], const SkPoint texs[], | 2267 const SkPoint verts[], const SkPoint texs[], |
| 2213 const SkColor colors[], SkXfermode* xmode, | 2268 const SkColor colors[], SkXfermode* xmode, |
| 2214 const uint16_t indices[], int indexCount, | 2269 const uint16_t indices[], int indexCount, |
| 2215 const SkPaint& paint) { | 2270 const SkPaint& paint) { |
| 2216 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawVertices()"); | 2271 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawVertices()"); |
| 2217 LOOPER_BEGIN(paint, SkDrawFilter::kPath_Type, NULL) | 2272 LOOPER_BEGIN(paint, SkDrawFilter::kPath_Type, NULL) |
| 2218 | 2273 |
| 2219 while (iter.next()) { | 2274 while (iter.next()) { |
| 2220 iter.fDevice->drawVertices(iter, vmode, vertexCount, verts, texs, | 2275 iter.fDevice->drawVertices(iter, vmode, vertexCount, verts, texs, |
| 2221 colors, xmode, indices, indexCount, | 2276 colors, xmode, indices, indexCount, |
| 2222 looper.paint()); | 2277 looper.paint()); |
| 2223 } | 2278 } |
| 2224 | 2279 |
| 2225 LOOPER_END | 2280 LOOPER_END |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2521 } | 2576 } |
| 2522 | 2577 |
| 2523 if (matrix) { | 2578 if (matrix) { |
| 2524 canvas->concat(*matrix); | 2579 canvas->concat(*matrix); |
| 2525 } | 2580 } |
| 2526 } | 2581 } |
| 2527 | 2582 |
| 2528 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { | 2583 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { |
| 2529 fCanvas->restoreToCount(fSaveCount); | 2584 fCanvas->restoreToCount(fSaveCount); |
| 2530 } | 2585 } |
| OLD | NEW |