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

Side by Side Diff: src/gpu/SkGpuDevice.cpp

Issue 27199002: Split out GrBitmapTextContext from GrTextContext. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Rebase to ToT Created 7 years, 2 months 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 | Annotate | Revision Log
« src/gpu/GrTextContext.cpp ('K') | « src/gpu/GrTextContext.cpp ('k') | 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 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 1738 matching lines...) Expand 10 before | Expand all | Expand 10 after
1763 if (fContext->getMatrix().hasPerspective()) { 1763 if (fContext->getMatrix().hasPerspective()) {
1764 // this guy will just call our drawPath() 1764 // this guy will just call our drawPath()
1765 draw.drawText((const char*)text, byteLength, x, y, paint); 1765 draw.drawText((const char*)text, byteLength, x, y, paint);
1766 } else { 1766 } else {
1767 SkDraw myDraw(draw); 1767 SkDraw myDraw(draw);
1768 1768
1769 GrPaint grPaint; 1769 GrPaint grPaint;
1770 if (!skPaint2GrPaintShader(this, paint, true, &grPaint)) { 1770 if (!skPaint2GrPaintShader(this, paint, true, &grPaint)) {
1771 return; 1771 return;
1772 } 1772 }
1773 GrTextContext context(fContext, grPaint); 1773 GrBitmapTextContext context(fContext, grPaint);
1774 myDraw.fProcs = this->initDrawForText(&context); 1774 myDraw.fProcs = this->initDrawForText(&context);
1775 this->INHERITED::drawText(myDraw, text, byteLength, x, y, paint); 1775 this->INHERITED::drawText(myDraw, text, byteLength, x, y, paint);
1776 } 1776 }
1777 } 1777 }
1778 1778
1779 void SkGpuDevice::drawPosText(const SkDraw& draw, const void* text, 1779 void SkGpuDevice::drawPosText(const SkDraw& draw, const void* text,
1780 size_t byteLength, const SkScalar pos[], 1780 size_t byteLength, const SkScalar pos[],
1781 SkScalar constY, int scalarsPerPos, 1781 SkScalar constY, int scalarsPerPos,
1782 const SkPaint& paint) { 1782 const SkPaint& paint) {
1783 CHECK_SHOULD_DRAW(draw, false); 1783 CHECK_SHOULD_DRAW(draw, false);
1784 1784
1785 if (fContext->getMatrix().hasPerspective()) { 1785 if (fContext->getMatrix().hasPerspective()) {
1786 // this guy will just call our drawPath() 1786 // this guy will just call our drawPath()
1787 draw.drawPosText((const char*)text, byteLength, pos, constY, 1787 draw.drawPosText((const char*)text, byteLength, pos, constY,
1788 scalarsPerPos, paint); 1788 scalarsPerPos, paint);
1789 } else { 1789 } else {
1790 SkDraw myDraw(draw); 1790 SkDraw myDraw(draw);
1791 1791
1792 GrPaint grPaint; 1792 GrPaint grPaint;
1793 if (!skPaint2GrPaintShader(this, paint, true, &grPaint)) { 1793 if (!skPaint2GrPaintShader(this, paint, true, &grPaint)) {
1794 return; 1794 return;
1795 } 1795 }
1796 GrTextContext context(fContext, grPaint); 1796 GrBitmapTextContext context(fContext, grPaint);
1797 myDraw.fProcs = this->initDrawForText(&context); 1797 myDraw.fProcs = this->initDrawForText(&context);
1798 this->INHERITED::drawPosText(myDraw, text, byteLength, pos, constY, 1798 this->INHERITED::drawPosText(myDraw, text, byteLength, pos, constY,
1799 scalarsPerPos, paint); 1799 scalarsPerPos, paint);
1800 } 1800 }
1801 } 1801 }
1802 1802
1803 void SkGpuDevice::drawTextOnPath(const SkDraw& draw, const void* text, 1803 void SkGpuDevice::drawTextOnPath(const SkDraw& draw, const void* text,
1804 size_t len, const SkPath& path, 1804 size_t len, const SkPath& path,
1805 const SkMatrix* m, const SkPaint& paint) { 1805 const SkMatrix* m, const SkPaint& paint) {
1806 CHECK_SHOULD_DRAW(draw, false); 1806 CHECK_SHOULD_DRAW(draw, false);
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
1878 GrTexture* texture, 1878 GrTexture* texture,
1879 bool needClear) 1879 bool needClear)
1880 : SkBitmapDevice(make_bitmap(context, texture->asRenderTarget())) { 1880 : SkBitmapDevice(make_bitmap(context, texture->asRenderTarget())) {
1881 1881
1882 SkASSERT(texture && texture->asRenderTarget()); 1882 SkASSERT(texture && texture->asRenderTarget());
1883 // This constructor is called from onCreateCompatibleDevice. It has locked t he RT in the texture 1883 // This constructor is called from onCreateCompatibleDevice. It has locked t he RT in the texture
1884 // cache. We pass true for the third argument so that it will get unlocked. 1884 // cache. We pass true for the third argument so that it will get unlocked.
1885 this->initFromRenderTarget(context, texture->asRenderTarget(), true); 1885 this->initFromRenderTarget(context, texture->asRenderTarget(), true);
1886 fNeedClear = needClear; 1886 fNeedClear = needClear;
1887 } 1887 }
OLDNEW
« src/gpu/GrTextContext.cpp ('K') | « src/gpu/GrTextContext.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698