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

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

Issue 1122253003: small fix to correct bounds on distance field text (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 7 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
« no previous file with comments | « no previous file | 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 2015 Google Inc. 2 * Copyright 2015 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 #include "GrAtlasTextContext.h" 7 #include "GrAtlasTextContext.h"
8 8
9 #include "GrBatch.h" 9 #include "GrBatch.h"
10 #include "GrBatchFontCache.h" 10 #include "GrBatchFontCache.h"
(...skipping 1695 matching lines...) Expand 10 before | Expand all | Expand 10 after
1706 1706
1707 // Total number of Geometry this Batch owns 1707 // Total number of Geometry this Batch owns
1708 int instanceCount() const { return fInstanceCount; } 1708 int instanceCount() const { return fInstanceCount; }
1709 SkAutoSTMalloc<kMinAllocated, Geometry>* geoData() { return &fGeoData; } 1709 SkAutoSTMalloc<kMinAllocated, Geometry>* geoData() { return &fGeoData; }
1710 1710
1711 // to avoid even the initial copy of the struct, we have a getter for the fi rst item which 1711 // to avoid even the initial copy of the struct, we have a getter for the fi rst item which
1712 // is used to seed the batch with its initial geometry. After seeding, the client should call 1712 // is used to seed the batch with its initial geometry. After seeding, the client should call
1713 // init() so the Batch can initialize itself 1713 // init() so the Batch can initialize itself
1714 Geometry& geometry() { return fGeoData[0]; } 1714 Geometry& geometry() { return fGeoData[0]; }
1715 void init() { 1715 void init() {
1716 fBatch.fColor = fGeoData[0].fColor; 1716 const Geometry& geo = fGeoData[0];
1717 fBatch.fViewMatrix = fGeoData[0].fBlob->fViewMatrix; 1717 fBatch.fColor = geo.fColor;
1718 this->setBounds(fGeoData[0].fBlob->fRuns[fGeoData[0].fRun].fVertexBounds ); 1718 fBatch.fViewMatrix = geo.fBlob->fViewMatrix;
1719
1720 // We don't yet position distance field text on the cpu, so we have to m ap the vertex bounds
1721 // into device space
1722 const Run& run = geo.fBlob->fRuns[geo.fRun];
1723 if (run.fSubRunInfo[geo.fSubRun].fDrawAsDistanceFields) {
1724 SkRect bounds = run.fVertexBounds;
1725 fBatch.fViewMatrix.mapRect(&bounds);
1726 this->setBounds(bounds);
1727 } else {
1728 this->setBounds(run.fVertexBounds);
1729 }
1719 } 1730 }
1720 1731
1721 private: 1732 private:
1722 BitmapTextBatch(GrMaskFormat maskFormat, int glyphCount, GrBatchFontCache* f ontCache) 1733 BitmapTextBatch(GrMaskFormat maskFormat, int glyphCount, GrBatchFontCache* f ontCache)
1723 : fMaskFormat(maskFormat) 1734 : fMaskFormat(maskFormat)
1724 , fPixelConfig(fontCache->getPixelConfig(maskFormat)) 1735 , fPixelConfig(fontCache->getPixelConfig(maskFormat))
1725 , fFontCache(fontCache) 1736 , fFontCache(fontCache)
1726 , fUseDistanceFields(false) { 1737 , fUseDistanceFields(false) {
1727 this->initClassID<BitmapTextBatch>(); 1738 this->initClassID<BitmapTextBatch>();
1728 fBatch.fNumGlyphs = glyphCount; 1739 fBatch.fNumGlyphs = glyphCount;
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
2152 pipelineBuilder.setFromPaint(grPaint, rt, clip); 2163 pipelineBuilder.setFromPaint(grPaint, rt, clip);
2153 2164
2154 GrColor color = grPaint.getColor(); 2165 GrColor color = grPaint.getColor();
2155 for (int run = 0; run < cacheBlob->fRunCount; run++) { 2166 for (int run = 0; run < cacheBlob->fRunCount; run++) {
2156 this->flushRun(target, &pipelineBuilder, cacheBlob, run, color, 0, 0, sk Paint); 2167 this->flushRun(target, &pipelineBuilder, cacheBlob, run, color, 0, 0, sk Paint);
2157 } 2168 }
2158 2169
2159 // Now flush big glyphs 2170 // Now flush big glyphs
2160 this->flushBigGlyphs(cacheBlob, rt, grPaint, clip, 0, 0); 2171 this->flushBigGlyphs(cacheBlob, rt, grPaint, clip, 0, 0);
2161 } 2172 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698