| 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 "GrAtlasTextBlob.h" | 8 #include "GrAtlasTextBlob.h" |
| 9 | 9 |
| 10 void GrAtlasTextBlob::appendGlyph(Run* run, | 10 void GrAtlasTextBlob::appendGlyph(int runIndex, |
| 11 Run::SubRunInfo* subRun, | 11 const SkRect& positions, |
| 12 const SkRect& positions, GrColor color, | 12 GrColor color, |
| 13 size_t vertexStride, bool useVertexColor, | 13 GrBatchTextStrike* strike, |
| 14 GrGlyph* glyph) { | 14 GrGlyph* glyph) { |
| 15 run->fVertexBounds.joinNonEmptyArg(positions); | 15 Run& run = fRuns[runIndex]; |
| 16 run->fColor = color; | 16 GrMaskFormat format = glyph->fMaskFormat; |
| 17 |
| 18 Run::SubRunInfo* subRun = &run.fSubRunInfo.back(); |
| 19 if (run.fInitialized && subRun->maskFormat() != format) { |
| 20 subRun = &run.push_back(); |
| 21 subRun->setStrike(strike); |
| 22 } else if (!run.fInitialized) { |
| 23 subRun->setStrike(strike); |
| 24 } |
| 25 |
| 26 run.fInitialized = true; |
| 27 |
| 28 size_t vertexStride = GetVertexStride(format); |
| 29 |
| 30 subRun->setMaskFormat(format); |
| 31 |
| 32 run.fVertexBounds.joinNonEmptyArg(positions); |
| 33 run.fColor = color; |
| 17 | 34 |
| 18 intptr_t vertex = reinterpret_cast<intptr_t>(this->fVertices + subRun->verte
xEndIndex()); | 35 intptr_t vertex = reinterpret_cast<intptr_t>(this->fVertices + subRun->verte
xEndIndex()); |
| 19 | 36 |
| 20 if (useVertexColor) { | 37 if (kARGB_GrMaskFormat != glyph->fMaskFormat) { |
| 21 // V0 | 38 // V0 |
| 22 SkPoint* position = reinterpret_cast<SkPoint*>(vertex); | 39 SkPoint* position = reinterpret_cast<SkPoint*>(vertex); |
| 23 position->set(positions.fLeft, positions.fTop); | 40 position->set(positions.fLeft, positions.fTop); |
| 24 SkColor* colorPtr = reinterpret_cast<SkColor*>(vertex + sizeof(SkPoint))
; | 41 SkColor* colorPtr = reinterpret_cast<SkColor*>(vertex + sizeof(SkPoint))
; |
| 25 *colorPtr = color; | 42 *colorPtr = color; |
| 26 vertex += vertexStride; | 43 vertex += vertexStride; |
| 27 | 44 |
| 28 // V1 | 45 // V1 |
| 29 position = reinterpret_cast<SkPoint*>(vertex); | 46 position = reinterpret_cast<SkPoint*>(vertex); |
| 30 position->set(positions.fLeft, positions.fBottom); | 47 position->set(positions.fLeft, positions.fBottom); |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 rSubRun.fBulkUseToken.fPlotAlreadyUpdated); | 180 rSubRun.fBulkUseToken.fPlotAlreadyUpdated); |
| 164 for (int k = 0; k < lSubRun.fBulkUseToken.fPlotsToUpdate.count(); k+
+) { | 181 for (int k = 0; k < lSubRun.fBulkUseToken.fPlotsToUpdate.count(); k+
+) { |
| 165 SkASSERT(lSubRun.fBulkUseToken.fPlotsToUpdate[k] == | 182 SkASSERT(lSubRun.fBulkUseToken.fPlotsToUpdate[k] == |
| 166 rSubRun.fBulkUseToken.fPlotsToUpdate[k]); | 183 rSubRun.fBulkUseToken.fPlotsToUpdate[k]); |
| 167 }*/ | 184 }*/ |
| 168 } | 185 } |
| 169 } | 186 } |
| 170 } | 187 } |
| 171 | 188 |
| 172 #endif | 189 #endif |
| OLD | NEW |