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

Side by Side Diff: src/gpu/text/GrAtlasTextBlob.cpp

Issue 1605013002: Fix GrAtlasTextBlob bounds management (Closed) Base URL: https://skia.googlesource.com/skia.git@cleanuptext17
Patch Set: tweaks Created 4 years, 11 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
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 7
8 #include "GrAtlasTextBlob.h" 8 #include "GrAtlasTextBlob.h"
9 9
10 #include "GrBlurUtils.h" 10 #include "GrBlurUtils.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 } else if (!run.fInitialized) { 56 } else if (!run.fInitialized) {
57 subRun->setStrike(strike); 57 subRun->setStrike(strike);
58 } 58 }
59 59
60 run.fInitialized = true; 60 run.fInitialized = true;
61 61
62 size_t vertexStride = GetVertexStride(format); 62 size_t vertexStride = GetVertexStride(format);
63 63
64 subRun->setMaskFormat(format); 64 subRun->setMaskFormat(format);
65 65
66 run.fVertexBounds.joinNonEmptyArg(positions); 66 subRun->joinGlyphBounds(positions);
67 subRun->setColor(color); 67 subRun->setColor(color);
68 68
69 intptr_t vertex = reinterpret_cast<intptr_t>(this->fVertices + subRun->verte xEndIndex()); 69 intptr_t vertex = reinterpret_cast<intptr_t>(this->fVertices + subRun->verte xEndIndex());
70 70
71 if (kARGB_GrMaskFormat != glyph->fMaskFormat) { 71 if (kARGB_GrMaskFormat != glyph->fMaskFormat) {
72 // V0 72 // V0
73 SkPoint* position = reinterpret_cast<SkPoint*>(vertex); 73 SkPoint* position = reinterpret_cast<SkPoint*>(vertex);
74 position->set(positions.fLeft, positions.fTop); 74 position->set(positions.fLeft, positions.fTop);
75 SkColor* colorPtr = reinterpret_cast<SkColor*>(vertex + sizeof(SkPoint)) ; 75 SkColor* colorPtr = reinterpret_cast<SkColor*>(vertex + sizeof(SkPoint)) ;
76 *colorPtr = color; 76 *colorPtr = color;
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 SkScalar oldMaxScale = fViewMatrix.getMaxScale(); 212 SkScalar oldMaxScale = fViewMatrix.getMaxScale();
213 SkScalar scaleAdjust = newMaxScale / oldMaxScale; 213 SkScalar scaleAdjust = newMaxScale / oldMaxScale;
214 if (scaleAdjust < fMaxMinScale || scaleAdjust > fMinMaxScale) { 214 if (scaleAdjust < fMaxMinScale || scaleAdjust > fMinMaxScale) {
215 return true; 215 return true;
216 } 216 }
217 217
218 (*outTransX) = x - fX; 218 (*outTransX) = x - fX;
219 (*outTransY) = y - fY; 219 (*outTransY) = y - fY;
220 } 220 }
221 221
222
223 // If we can reuse the blob, then make sure we update the blob's viewmatrix, and x/y 222 // If we can reuse the blob, then make sure we update the blob's viewmatrix, and x/y
224 // offsets. Note, we offset the vertex bounds right before flushing 223 // offsets. Note, we offset the vertex bounds right before flushing
225 fViewMatrix = viewMatrix; 224 fViewMatrix = viewMatrix;
226 fX = x; 225 fX = x;
227 fY = y; 226 fY = y;
228 227
229 // It is possible that a blob has neither distanceField nor bitmaptext. Thi s is in the case 228 // It is possible that a blob has neither distanceField nor bitmaptext. Thi s is in the case
230 // when all of the runs inside the blob are drawn as paths. In this case, w e always regenerate 229 // when all of the runs inside the blob are drawn as paths. In this case, w e always regenerate
231 // the blob anyways at flush time, so no need to regenerate explicitly 230 // the blob anyways at flush time, so no need to regenerate explicitly
232 return false; 231 return false;
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 375
377 GrColor color = grPaint.getColor(); 376 GrColor color = grPaint.getColor();
378 377
379 SkTextBlobRunIterator it(blob); 378 SkTextBlobRunIterator it(blob);
380 for (int run = 0; !it.done(); it.next(), run++) { 379 for (int run = 0; !it.done(); it.next(), run++) {
381 if (fRuns[run].fDrawAsPaths) { 380 if (fRuns[run].fDrawAsPaths) {
382 this->flushRunAsPaths(context, dc, props, it, clip, skPaint, 381 this->flushRunAsPaths(context, dc, props, it, clip, skPaint,
383 drawFilter, viewMatrix, clipBounds, x, y); 382 drawFilter, viewMatrix, clipBounds, x, y);
384 continue; 383 continue;
385 } 384 }
386 fRuns[run].fVertexBounds.offset(transX, transY);
387 this->flushRun(dc, &pipelineBuilder, run, color, 385 this->flushRun(dc, &pipelineBuilder, run, color,
388 transX, transY, skPaint, props, 386 transX, transY, skPaint, props,
389 distanceAdjustTable, context->getBatchFontCache()); 387 distanceAdjustTable, context->getBatchFontCache());
390 } 388 }
391 389
392 // Now flush big glyphs 390 // Now flush big glyphs
393 this->flushBigGlyphs(context, dc, clip, skPaint, transX, transY, clipBounds) ; 391 this->flushBigGlyphs(context, dc, clip, skPaint, transX, transY, clipBounds) ;
394 } 392 }
395 393
396 void GrAtlasTextBlob::flushThrowaway(GrContext* context, 394 void GrAtlasTextBlob::flushThrowaway(GrContext* context,
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 rSubRun.fBulkUseToken.fPlotAlreadyUpdated); 516 rSubRun.fBulkUseToken.fPlotAlreadyUpdated);
519 for (int k = 0; k < lSubRun.fBulkUseToken.fPlotsToUpdate.count(); k+ +) { 517 for (int k = 0; k < lSubRun.fBulkUseToken.fPlotsToUpdate.count(); k+ +) {
520 SkASSERT(lSubRun.fBulkUseToken.fPlotsToUpdate[k] == 518 SkASSERT(lSubRun.fBulkUseToken.fPlotsToUpdate[k] ==
521 rSubRun.fBulkUseToken.fPlotsToUpdate[k]); 519 rSubRun.fBulkUseToken.fPlotsToUpdate[k]);
522 }*/ 520 }*/
523 } 521 }
524 } 522 }
525 } 523 }
526 524
527 #endif 525 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698