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

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

Issue 45363002: Fix for issue 1728: raster vs. gpu text draws with the wrong color (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Fix alpha calculation Created 7 years, 1 month 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
« no previous file with comments | « src/gpu/GrBitmapTextContext.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"
(...skipping 1724 matching lines...) Expand 10 before | Expand all | Expand 10 after
1735 if (fContext->getMatrix().hasPerspective()) { 1735 if (fContext->getMatrix().hasPerspective()) {
1736 // this guy will just call our drawPath() 1736 // this guy will just call our drawPath()
1737 draw.drawText((const char*)text, byteLength, x, y, paint); 1737 draw.drawText((const char*)text, byteLength, x, y, paint);
1738 } else { 1738 } else {
1739 SkDraw myDraw(draw); 1739 SkDraw myDraw(draw);
1740 1740
1741 GrPaint grPaint; 1741 GrPaint grPaint;
1742 if (!skPaint2GrPaintShader(this, paint, true, &grPaint)) { 1742 if (!skPaint2GrPaintShader(this, paint, true, &grPaint)) {
1743 return; 1743 return;
1744 } 1744 }
1745 GrBitmapTextContext context(fContext, grPaint); 1745
1746 GrBitmapTextContext context(fContext, grPaint, paint.getColor());
1746 myDraw.fProcs = this->initDrawForText(&context); 1747 myDraw.fProcs = this->initDrawForText(&context);
1747 this->INHERITED::drawText(myDraw, text, byteLength, x, y, paint); 1748 this->INHERITED::drawText(myDraw, text, byteLength, x, y, paint);
1748 } 1749 }
1749 } 1750 }
1750 1751
1751 void SkGpuDevice::drawPosText(const SkDraw& draw, const void* text, 1752 void SkGpuDevice::drawPosText(const SkDraw& draw, const void* text,
1752 size_t byteLength, const SkScalar pos[], 1753 size_t byteLength, const SkScalar pos[],
1753 SkScalar constY, int scalarsPerPos, 1754 SkScalar constY, int scalarsPerPos,
1754 const SkPaint& paint) { 1755 const SkPaint& paint) {
1755 CHECK_SHOULD_DRAW(draw, false); 1756 CHECK_SHOULD_DRAW(draw, false);
1756 1757
1757 if (fContext->getMatrix().hasPerspective()) { 1758 if (fContext->getMatrix().hasPerspective()) {
1758 // this guy will just call our drawPath() 1759 // this guy will just call our drawPath()
1759 draw.drawPosText((const char*)text, byteLength, pos, constY, 1760 draw.drawPosText((const char*)text, byteLength, pos, constY,
1760 scalarsPerPos, paint); 1761 scalarsPerPos, paint);
1761 } else { 1762 } else {
1762 SkDraw myDraw(draw); 1763 SkDraw myDraw(draw);
1763 1764
1764 GrPaint grPaint; 1765 GrPaint grPaint;
1765 if (!skPaint2GrPaintShader(this, paint, true, &grPaint)) { 1766 if (!skPaint2GrPaintShader(this, paint, true, &grPaint)) {
1766 return; 1767 return;
1767 } 1768 }
1768 GrBitmapTextContext context(fContext, grPaint); 1769 GrBitmapTextContext context(fContext, grPaint, paint.getColor());
1769 myDraw.fProcs = this->initDrawForText(&context); 1770 myDraw.fProcs = this->initDrawForText(&context);
1770 this->INHERITED::drawPosText(myDraw, text, byteLength, pos, constY, 1771 this->INHERITED::drawPosText(myDraw, text, byteLength, pos, constY,
1771 scalarsPerPos, paint); 1772 scalarsPerPos, paint);
1772 } 1773 }
1773 } 1774 }
1774 1775
1775 void SkGpuDevice::drawTextOnPath(const SkDraw& draw, const void* text, 1776 void SkGpuDevice::drawTextOnPath(const SkDraw& draw, const void* text,
1776 size_t len, const SkPath& path, 1777 size_t len, const SkPath& path,
1777 const SkMatrix* m, const SkPaint& paint) { 1778 const SkMatrix* m, const SkPaint& paint) {
1778 CHECK_SHOULD_DRAW(draw, false); 1779 CHECK_SHOULD_DRAW(draw, false);
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
1850 GrTexture* texture, 1851 GrTexture* texture,
1851 bool needClear) 1852 bool needClear)
1852 : SkBitmapDevice(make_bitmap(context, texture->asRenderTarget())) { 1853 : SkBitmapDevice(make_bitmap(context, texture->asRenderTarget())) {
1853 1854
1854 SkASSERT(texture && texture->asRenderTarget()); 1855 SkASSERT(texture && texture->asRenderTarget());
1855 // 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
1856 // 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.
1857 this->initFromRenderTarget(context, texture->asRenderTarget(), true); 1858 this->initFromRenderTarget(context, texture->asRenderTarget(), true);
1858 fNeedClear = needClear; 1859 fNeedClear = needClear;
1859 } 1860 }
OLDNEW
« no previous file with comments | « src/gpu/GrBitmapTextContext.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698