| 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, size_t byteL
ength, | 1716 void SkGpuDevice::drawPosText(const SkDraw& draw, const void* text, |
| 1717 const SkScalar pos[], int scalarsPerPos, | 1717 size_t byteLength, const SkScalar pos[], |
| 1718 const SkPoint& offset, const SkPaint& paint) { | 1718 SkScalar constY, int scalarsPerPos, |
| 1719 const SkPaint& paint) { |
| 1719 GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice::drawPosText", fContext); | 1720 GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice::drawPosText", fContext); |
| 1720 CHECK_SHOULD_DRAW(draw, false); | 1721 CHECK_SHOULD_DRAW(draw, false); |
| 1721 | 1722 |
| 1722 if (fMainTextContext->canDraw(paint)) { | 1723 if (fMainTextContext->canDraw(paint)) { |
| 1723 GrPaint grPaint; | 1724 GrPaint grPaint; |
| 1724 SkPaint2GrPaintShader(this->context(), paint, true, &grPaint); | 1725 SkPaint2GrPaintShader(this->context(), paint, true, &grPaint); |
| 1725 | 1726 |
| 1726 SkDEBUGCODE(this->validate();) | 1727 SkDEBUGCODE(this->validate();) |
| 1727 | 1728 |
| 1728 fMainTextContext->drawPosText(grPaint, paint, (const char *)text, byteLe
ngth, pos, | 1729 fMainTextContext->drawPosText(grPaint, paint, (const char *)text, byteLe
ngth, pos, |
| 1729 scalarsPerPos, offset); | 1730 constY, scalarsPerPos); |
| 1730 } else if (fFallbackTextContext && fFallbackTextContext->canDraw(paint)) { | 1731 } else if (fFallbackTextContext && fFallbackTextContext->canDraw(paint)) { |
| 1731 GrPaint grPaint; | 1732 GrPaint grPaint; |
| 1732 SkPaint2GrPaintShader(this->context(), paint, true, &grPaint); | 1733 SkPaint2GrPaintShader(this->context(), paint, true, &grPaint); |
| 1733 | 1734 |
| 1734 SkDEBUGCODE(this->validate();) | 1735 SkDEBUGCODE(this->validate();) |
| 1735 | 1736 |
| 1736 fFallbackTextContext->drawPosText(grPaint, paint, (const char *)text, by
teLength, pos, | 1737 fFallbackTextContext->drawPosText(grPaint, paint, (const char *)text, by
teLength, pos, |
| 1737 scalarsPerPos, offset); | 1738 constY, scalarsPerPos); |
| 1738 } else { | 1739 } else { |
| 1739 draw.drawPosText_asPaths((const char*)text, byteLength, pos, scalarsPerP
os, offset, paint); | 1740 draw.drawPosText_asPaths((const char*)text, byteLength, pos, constY, |
| 1741 scalarsPerPos, paint); |
| 1740 } | 1742 } |
| 1741 } | 1743 } |
| 1742 | 1744 |
| 1743 void SkGpuDevice::drawTextOnPath(const SkDraw& draw, const void* text, | 1745 void SkGpuDevice::drawTextOnPath(const SkDraw& draw, const void* text, |
| 1744 size_t len, const SkPath& path, | 1746 size_t len, const SkPath& path, |
| 1745 const SkMatrix* m, const SkPaint& paint) { | 1747 const SkMatrix* m, const SkPaint& paint) { |
| 1746 CHECK_SHOULD_DRAW(draw, false); | 1748 CHECK_SHOULD_DRAW(draw, false); |
| 1747 | 1749 |
| 1748 SkASSERT(draw.fDevice == this); | 1750 SkASSERT(draw.fDevice == this); |
| 1749 draw.drawTextOnPath((const char*)text, len, path, m, paint); | 1751 draw.drawTextOnPath((const char*)text, len, path, m, paint); |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1879 GrLayerHoister::UnlockLayers(fContext->getLayerCache(), picture); | 1881 GrLayerHoister::UnlockLayers(fContext->getLayerCache(), picture); |
| 1880 | 1882 |
| 1881 return true; | 1883 return true; |
| 1882 } | 1884 } |
| 1883 | 1885 |
| 1884 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() { | 1886 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() { |
| 1885 // We always return a transient cache, so it is freed after each | 1887 // We always return a transient cache, so it is freed after each |
| 1886 // filter traversal. | 1888 // filter traversal. |
| 1887 return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize); | 1889 return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize); |
| 1888 } | 1890 } |
| OLD | NEW |