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