| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "SkGpuDevice.h" | 8 #include "SkGpuDevice.h" |
| 9 | 9 |
| 10 #include "effects/GrBicubicEffect.h" | 10 #include "effects/GrBicubicEffect.h" |
| (...skipping 1695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1706 | 1706 |
| 1707 SkDEBUGCODE(this->validate();) | 1707 SkDEBUGCODE(this->validate();) |
| 1708 | 1708 |
| 1709 fFallbackTextContext->drawText(grPaint, paint, (const char *)text, byteL
ength, x, y); | 1709 fFallbackTextContext->drawText(grPaint, paint, (const char *)text, byteL
ength, x, y); |
| 1710 } else { | 1710 } else { |
| 1711 // this guy will just call our drawPath() | 1711 // this guy will just call our drawPath() |
| 1712 draw.drawText_asPaths((const char*)text, byteLength, x, y, paint); | 1712 draw.drawText_asPaths((const char*)text, byteLength, x, y, paint); |
| 1713 } | 1713 } |
| 1714 } | 1714 } |
| 1715 | 1715 |
| 1716 void SkGpuDevice::drawPosText(const SkDraw& draw, const void* text, | 1716 void SkGpuDevice::drawPosText(const SkDraw& draw, const void* text, size_t byteL
ength, |
| 1717 size_t byteLength, const SkScalar pos[], | 1717 const SkScalar pos[], int scalarsPerPos, |
| 1718 SkScalar constY, int scalarsPerPos, | 1718 const SkPoint& offset, const SkPaint& paint) { |
| 1719 const SkPaint& paint) { | |
| 1720 GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice::drawPosText", fContext); | 1719 GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice::drawPosText", fContext); |
| 1721 CHECK_SHOULD_DRAW(draw, false); | 1720 CHECK_SHOULD_DRAW(draw, false); |
| 1722 | 1721 |
| 1723 if (fMainTextContext->canDraw(paint)) { | 1722 if (fMainTextContext->canDraw(paint)) { |
| 1724 GrPaint grPaint; | 1723 GrPaint grPaint; |
| 1725 SkPaint2GrPaintShader(this->context(), paint, true, &grPaint); | 1724 SkPaint2GrPaintShader(this->context(), paint, true, &grPaint); |
| 1726 | 1725 |
| 1727 SkDEBUGCODE(this->validate();) | 1726 SkDEBUGCODE(this->validate();) |
| 1728 | 1727 |
| 1729 fMainTextContext->drawPosText(grPaint, paint, (const char *)text, byteLe
ngth, pos, | 1728 fMainTextContext->drawPosText(grPaint, paint, (const char *)text, byteLe
ngth, pos, |
| 1730 constY, scalarsPerPos); | 1729 scalarsPerPos, offset); |
| 1731 } else if (fFallbackTextContext && fFallbackTextContext->canDraw(paint)) { | 1730 } else if (fFallbackTextContext && fFallbackTextContext->canDraw(paint)) { |
| 1732 GrPaint grPaint; | 1731 GrPaint grPaint; |
| 1733 SkPaint2GrPaintShader(this->context(), paint, true, &grPaint); | 1732 SkPaint2GrPaintShader(this->context(), paint, true, &grPaint); |
| 1734 | 1733 |
| 1735 SkDEBUGCODE(this->validate();) | 1734 SkDEBUGCODE(this->validate();) |
| 1736 | 1735 |
| 1737 fFallbackTextContext->drawPosText(grPaint, paint, (const char *)text, by
teLength, pos, | 1736 fFallbackTextContext->drawPosText(grPaint, paint, (const char *)text, by
teLength, pos, |
| 1738 constY, scalarsPerPos); | 1737 scalarsPerPos, offset); |
| 1739 } else { | 1738 } else { |
| 1740 draw.drawPosText_asPaths((const char*)text, byteLength, pos, constY, | 1739 draw.drawPosText_asPaths((const char*)text, byteLength, pos, scalarsPerP
os, offset, paint); |
| 1741 scalarsPerPos, paint); | |
| 1742 } | 1740 } |
| 1743 } | 1741 } |
| 1744 | 1742 |
| 1745 void SkGpuDevice::drawTextOnPath(const SkDraw& draw, const void* text, | 1743 void SkGpuDevice::drawTextOnPath(const SkDraw& draw, const void* text, |
| 1746 size_t len, const SkPath& path, | 1744 size_t len, const SkPath& path, |
| 1747 const SkMatrix* m, const SkPaint& paint) { | 1745 const SkMatrix* m, const SkPaint& paint) { |
| 1748 CHECK_SHOULD_DRAW(draw, false); | 1746 CHECK_SHOULD_DRAW(draw, false); |
| 1749 | 1747 |
| 1750 SkASSERT(draw.fDevice == this); | 1748 SkASSERT(draw.fDevice == this); |
| 1751 draw.drawTextOnPath((const char*)text, len, path, m, paint); | 1749 draw.drawTextOnPath((const char*)text, len, path, m, paint); |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1881 GrLayerHoister::UnlockLayers(fContext->getLayerCache(), picture); | 1879 GrLayerHoister::UnlockLayers(fContext->getLayerCache(), picture); |
| 1882 | 1880 |
| 1883 return true; | 1881 return true; |
| 1884 } | 1882 } |
| 1885 | 1883 |
| 1886 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() { | 1884 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() { |
| 1887 // We always return a transient cache, so it is freed after each | 1885 // We always return a transient cache, so it is freed after each |
| 1888 // filter traversal. | 1886 // filter traversal. |
| 1889 return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize); | 1887 return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize); |
| 1890 } | 1888 } |
| OLD | NEW |