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

Side by Side Diff: src/core/SkCanvas.cpp

Issue 761773003: Make skia trace category disabled by default. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years 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 | « no previous file | no next file » | 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 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 1225 matching lines...) Expand 10 before | Expand all | Expand 10 after
1236 } 1236 }
1237 } else { 1237 } else {
1238 dstDev->drawDevice(iter, srcDev, pos.x(), pos.y(), *paint); 1238 dstDev->drawDevice(iter, srcDev, pos.x(), pos.y(), *paint);
1239 } 1239 }
1240 } 1240 }
1241 LOOPER_END 1241 LOOPER_END
1242 } 1242 }
1243 1243
1244 void SkCanvas::drawSprite(const SkBitmap& bitmap, int x, int y, 1244 void SkCanvas::drawSprite(const SkBitmap& bitmap, int x, int y,
1245 const SkPaint* paint) { 1245 const SkPaint* paint) {
1246 TRACE_EVENT0("skia", "SkCanvas::drawSprite()"); 1246 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawSprite()");
1247 if (bitmap.drawsNothing()) { 1247 if (bitmap.drawsNothing()) {
1248 return; 1248 return;
1249 } 1249 }
1250 SkDEBUGCODE(bitmap.validate();) 1250 SkDEBUGCODE(bitmap.validate();)
1251 1251
1252 SkPaint tmp; 1252 SkPaint tmp;
1253 if (NULL == paint) { 1253 if (NULL == paint) {
1254 paint = &tmp; 1254 paint = &tmp;
1255 } 1255 }
1256 1256
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
1676 } 1676 }
1677 } 1677 }
1678 #endif 1678 #endif
1679 1679
1680 return NULL; 1680 return NULL;
1681 1681
1682 } 1682 }
1683 1683
1684 void SkCanvas::drawDRRect(const SkRRect& outer, const SkRRect& inner, 1684 void SkCanvas::drawDRRect(const SkRRect& outer, const SkRRect& inner,
1685 const SkPaint& paint) { 1685 const SkPaint& paint) {
1686 TRACE_EVENT0("skia", "SkCanvas::drawDRRect()"); 1686 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawDRRect()");
1687 if (outer.isEmpty()) { 1687 if (outer.isEmpty()) {
1688 return; 1688 return;
1689 } 1689 }
1690 if (inner.isEmpty()) { 1690 if (inner.isEmpty()) {
1691 this->drawRRect(outer, paint); 1691 this->drawRRect(outer, paint);
1692 return; 1692 return;
1693 } 1693 }
1694 1694
1695 // We don't have this method (yet), but technically this is what we should 1695 // We don't have this method (yet), but technically this is what we should
1696 // be able to assert... 1696 // be able to assert...
(...skipping 17 matching lines...) Expand all
1714 } 1714 }
1715 } 1715 }
1716 1716
1717 void SkCanvas::onDiscard() { 1717 void SkCanvas::onDiscard() {
1718 if (fSurfaceBase) { 1718 if (fSurfaceBase) {
1719 fSurfaceBase->aboutToDraw(SkSurface::kDiscard_ContentChangeMode); 1719 fSurfaceBase->aboutToDraw(SkSurface::kDiscard_ContentChangeMode);
1720 } 1720 }
1721 } 1721 }
1722 1722
1723 void SkCanvas::drawPaint(const SkPaint& paint) { 1723 void SkCanvas::drawPaint(const SkPaint& paint) {
1724 TRACE_EVENT0("skia", "SkCanvas::drawPaint()"); 1724 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawPaint()");
1725 this->internalDrawPaint(paint); 1725 this->internalDrawPaint(paint);
1726 } 1726 }
1727 1727
1728 void SkCanvas::internalDrawPaint(const SkPaint& paint) { 1728 void SkCanvas::internalDrawPaint(const SkPaint& paint) {
1729 LOOPER_BEGIN(paint, SkDrawFilter::kPaint_Type, NULL) 1729 LOOPER_BEGIN(paint, SkDrawFilter::kPaint_Type, NULL)
1730 1730
1731 while (iter.next()) { 1731 while (iter.next()) {
1732 iter.fDevice->drawPaint(iter, looper.paint()); 1732 iter.fDevice->drawPaint(iter, looper.paint());
1733 } 1733 }
1734 1734
1735 LOOPER_END 1735 LOOPER_END
1736 } 1736 }
1737 1737
1738 void SkCanvas::drawPoints(PointMode mode, size_t count, const SkPoint pts[], 1738 void SkCanvas::drawPoints(PointMode mode, size_t count, const SkPoint pts[],
1739 const SkPaint& paint) { 1739 const SkPaint& paint) {
1740 TRACE_EVENT1("skia", "SkCanvas::drawPoints()", "count", static_cast<uint64_t >(count)); 1740 TRACE_EVENT1("disabled-by-default-skia", "SkCanvas::drawPoints()", "count", static_cast<uint64_t>(count));
1741 if ((long)count <= 0) { 1741 if ((long)count <= 0) {
1742 return; 1742 return;
1743 } 1743 }
1744 1744
1745 SkRect r, storage; 1745 SkRect r, storage;
1746 const SkRect* bounds = NULL; 1746 const SkRect* bounds = NULL;
1747 if (paint.canComputeFastBounds()) { 1747 if (paint.canComputeFastBounds()) {
1748 // special-case 2 points (common for drawing a single line) 1748 // special-case 2 points (common for drawing a single line)
1749 if (2 == count) { 1749 if (2 == count) {
1750 r.set(pts[0], pts[1]); 1750 r.set(pts[0], pts[1]);
(...skipping 11 matching lines...) Expand all
1762 LOOPER_BEGIN(paint, SkDrawFilter::kPoint_Type, bounds) 1762 LOOPER_BEGIN(paint, SkDrawFilter::kPoint_Type, bounds)
1763 1763
1764 while (iter.next()) { 1764 while (iter.next()) {
1765 iter.fDevice->drawPoints(iter, mode, count, pts, looper.paint()); 1765 iter.fDevice->drawPoints(iter, mode, count, pts, looper.paint());
1766 } 1766 }
1767 1767
1768 LOOPER_END 1768 LOOPER_END
1769 } 1769 }
1770 1770
1771 void SkCanvas::drawRect(const SkRect& r, const SkPaint& paint) { 1771 void SkCanvas::drawRect(const SkRect& r, const SkPaint& paint) {
1772 TRACE_EVENT0("skia", "SkCanvas::drawRect()"); 1772 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawRect()");
1773 SkRect storage; 1773 SkRect storage;
1774 const SkRect* bounds = NULL; 1774 const SkRect* bounds = NULL;
1775 if (paint.canComputeFastBounds()) { 1775 if (paint.canComputeFastBounds()) {
1776 bounds = &paint.computeFastBounds(r, &storage); 1776 bounds = &paint.computeFastBounds(r, &storage);
1777 if (this->quickReject(*bounds)) { 1777 if (this->quickReject(*bounds)) {
1778 return; 1778 return;
1779 } 1779 }
1780 } 1780 }
1781 1781
1782 LOOPER_BEGIN(paint, SkDrawFilter::kRect_Type, bounds) 1782 LOOPER_BEGIN(paint, SkDrawFilter::kRect_Type, bounds)
1783 1783
1784 while (iter.next()) { 1784 while (iter.next()) {
1785 iter.fDevice->drawRect(iter, r, looper.paint()); 1785 iter.fDevice->drawRect(iter, r, looper.paint());
1786 } 1786 }
1787 1787
1788 LOOPER_END 1788 LOOPER_END
1789 } 1789 }
1790 1790
1791 void SkCanvas::drawOval(const SkRect& oval, const SkPaint& paint) { 1791 void SkCanvas::drawOval(const SkRect& oval, const SkPaint& paint) {
1792 TRACE_EVENT0("skia", "SkCanvas::drawOval()"); 1792 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawOval()");
1793 SkRect storage; 1793 SkRect storage;
1794 const SkRect* bounds = NULL; 1794 const SkRect* bounds = NULL;
1795 if (paint.canComputeFastBounds()) { 1795 if (paint.canComputeFastBounds()) {
1796 bounds = &paint.computeFastBounds(oval, &storage); 1796 bounds = &paint.computeFastBounds(oval, &storage);
1797 if (this->quickReject(*bounds)) { 1797 if (this->quickReject(*bounds)) {
1798 return; 1798 return;
1799 } 1799 }
1800 } 1800 }
1801 1801
1802 LOOPER_BEGIN(paint, SkDrawFilter::kOval_Type, bounds) 1802 LOOPER_BEGIN(paint, SkDrawFilter::kOval_Type, bounds)
1803 1803
1804 while (iter.next()) { 1804 while (iter.next()) {
1805 iter.fDevice->drawOval(iter, oval, looper.paint()); 1805 iter.fDevice->drawOval(iter, oval, looper.paint());
1806 } 1806 }
1807 1807
1808 LOOPER_END 1808 LOOPER_END
1809 } 1809 }
1810 1810
1811 void SkCanvas::drawRRect(const SkRRect& rrect, const SkPaint& paint) { 1811 void SkCanvas::drawRRect(const SkRRect& rrect, const SkPaint& paint) {
1812 TRACE_EVENT0("skia", "SkCanvas::drawRRect()"); 1812 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawRRect()");
1813 SkRect storage; 1813 SkRect storage;
1814 const SkRect* bounds = NULL; 1814 const SkRect* bounds = NULL;
1815 if (paint.canComputeFastBounds()) { 1815 if (paint.canComputeFastBounds()) {
1816 bounds = &paint.computeFastBounds(rrect.getBounds(), &storage); 1816 bounds = &paint.computeFastBounds(rrect.getBounds(), &storage);
1817 if (this->quickReject(*bounds)) { 1817 if (this->quickReject(*bounds)) {
1818 return; 1818 return;
1819 } 1819 }
1820 } 1820 }
1821 1821
1822 if (rrect.isRect()) { 1822 if (rrect.isRect()) {
(...skipping 29 matching lines...) Expand all
1852 LOOPER_BEGIN(paint, SkDrawFilter::kRRect_Type, bounds) 1852 LOOPER_BEGIN(paint, SkDrawFilter::kRRect_Type, bounds)
1853 1853
1854 while (iter.next()) { 1854 while (iter.next()) {
1855 iter.fDevice->drawDRRect(iter, outer, inner, looper.paint()); 1855 iter.fDevice->drawDRRect(iter, outer, inner, looper.paint());
1856 } 1856 }
1857 1857
1858 LOOPER_END 1858 LOOPER_END
1859 } 1859 }
1860 1860
1861 void SkCanvas::drawPath(const SkPath& path, const SkPaint& paint) { 1861 void SkCanvas::drawPath(const SkPath& path, const SkPaint& paint) {
1862 TRACE_EVENT0("skia", "SkCanvas::drawPath()"); 1862 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawPath()");
1863 if (!path.isFinite()) { 1863 if (!path.isFinite()) {
1864 return; 1864 return;
1865 } 1865 }
1866 1866
1867 SkRect storage; 1867 SkRect storage;
1868 const SkRect* bounds = NULL; 1868 const SkRect* bounds = NULL;
1869 if (!path.isInverseFillType() && paint.canComputeFastBounds()) { 1869 if (!path.isInverseFillType() && paint.canComputeFastBounds()) {
1870 const SkRect& pathBounds = path.getBounds(); 1870 const SkRect& pathBounds = path.getBounds();
1871 bounds = &paint.computeFastBounds(pathBounds, &storage); 1871 bounds = &paint.computeFastBounds(pathBounds, &storage);
1872 if (this->quickReject(*bounds)) { 1872 if (this->quickReject(*bounds)) {
(...skipping 13 matching lines...) Expand all
1886 1886
1887 while (iter.next()) { 1887 while (iter.next()) {
1888 iter.fDevice->drawPath(iter, path, looper.paint()); 1888 iter.fDevice->drawPath(iter, path, looper.paint());
1889 } 1889 }
1890 1890
1891 LOOPER_END 1891 LOOPER_END
1892 } 1892 }
1893 1893
1894 void SkCanvas::drawImage(const SkImage* image, SkScalar left, SkScalar top, 1894 void SkCanvas::drawImage(const SkImage* image, SkScalar left, SkScalar top,
1895 const SkPaint* paint) { 1895 const SkPaint* paint) {
1896 TRACE_EVENT0("skia", "SkCanvas::drawImage()"); 1896 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawImage()");
1897 image->draw(this, left, top, paint); 1897 image->draw(this, left, top, paint);
1898 } 1898 }
1899 1899
1900 void SkCanvas::drawImageRect(const SkImage* image, const SkRect* src, 1900 void SkCanvas::drawImageRect(const SkImage* image, const SkRect* src,
1901 const SkRect& dst, 1901 const SkRect& dst,
1902 const SkPaint* paint) { 1902 const SkPaint* paint) {
1903 TRACE_EVENT0("skia", "SkCanvas::drawImageRect()"); 1903 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawImageRect()");
1904 image->drawRect(this, src, dst, paint); 1904 image->drawRect(this, src, dst, paint);
1905 } 1905 }
1906 1906
1907 void SkCanvas::drawBitmap(const SkBitmap& bitmap, SkScalar x, SkScalar y, 1907 void SkCanvas::drawBitmap(const SkBitmap& bitmap, SkScalar x, SkScalar y,
1908 const SkPaint* paint) { 1908 const SkPaint* paint) {
1909 TRACE_EVENT0("skia", "SkCanvas::drawBitmap()"); 1909 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawBitmap()");
1910 SkDEBUGCODE(bitmap.validate();) 1910 SkDEBUGCODE(bitmap.validate();)
1911 1911
1912 if (NULL == paint || paint->canComputeFastBounds()) { 1912 if (NULL == paint || paint->canComputeFastBounds()) {
1913 SkRect bounds = { 1913 SkRect bounds = {
1914 x, y, 1914 x, y,
1915 x + SkIntToScalar(bitmap.width()), 1915 x + SkIntToScalar(bitmap.width()),
1916 y + SkIntToScalar(bitmap.height()) 1916 y + SkIntToScalar(bitmap.height())
1917 }; 1917 };
1918 if (paint) { 1918 if (paint) {
1919 (void)paint->computeFastBounds(bounds, &bounds); 1919 (void)paint->computeFastBounds(bounds, &bounds);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
1957 while (iter.next()) { 1957 while (iter.next()) {
1958 iter.fDevice->drawBitmapRect(iter, bitmap, src, dst, looper.paint(), fla gs); 1958 iter.fDevice->drawBitmapRect(iter, bitmap, src, dst, looper.paint(), fla gs);
1959 } 1959 }
1960 1960
1961 LOOPER_END 1961 LOOPER_END
1962 } 1962 }
1963 1963
1964 void SkCanvas::drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect* src, 1964 void SkCanvas::drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect* src,
1965 const SkRect& dst, const SkPaint* paint, 1965 const SkRect& dst, const SkPaint* paint,
1966 DrawBitmapRectFlags flags) { 1966 DrawBitmapRectFlags flags) {
1967 TRACE_EVENT0("skia", "SkCanvas::drawBitmapRectToRect()"); 1967 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawBitmapRectToRect()") ;
1968 SkDEBUGCODE(bitmap.validate();) 1968 SkDEBUGCODE(bitmap.validate();)
1969 this->internalDrawBitmapRect(bitmap, src, dst, paint, flags); 1969 this->internalDrawBitmapRect(bitmap, src, dst, paint, flags);
1970 } 1970 }
1971 1971
1972 void SkCanvas::drawBitmapMatrix(const SkBitmap& bitmap, const SkMatrix& matrix, 1972 void SkCanvas::drawBitmapMatrix(const SkBitmap& bitmap, const SkMatrix& matrix,
1973 const SkPaint* paint) { 1973 const SkPaint* paint) {
1974 TRACE_EVENT0("skia", "SkCanvas::drawBitmapMatrix()"); 1974 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawBitmapMatrix()");
1975 SkDEBUGCODE(bitmap.validate();) 1975 SkDEBUGCODE(bitmap.validate();)
1976 this->internalDrawBitmap(bitmap, matrix, paint); 1976 this->internalDrawBitmap(bitmap, matrix, paint);
1977 } 1977 }
1978 1978
1979 void SkCanvas::internalDrawBitmapNine(const SkBitmap& bitmap, 1979 void SkCanvas::internalDrawBitmapNine(const SkBitmap& bitmap,
1980 const SkIRect& center, const SkRect& dst, 1980 const SkIRect& center, const SkRect& dst,
1981 const SkPaint* paint) { 1981 const SkPaint* paint) {
1982 if (bitmap.drawsNothing()) { 1982 if (bitmap.drawsNothing()) {
1983 return; 1983 return;
1984 } 1984 }
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
2041 d.fLeft = dstX[x]; 2041 d.fLeft = dstX[x];
2042 d.fRight = dstX[x+1]; 2042 d.fRight = dstX[x+1];
2043 this->internalDrawBitmapRect(bitmap, &s, d, paint, 2043 this->internalDrawBitmapRect(bitmap, &s, d, paint,
2044 kNone_DrawBitmapRectFlag); 2044 kNone_DrawBitmapRectFlag);
2045 } 2045 }
2046 } 2046 }
2047 } 2047 }
2048 2048
2049 void SkCanvas::drawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, 2049 void SkCanvas::drawBitmapNine(const SkBitmap& bitmap, const SkIRect& center,
2050 const SkRect& dst, const SkPaint* paint) { 2050 const SkRect& dst, const SkPaint* paint) {
2051 TRACE_EVENT0("skia", "SkCanvas::drawBitmapNine()"); 2051 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawBitmapNine()");
2052 SkDEBUGCODE(bitmap.validate();) 2052 SkDEBUGCODE(bitmap.validate();)
2053 2053
2054 // Need a device entry-point, so gpu can use a mesh 2054 // Need a device entry-point, so gpu can use a mesh
2055 this->internalDrawBitmapNine(bitmap, center, dst, paint); 2055 this->internalDrawBitmapNine(bitmap, center, dst, paint);
2056 } 2056 }
2057 2057
2058 class SkDeviceFilteredPaint { 2058 class SkDeviceFilteredPaint {
2059 public: 2059 public:
2060 SkDeviceFilteredPaint(SkBaseDevice* device, const SkPaint& paint) { 2060 SkDeviceFilteredPaint(SkBaseDevice* device, const SkPaint& paint) {
2061 uint32_t filteredFlags = device->filterTextFlags(paint); 2061 uint32_t filteredFlags = device->filterTextFlags(paint);
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
2221 SkDeviceFilteredPaint dfp(iter.fDevice, looper.paint()); 2221 SkDeviceFilteredPaint dfp(iter.fDevice, looper.paint());
2222 iter.fDevice->drawTextBlob(iter, blob, x, y, dfp.paint()); 2222 iter.fDevice->drawTextBlob(iter, blob, x, y, dfp.paint());
2223 } 2223 }
2224 2224
2225 LOOPER_END 2225 LOOPER_END
2226 } 2226 }
2227 2227
2228 // These will become non-virtual, so they always call the (virtual) onDraw... me thod 2228 // These will become non-virtual, so they always call the (virtual) onDraw... me thod
2229 void SkCanvas::drawText(const void* text, size_t byteLength, SkScalar x, SkScala r y, 2229 void SkCanvas::drawText(const void* text, size_t byteLength, SkScalar x, SkScala r y,
2230 const SkPaint& paint) { 2230 const SkPaint& paint) {
2231 TRACE_EVENT0("skia", "SkCanvas::drawText()"); 2231 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawText()");
2232 this->onDrawText(text, byteLength, x, y, paint); 2232 this->onDrawText(text, byteLength, x, y, paint);
2233 } 2233 }
2234 void SkCanvas::drawPosText(const void* text, size_t byteLength, const SkPoint po s[], 2234 void SkCanvas::drawPosText(const void* text, size_t byteLength, const SkPoint po s[],
2235 const SkPaint& paint) { 2235 const SkPaint& paint) {
2236 TRACE_EVENT0("skia", "SkCanvas::drawPosText()"); 2236 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawPosText()");
2237 this->onDrawPosText(text, byteLength, pos, paint); 2237 this->onDrawPosText(text, byteLength, pos, paint);
2238 } 2238 }
2239 void SkCanvas::drawPosTextH(const void* text, size_t byteLength, const SkScalar xpos[], 2239 void SkCanvas::drawPosTextH(const void* text, size_t byteLength, const SkScalar xpos[],
2240 SkScalar constY, const SkPaint& paint) { 2240 SkScalar constY, const SkPaint& paint) {
2241 TRACE_EVENT0("skia", "SkCanvas::drawPosTextH()"); 2241 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawPosTextH()");
2242 this->onDrawPosTextH(text, byteLength, xpos, constY, paint); 2242 this->onDrawPosTextH(text, byteLength, xpos, constY, paint);
2243 } 2243 }
2244 void SkCanvas::drawTextOnPath(const void* text, size_t byteLength, const SkPath& path, 2244 void SkCanvas::drawTextOnPath(const void* text, size_t byteLength, const SkPath& path,
2245 const SkMatrix* matrix, const SkPaint& paint) { 2245 const SkMatrix* matrix, const SkPaint& paint) {
2246 TRACE_EVENT0("skia", "SkCanvas::drawTextOnPath()"); 2246 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawTextOnPath()");
2247 this->onDrawTextOnPath(text, byteLength, path, matrix, paint); 2247 this->onDrawTextOnPath(text, byteLength, path, matrix, paint);
2248 } 2248 }
2249 void SkCanvas::drawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y, 2249 void SkCanvas::drawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y,
2250 const SkPaint& paint) { 2250 const SkPaint& paint) {
2251 TRACE_EVENT0("skia", "SkCanvas::drawTextBlob()"); 2251 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawTextBlob()");
2252 if (blob) { 2252 if (blob) {
2253 this->onDrawTextBlob(blob, x, y, paint); 2253 this->onDrawTextBlob(blob, x, y, paint);
2254 } 2254 }
2255 } 2255 }
2256 2256
2257 void SkCanvas::drawVertices(VertexMode vmode, int vertexCount, 2257 void SkCanvas::drawVertices(VertexMode vmode, int vertexCount,
2258 const SkPoint verts[], const SkPoint texs[], 2258 const SkPoint verts[], const SkPoint texs[],
2259 const SkColor colors[], SkXfermode* xmode, 2259 const SkColor colors[], SkXfermode* xmode,
2260 const uint16_t indices[], int indexCount, 2260 const uint16_t indices[], int indexCount,
2261 const SkPaint& paint) { 2261 const SkPaint& paint) {
2262 TRACE_EVENT0("skia", "SkCanvas::drawVertices()"); 2262 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawVertices()");
2263 LOOPER_BEGIN(paint, SkDrawFilter::kPath_Type, NULL) 2263 LOOPER_BEGIN(paint, SkDrawFilter::kPath_Type, NULL)
2264 2264
2265 while (iter.next()) { 2265 while (iter.next()) {
2266 iter.fDevice->drawVertices(iter, vmode, vertexCount, verts, texs, 2266 iter.fDevice->drawVertices(iter, vmode, vertexCount, verts, texs,
2267 colors, xmode, indices, indexCount, 2267 colors, xmode, indices, indexCount,
2268 looper.paint()); 2268 looper.paint());
2269 } 2269 }
2270 2270
2271 LOOPER_END 2271 LOOPER_END
2272 } 2272 }
2273 2273
2274 void SkCanvas::drawPatch(const SkPoint cubics[12], const SkColor colors[4], 2274 void SkCanvas::drawPatch(const SkPoint cubics[12], const SkColor colors[4],
2275 const SkPoint texCoords[4], SkXfermode* xmode, const Sk Paint& paint) { 2275 const SkPoint texCoords[4], SkXfermode* xmode, const Sk Paint& paint) {
2276 TRACE_EVENT0("skia", "SkCanvas::drawPatch()"); 2276 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawPatch()");
2277 if (NULL == cubics) { 2277 if (NULL == cubics) {
2278 return; 2278 return;
2279 } 2279 }
2280 2280
2281 // Since a patch is always within the convex hull of the control points, we discard it when its 2281 // Since a patch is always within the convex hull of the control points, we discard it when its
2282 // bounding rectangle is completely outside the current clip. 2282 // bounding rectangle is completely outside the current clip.
2283 SkRect bounds; 2283 SkRect bounds;
2284 bounds.set(cubics, SkPatchUtils::kNumCtrlPts); 2284 bounds.set(cubics, SkPatchUtils::kNumCtrlPts);
2285 if (this->quickReject(bounds)) { 2285 if (this->quickReject(bounds)) {
2286 return; 2286 return;
(...skipping 24 matching lines...) Expand all
2311 dr->draw(this); 2311 dr->draw(this);
2312 } 2312 }
2313 2313
2314 ////////////////////////////////////////////////////////////////////////////// 2314 //////////////////////////////////////////////////////////////////////////////
2315 // These methods are NOT virtual, and therefore must call back into virtual 2315 // These methods are NOT virtual, and therefore must call back into virtual
2316 // methods, rather than actually drawing themselves. 2316 // methods, rather than actually drawing themselves.
2317 ////////////////////////////////////////////////////////////////////////////// 2317 //////////////////////////////////////////////////////////////////////////////
2318 2318
2319 void SkCanvas::drawARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b, 2319 void SkCanvas::drawARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b,
2320 SkXfermode::Mode mode) { 2320 SkXfermode::Mode mode) {
2321 TRACE_EVENT0("skia", "SkCanvas::drawARGB()"); 2321 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawARGB()");
2322 SkPaint paint; 2322 SkPaint paint;
2323 2323
2324 paint.setARGB(a, r, g, b); 2324 paint.setARGB(a, r, g, b);
2325 if (SkXfermode::kSrcOver_Mode != mode) { 2325 if (SkXfermode::kSrcOver_Mode != mode) {
2326 paint.setXfermodeMode(mode); 2326 paint.setXfermodeMode(mode);
2327 } 2327 }
2328 this->drawPaint(paint); 2328 this->drawPaint(paint);
2329 } 2329 }
2330 2330
2331 void SkCanvas::drawColor(SkColor c, SkXfermode::Mode mode) { 2331 void SkCanvas::drawColor(SkColor c, SkXfermode::Mode mode) {
2332 TRACE_EVENT0("skia", "SkCanvas::drawColor()"); 2332 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawColor()");
2333 SkPaint paint; 2333 SkPaint paint;
2334 2334
2335 paint.setColor(c); 2335 paint.setColor(c);
2336 if (SkXfermode::kSrcOver_Mode != mode) { 2336 if (SkXfermode::kSrcOver_Mode != mode) {
2337 paint.setXfermodeMode(mode); 2337 paint.setXfermodeMode(mode);
2338 } 2338 }
2339 this->drawPaint(paint); 2339 this->drawPaint(paint);
2340 } 2340 }
2341 2341
2342 void SkCanvas::drawPoint(SkScalar x, SkScalar y, const SkPaint& paint) { 2342 void SkCanvas::drawPoint(SkScalar x, SkScalar y, const SkPaint& paint) {
2343 TRACE_EVENT0("skia", "SkCanvas::drawPoint(SkPaint)"); 2343 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawPoint(SkPaint)");
2344 SkPoint pt; 2344 SkPoint pt;
2345 2345
2346 pt.set(x, y); 2346 pt.set(x, y);
2347 this->drawPoints(kPoints_PointMode, 1, &pt, paint); 2347 this->drawPoints(kPoints_PointMode, 1, &pt, paint);
2348 } 2348 }
2349 2349
2350 void SkCanvas::drawPoint(SkScalar x, SkScalar y, SkColor color) { 2350 void SkCanvas::drawPoint(SkScalar x, SkScalar y, SkColor color) {
2351 TRACE_EVENT0("skia", "SkCanvas::drawPoint(SkColor)"); 2351 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawPoint(SkColor)");
2352 SkPoint pt; 2352 SkPoint pt;
2353 SkPaint paint; 2353 SkPaint paint;
2354 2354
2355 pt.set(x, y); 2355 pt.set(x, y);
2356 paint.setColor(color); 2356 paint.setColor(color);
2357 this->drawPoints(kPoints_PointMode, 1, &pt, paint); 2357 this->drawPoints(kPoints_PointMode, 1, &pt, paint);
2358 } 2358 }
2359 2359
2360 void SkCanvas::drawLine(SkScalar x0, SkScalar y0, SkScalar x1, SkScalar y1, 2360 void SkCanvas::drawLine(SkScalar x0, SkScalar y0, SkScalar x1, SkScalar y1,
2361 const SkPaint& paint) { 2361 const SkPaint& paint) {
2362 TRACE_EVENT0("skia", "SkCanvas::drawLine()"); 2362 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawLine()");
2363 SkPoint pts[2]; 2363 SkPoint pts[2];
2364 2364
2365 pts[0].set(x0, y0); 2365 pts[0].set(x0, y0);
2366 pts[1].set(x1, y1); 2366 pts[1].set(x1, y1);
2367 this->drawPoints(kLines_PointMode, 2, pts, paint); 2367 this->drawPoints(kLines_PointMode, 2, pts, paint);
2368 } 2368 }
2369 2369
2370 void SkCanvas::drawRectCoords(SkScalar left, SkScalar top, 2370 void SkCanvas::drawRectCoords(SkScalar left, SkScalar top,
2371 SkScalar right, SkScalar bottom, 2371 SkScalar right, SkScalar bottom,
2372 const SkPaint& paint) { 2372 const SkPaint& paint) {
2373 TRACE_EVENT0("skia", "SkCanvas::drawRectCoords()"); 2373 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawRectCoords()");
2374 SkRect r; 2374 SkRect r;
2375 2375
2376 r.set(left, top, right, bottom); 2376 r.set(left, top, right, bottom);
2377 this->drawRect(r, paint); 2377 this->drawRect(r, paint);
2378 } 2378 }
2379 2379
2380 void SkCanvas::drawCircle(SkScalar cx, SkScalar cy, SkScalar radius, 2380 void SkCanvas::drawCircle(SkScalar cx, SkScalar cy, SkScalar radius,
2381 const SkPaint& paint) { 2381 const SkPaint& paint) {
2382 TRACE_EVENT0("skia", "SkCanvas::drawCircle()"); 2382 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawCircle()");
2383 if (radius < 0) { 2383 if (radius < 0) {
2384 radius = 0; 2384 radius = 0;
2385 } 2385 }
2386 2386
2387 SkRect r; 2387 SkRect r;
2388 r.set(cx - radius, cy - radius, cx + radius, cy + radius); 2388 r.set(cx - radius, cy - radius, cx + radius, cy + radius);
2389 this->drawOval(r, paint); 2389 this->drawOval(r, paint);
2390 } 2390 }
2391 2391
2392 void SkCanvas::drawRoundRect(const SkRect& r, SkScalar rx, SkScalar ry, 2392 void SkCanvas::drawRoundRect(const SkRect& r, SkScalar rx, SkScalar ry,
2393 const SkPaint& paint) { 2393 const SkPaint& paint) {
2394 TRACE_EVENT0("skia", "SkCanvas::drawRoundRect()"); 2394 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawRoundRect()");
2395 if (rx > 0 && ry > 0) { 2395 if (rx > 0 && ry > 0) {
2396 if (paint.canComputeFastBounds()) { 2396 if (paint.canComputeFastBounds()) {
2397 SkRect storage; 2397 SkRect storage;
2398 if (this->quickReject(paint.computeFastBounds(r, &storage))) { 2398 if (this->quickReject(paint.computeFastBounds(r, &storage))) {
2399 return; 2399 return;
2400 } 2400 }
2401 } 2401 }
2402 SkRRect rrect; 2402 SkRRect rrect;
2403 rrect.setRectXY(r, rx, ry); 2403 rrect.setRectXY(r, rx, ry);
2404 this->drawRRect(rrect, paint); 2404 this->drawRRect(rrect, paint);
2405 } else { 2405 } else {
2406 this->drawRect(r, paint); 2406 this->drawRect(r, paint);
2407 } 2407 }
2408 } 2408 }
2409 2409
2410 void SkCanvas::drawArc(const SkRect& oval, SkScalar startAngle, 2410 void SkCanvas::drawArc(const SkRect& oval, SkScalar startAngle,
2411 SkScalar sweepAngle, bool useCenter, 2411 SkScalar sweepAngle, bool useCenter,
2412 const SkPaint& paint) { 2412 const SkPaint& paint) {
2413 TRACE_EVENT0("skia", "SkCanvas::drawArc()"); 2413 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawArc()");
2414 if (SkScalarAbs(sweepAngle) >= SkIntToScalar(360)) { 2414 if (SkScalarAbs(sweepAngle) >= SkIntToScalar(360)) {
2415 this->drawOval(oval, paint); 2415 this->drawOval(oval, paint);
2416 } else { 2416 } else {
2417 SkPath path; 2417 SkPath path;
2418 if (useCenter) { 2418 if (useCenter) {
2419 path.moveTo(oval.centerX(), oval.centerY()); 2419 path.moveTo(oval.centerX(), oval.centerY());
2420 } 2420 }
2421 path.arcTo(oval, startAngle, sweepAngle, !useCenter); 2421 path.arcTo(oval, startAngle, sweepAngle, !useCenter);
2422 if (useCenter) { 2422 if (useCenter) {
2423 path.close(); 2423 path.close();
2424 } 2424 }
2425 this->drawPath(path, paint); 2425 this->drawPath(path, paint);
2426 } 2426 }
2427 } 2427 }
2428 2428
2429 void SkCanvas::drawTextOnPathHV(const void* text, size_t byteLength, 2429 void SkCanvas::drawTextOnPathHV(const void* text, size_t byteLength,
2430 const SkPath& path, SkScalar hOffset, 2430 const SkPath& path, SkScalar hOffset,
2431 SkScalar vOffset, const SkPaint& paint) { 2431 SkScalar vOffset, const SkPaint& paint) {
2432 TRACE_EVENT0("skia", "SkCanvas::drawTextOnPathHV()"); 2432 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawTextOnPathHV()");
2433 SkMatrix matrix; 2433 SkMatrix matrix;
2434 2434
2435 matrix.setTranslate(hOffset, vOffset); 2435 matrix.setTranslate(hOffset, vOffset);
2436 this->drawTextOnPath(text, byteLength, path, &matrix, paint); 2436 this->drawTextOnPath(text, byteLength, path, &matrix, paint);
2437 } 2437 }
2438 2438
2439 /////////////////////////////////////////////////////////////////////////////// 2439 ///////////////////////////////////////////////////////////////////////////////
2440 void SkCanvas::drawPicture(const SkPicture* picture) { 2440 void SkCanvas::drawPicture(const SkPicture* picture) {
2441 TRACE_EVENT0("skia", "SkCanvas::drawPicture()"); 2441 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawPicture()");
2442 if (picture) { 2442 if (picture) {
2443 this->onDrawPicture(picture, NULL, NULL); 2443 this->onDrawPicture(picture, NULL, NULL);
2444 } 2444 }
2445 } 2445 }
2446 2446
2447 void SkCanvas::drawPicture(const SkPicture* picture, const SkMatrix* matrix, con st SkPaint* paint) { 2447 void SkCanvas::drawPicture(const SkPicture* picture, const SkMatrix* matrix, con st SkPaint* paint) {
2448 TRACE_EVENT0("skia", "SkCanvas::drawPicture(SkMatrix, SkPaint)"); 2448 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawPicture(SkMatrix, Sk Paint)");
2449 if (picture) { 2449 if (picture) {
2450 if (matrix && matrix->isIdentity()) { 2450 if (matrix && matrix->isIdentity()) {
2451 matrix = NULL; 2451 matrix = NULL;
2452 } 2452 }
2453 this->onDrawPicture(picture, matrix, paint); 2453 this->onDrawPicture(picture, matrix, paint);
2454 } 2454 }
2455 } 2455 }
2456 2456
2457 void SkCanvas::onDrawPicture(const SkPicture* picture, const SkMatrix* matrix, 2457 void SkCanvas::onDrawPicture(const SkPicture* picture, const SkMatrix* matrix,
2458 const SkPaint* paint) { 2458 const SkPaint* paint) {
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
2584 } 2584 }
2585 2585
2586 if (matrix) { 2586 if (matrix) {
2587 canvas->concat(*matrix); 2587 canvas->concat(*matrix);
2588 } 2588 }
2589 } 2589 }
2590 2590
2591 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { 2591 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() {
2592 fCanvas->restoreToCount(fSaveCount); 2592 fCanvas->restoreToCount(fSaveCount);
2593 } 2593 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698