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" |
11 #include "effects/GrSimpleTextureEffect.h" | 11 #include "effects/GrSimpleTextureEffect.h" |
12 | 12 |
13 #include "GrContext.h" | 13 #include "GrContext.h" |
14 #include "GrTextContext.h" | 14 #include "GrBitmapTextContext.h" |
15 | 15 |
16 #include "SkGrTexturePixelRef.h" | 16 #include "SkGrTexturePixelRef.h" |
17 | 17 |
18 #include "SkColorFilter.h" | 18 #include "SkColorFilter.h" |
19 #include "SkDeviceImageFilterProxy.h" | 19 #include "SkDeviceImageFilterProxy.h" |
20 #include "SkDrawProcs.h" | 20 #include "SkDrawProcs.h" |
21 #include "SkGlyphCache.h" | 21 #include "SkGlyphCache.h" |
22 #include "SkImageFilter.h" | 22 #include "SkImageFilter.h" |
23 #include "SkPathEffect.h" | 23 #include "SkPathEffect.h" |
24 #include "SkRRect.h" | 24 #include "SkRRect.h" |
(...skipping 1711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1736 if (fContext->getMatrix().hasPerspective()) { | 1736 if (fContext->getMatrix().hasPerspective()) { |
1737 // this guy will just call our drawPath() | 1737 // this guy will just call our drawPath() |
1738 draw.drawText((const char*)text, byteLength, x, y, paint); | 1738 draw.drawText((const char*)text, byteLength, x, y, paint); |
1739 } else { | 1739 } else { |
1740 SkDraw myDraw(draw); | 1740 SkDraw myDraw(draw); |
1741 | 1741 |
1742 GrPaint grPaint; | 1742 GrPaint grPaint; |
1743 if (!skPaint2GrPaintShader(this, paint, true, &grPaint)) { | 1743 if (!skPaint2GrPaintShader(this, paint, true, &grPaint)) { |
1744 return; | 1744 return; |
1745 } | 1745 } |
1746 GrTextContext context(fContext, grPaint); | 1746 GrBitmapTextContext context(fContext, grPaint); |
1747 myDraw.fProcs = this->initDrawForText(&context); | 1747 myDraw.fProcs = this->initDrawForText(&context); |
1748 this->INHERITED::drawText(myDraw, text, byteLength, x, y, paint); | 1748 this->INHERITED::drawText(myDraw, text, byteLength, x, y, paint); |
1749 } | 1749 } |
1750 } | 1750 } |
1751 | 1751 |
1752 void SkGpuDevice::drawPosText(const SkDraw& draw, const void* text, | 1752 void SkGpuDevice::drawPosText(const SkDraw& draw, const void* text, |
1753 size_t byteLength, const SkScalar pos[], | 1753 size_t byteLength, const SkScalar pos[], |
1754 SkScalar constY, int scalarsPerPos, | 1754 SkScalar constY, int scalarsPerPos, |
1755 const SkPaint& paint) { | 1755 const SkPaint& paint) { |
1756 CHECK_SHOULD_DRAW(draw, false); | 1756 CHECK_SHOULD_DRAW(draw, false); |
1757 | 1757 |
1758 if (fContext->getMatrix().hasPerspective()) { | 1758 if (fContext->getMatrix().hasPerspective()) { |
1759 // this guy will just call our drawPath() | 1759 // this guy will just call our drawPath() |
1760 draw.drawPosText((const char*)text, byteLength, pos, constY, | 1760 draw.drawPosText((const char*)text, byteLength, pos, constY, |
1761 scalarsPerPos, paint); | 1761 scalarsPerPos, paint); |
1762 } else { | 1762 } else { |
1763 SkDraw myDraw(draw); | 1763 SkDraw myDraw(draw); |
1764 | 1764 |
1765 GrPaint grPaint; | 1765 GrPaint grPaint; |
1766 if (!skPaint2GrPaintShader(this, paint, true, &grPaint)) { | 1766 if (!skPaint2GrPaintShader(this, paint, true, &grPaint)) { |
1767 return; | 1767 return; |
1768 } | 1768 } |
1769 GrTextContext context(fContext, grPaint); | 1769 GrBitmapTextContext context(fContext, grPaint); |
1770 myDraw.fProcs = this->initDrawForText(&context); | 1770 myDraw.fProcs = this->initDrawForText(&context); |
1771 this->INHERITED::drawPosText(myDraw, text, byteLength, pos, constY, | 1771 this->INHERITED::drawPosText(myDraw, text, byteLength, pos, constY, |
1772 scalarsPerPos, paint); | 1772 scalarsPerPos, paint); |
1773 } | 1773 } |
1774 } | 1774 } |
1775 | 1775 |
1776 void SkGpuDevice::drawTextOnPath(const SkDraw& draw, const void* text, | 1776 void SkGpuDevice::drawTextOnPath(const SkDraw& draw, const void* text, |
1777 size_t len, const SkPath& path, | 1777 size_t len, const SkPath& path, |
1778 const SkMatrix* m, const SkPaint& paint) { | 1778 const SkMatrix* m, const SkPaint& paint) { |
1779 CHECK_SHOULD_DRAW(draw, false); | 1779 CHECK_SHOULD_DRAW(draw, false); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1851 GrTexture* texture, | 1851 GrTexture* texture, |
1852 bool needClear) | 1852 bool needClear) |
1853 : SkBitmapDevice(make_bitmap(context, texture->asRenderTarget())) { | 1853 : SkBitmapDevice(make_bitmap(context, texture->asRenderTarget())) { |
1854 | 1854 |
1855 SkASSERT(texture && texture->asRenderTarget()); | 1855 SkASSERT(texture && texture->asRenderTarget()); |
1856 // This constructor is called from onCreateCompatibleDevice. It has locked t
he RT in the texture | 1856 // This constructor is called from onCreateCompatibleDevice. It has locked t
he RT in the texture |
1857 // cache. We pass true for the third argument so that it will get unlocked. | 1857 // cache. We pass true for the third argument so that it will get unlocked. |
1858 this->initFromRenderTarget(context, texture->asRenderTarget(), true); | 1858 this->initFromRenderTarget(context, texture->asRenderTarget(), true); |
1859 fNeedClear = needClear; | 1859 fNeedClear = needClear; |
1860 } | 1860 } |
OLD | NEW |