| OLD | NEW |
| 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 | 7 |
| 8 #include "GrAtlasTextBatch.h" | 8 #include "GrAtlasTextBatch.h" |
| 9 | 9 |
| 10 #include "GrBatchFontCache.h" | 10 #include "GrBatchFontCache.h" |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 strike = info->fStrike; | 161 strike = info->fStrike; |
| 162 } | 162 } |
| 163 } | 163 } |
| 164 | 164 |
| 165 bool brokenRun = false; | 165 bool brokenRun = false; |
| 166 for (int glyphIdx = 0; glyphIdx < glyphCount; glyphIdx++) { | 166 for (int glyphIdx = 0; glyphIdx < glyphCount; glyphIdx++) { |
| 167 GrGlyph* glyph = nullptr; | 167 GrGlyph* glyph = nullptr; |
| 168 if (regenTexCoords) { | 168 if (regenTexCoords) { |
| 169 size_t glyphOffset = glyphIdx + info->fGlyphStartIndex; | 169 size_t glyphOffset = glyphIdx + info->fGlyphStartIndex; |
| 170 | 170 |
| 171 glyph = blob->fGlyphs[glyphOffset]; | |
| 172 GrGlyph::PackedID id = glyph->fPackedID; | |
| 173 const SkGlyph& skGlyph = (*scaler)->grToSkGlyph(id); | |
| 174 if (regenGlyphs) { | 171 if (regenGlyphs) { |
| 175 // Get the id from the old glyph, and use the new strike to look
up | 172 // Get the id from the old glyph, and use the new strike to look
up |
| 176 // the glyph. | 173 // the glyph. |
| 177 blob->fGlyphs[glyphOffset] = strike->getGlyph(skGlyph, id, this-
>maskFormat(), | 174 GrGlyph::PackedID id = blob->fGlyphs[glyphOffset]->fPackedID; |
| 178 *scaler); | 175 blob->fGlyphs[glyphOffset] = strike->getGlyph(id, this->maskForm
at(), *scaler); |
| 176 SkASSERT(id == blob->fGlyphs[glyphOffset]->fPackedID); |
| 179 } | 177 } |
| 180 glyph = blob->fGlyphs[glyphOffset]; | 178 glyph = blob->fGlyphs[glyphOffset]; |
| 181 SkASSERT(glyph); | 179 SkASSERT(glyph && glyph->fMaskFormat == this->maskFormat()); |
| 182 SkASSERT(id == glyph->fPackedID); | |
| 183 // We want to be able to assert this but cannot for testing purposes
. | |
| 184 // once skbug:4143 has landed we can revist this assert | |
| 185 //SkASSERT(glyph->fMaskFormat == this->maskFormat()); | |
| 186 | 180 |
| 187 if (!fFontCache->hasGlyph(glyph) && | 181 if (!fFontCache->hasGlyph(glyph) && |
| 188 !strike->addGlyphToAtlas(target, glyph, *scaler, skGlyph, this->
maskFormat())) { | 182 !strike->addGlyphToAtlas(target, glyph, *scaler, this->maskForma
t())) { |
| 189 this->flush(target, flushInfo); | 183 this->flush(target, flushInfo); |
| 190 target->initDraw(gp, this->pipeline()); | 184 target->initDraw(gp, this->pipeline()); |
| 191 brokenRun = glyphIdx > 0; | 185 brokenRun = glyphIdx > 0; |
| 192 | 186 |
| 193 SkDEBUGCODE(bool success =) strike->addGlyphToAtlas(target, | 187 SkDEBUGCODE(bool success =) strike->addGlyphToAtlas(target, |
| 194 glyph, | 188 glyph, |
| 195 *scaler, | 189 *scaler, |
| 196 skGlyph, | |
| 197 this->maskFo
rmat()); | 190 this->maskFo
rmat()); |
| 198 SkASSERT(success); | 191 SkASSERT(success); |
| 199 } | 192 } |
| 200 fFontCache->addGlyphToBulkAndSetUseToken(&info->fBulkUseToken, glyph
, | 193 fFontCache->addGlyphToBulkAndSetUseToken(&info->fBulkUseToken, glyph
, |
| 201 target->currentToken()); | 194 target->currentToken()); |
| 202 } | 195 } |
| 203 | 196 |
| 204 intptr_t vertex = reinterpret_cast<intptr_t>(blob->fVertices); | 197 intptr_t vertex = reinterpret_cast<intptr_t>(blob->fVertices); |
| 205 vertex += info->fVertexStartIndex; | 198 vertex += info->fVertexStartIndex; |
| 206 vertex += vertexStride * glyphIdx * GrAtlasTextBatch::kVerticesPerGlyph; | 199 vertex += vertexStride * glyphIdx * GrAtlasTextBatch::kVerticesPerGlyph; |
| (...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 574 return GrDistanceFieldA8TextGeoProc::Create(color, | 567 return GrDistanceFieldA8TextGeoProc::Create(color, |
| 575 viewMatrix, | 568 viewMatrix, |
| 576 texture, | 569 texture, |
| 577 params, | 570 params, |
| 578 flags, | 571 flags, |
| 579 this->usesLocalCoords()); | 572 this->usesLocalCoords()); |
| 580 #endif | 573 #endif |
| 581 } | 574 } |
| 582 | 575 |
| 583 } | 576 } |
| OLD | NEW |