| 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/GrTextureDomainEffect.h" | 10 #include "effects/GrTextureDomainEffect.h" |
| (...skipping 1737 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1748 if (fContext->getMatrix().hasPerspective()) { | 1748 if (fContext->getMatrix().hasPerspective()) { |
| 1749 // this guy will just call our drawPath() | 1749 // this guy will just call our drawPath() |
| 1750 draw.drawText((const char*)text, byteLength, x, y, paint); | 1750 draw.drawText((const char*)text, byteLength, x, y, paint); |
| 1751 } else { | 1751 } else { |
| 1752 SkDraw myDraw(draw); | 1752 SkDraw myDraw(draw); |
| 1753 | 1753 |
| 1754 GrPaint grPaint; | 1754 GrPaint grPaint; |
| 1755 if (!skPaint2GrPaintShader(this, paint, true, &grPaint)) { | 1755 if (!skPaint2GrPaintShader(this, paint, true, &grPaint)) { |
| 1756 return; | 1756 return; |
| 1757 } | 1757 } |
| 1758 GrBitmapTextContext context(fContext, grPaint); | 1758 |
| 1759 GrColor paintColorNoPreMultAlpha = SkColor2GrColorNoPremultiply(paint.ge
tColor()); |
| 1760 GrBitmapTextContext context(fContext, grPaint, paintColorNoPreMultAlpha)
; |
| 1759 myDraw.fProcs = this->initDrawForText(&context); | 1761 myDraw.fProcs = this->initDrawForText(&context); |
| 1760 this->INHERITED::drawText(myDraw, text, byteLength, x, y, paint); | 1762 this->INHERITED::drawText(myDraw, text, byteLength, x, y, paint); |
| 1761 } | 1763 } |
| 1762 } | 1764 } |
| 1763 | 1765 |
| 1764 void SkGpuDevice::drawPosText(const SkDraw& draw, const void* text, | 1766 void SkGpuDevice::drawPosText(const SkDraw& draw, const void* text, |
| 1765 size_t byteLength, const SkScalar pos[], | 1767 size_t byteLength, const SkScalar pos[], |
| 1766 SkScalar constY, int scalarsPerPos, | 1768 SkScalar constY, int scalarsPerPos, |
| 1767 const SkPaint& paint) { | 1769 const SkPaint& paint) { |
| 1768 CHECK_SHOULD_DRAW(draw, false); | 1770 CHECK_SHOULD_DRAW(draw, false); |
| 1769 | 1771 |
| 1770 if (fContext->getMatrix().hasPerspective()) { | 1772 if (fContext->getMatrix().hasPerspective()) { |
| 1771 // this guy will just call our drawPath() | 1773 // this guy will just call our drawPath() |
| 1772 draw.drawPosText((const char*)text, byteLength, pos, constY, | 1774 draw.drawPosText((const char*)text, byteLength, pos, constY, |
| 1773 scalarsPerPos, paint); | 1775 scalarsPerPos, paint); |
| 1774 } else { | 1776 } else { |
| 1775 SkDraw myDraw(draw); | 1777 SkDraw myDraw(draw); |
| 1776 | 1778 |
| 1777 GrPaint grPaint; | 1779 GrPaint grPaint; |
| 1778 if (!skPaint2GrPaintShader(this, paint, true, &grPaint)) { | 1780 if (!skPaint2GrPaintShader(this, paint, true, &grPaint)) { |
| 1779 return; | 1781 return; |
| 1780 } | 1782 } |
| 1781 GrBitmapTextContext context(fContext, grPaint); | 1783 GrColor paintColorNoPreMultAlpha = SkColor2GrColorNoPremultiply(paint.ge
tColor()); |
| 1784 GrBitmapTextContext context(fContext, grPaint, paintColorNoPreMultAlpha)
; |
| 1782 myDraw.fProcs = this->initDrawForText(&context); | 1785 myDraw.fProcs = this->initDrawForText(&context); |
| 1783 this->INHERITED::drawPosText(myDraw, text, byteLength, pos, constY, | 1786 this->INHERITED::drawPosText(myDraw, text, byteLength, pos, constY, |
| 1784 scalarsPerPos, paint); | 1787 scalarsPerPos, paint); |
| 1785 } | 1788 } |
| 1786 } | 1789 } |
| 1787 | 1790 |
| 1788 void SkGpuDevice::drawTextOnPath(const SkDraw& draw, const void* text, | 1791 void SkGpuDevice::drawTextOnPath(const SkDraw& draw, const void* text, |
| 1789 size_t len, const SkPath& path, | 1792 size_t len, const SkPath& path, |
| 1790 const SkMatrix* m, const SkPaint& paint) { | 1793 const SkMatrix* m, const SkPaint& paint) { |
| 1791 CHECK_SHOULD_DRAW(draw, false); | 1794 CHECK_SHOULD_DRAW(draw, false); |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1863 GrTexture* texture, | 1866 GrTexture* texture, |
| 1864 bool needClear) | 1867 bool needClear) |
| 1865 : SkBitmapDevice(make_bitmap(context, texture->asRenderTarget())) { | 1868 : SkBitmapDevice(make_bitmap(context, texture->asRenderTarget())) { |
| 1866 | 1869 |
| 1867 SkASSERT(texture && texture->asRenderTarget()); | 1870 SkASSERT(texture && texture->asRenderTarget()); |
| 1868 // This constructor is called from onCreateCompatibleDevice. It has locked t
he RT in the texture | 1871 // This constructor is called from onCreateCompatibleDevice. It has locked t
he RT in the texture |
| 1869 // cache. We pass true for the third argument so that it will get unlocked. | 1872 // cache. We pass true for the third argument so that it will get unlocked. |
| 1870 this->initFromRenderTarget(context, texture->asRenderTarget(), true); | 1873 this->initFromRenderTarget(context, texture->asRenderTarget(), true); |
| 1871 fNeedClear = needClear; | 1874 fNeedClear = needClear; |
| 1872 } | 1875 } |
| OLD | NEW |