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

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

Issue 1615473002: Revert of Fix GrAtlasTextBlob bounds management (Closed) Base URL: https://skia.googlesource.com/skia.git@cleanuptext17
Patch Set: 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
« no previous file with comments | « src/gpu/text/GrAtlasTextBlob.h ('k') | src/gpu/text/GrAtlasTextContext.cpp » ('j') | 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 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 subRun->joinGlyphBounds(positions); 66 run.fVertexBounds.joinNonEmptyArg(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
222 // If we can reuse the blob, then make sure we update the blob's viewmatrix, and x/y 223 // If we can reuse the blob, then make sure we update the blob's viewmatrix, and x/y
223 // offsets. Note, we offset the vertex bounds right before flushing 224 // offsets. Note, we offset the vertex bounds right before flushing
224 fViewMatrix = viewMatrix; 225 fViewMatrix = viewMatrix;
225 fX = x; 226 fX = x;
226 fY = y; 227 fY = y;
227 228
228 // It is possible that a blob has neither distanceField nor bitmaptext. Thi s is in the case 229 // It is possible that a blob has neither distanceField nor bitmaptext. Thi s is in the case
229 // when all of the runs inside the blob are drawn as paths. In this case, w e always regenerate 230 // when all of the runs inside the blob are drawn as paths. In this case, w e always regenerate
230 // the blob anyways at flush time, so no need to regenerate explicitly 231 // the blob anyways at flush time, so no need to regenerate explicitly
231 return false; 232 return false;
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 376
376 GrColor color = grPaint.getColor(); 377 GrColor color = grPaint.getColor();
377 378
378 SkTextBlobRunIterator it(blob); 379 SkTextBlobRunIterator it(blob);
379 for (int run = 0; !it.done(); it.next(), run++) { 380 for (int run = 0; !it.done(); it.next(), run++) {
380 if (fRuns[run].fDrawAsPaths) { 381 if (fRuns[run].fDrawAsPaths) {
381 this->flushRunAsPaths(context, dc, props, it, clip, skPaint, 382 this->flushRunAsPaths(context, dc, props, it, clip, skPaint,
382 drawFilter, viewMatrix, clipBounds, x, y); 383 drawFilter, viewMatrix, clipBounds, x, y);
383 continue; 384 continue;
384 } 385 }
386 fRuns[run].fVertexBounds.offset(transX, transY);
385 this->flushRun(dc, &pipelineBuilder, run, color, 387 this->flushRun(dc, &pipelineBuilder, run, color,
386 transX, transY, skPaint, props, 388 transX, transY, skPaint, props,
387 distanceAdjustTable, context->getBatchFontCache()); 389 distanceAdjustTable, context->getBatchFontCache());
388 } 390 }
389 391
390 // Now flush big glyphs 392 // Now flush big glyphs
391 this->flushBigGlyphs(context, dc, clip, skPaint, transX, transY, clipBounds) ; 393 this->flushBigGlyphs(context, dc, clip, skPaint, transX, transY, clipBounds) ;
392 } 394 }
393 395
394 void GrAtlasTextBlob::flushThrowaway(GrContext* context, 396 void GrAtlasTextBlob::flushThrowaway(GrContext* context,
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 rSubRun.fBulkUseToken.fPlotAlreadyUpdated); 518 rSubRun.fBulkUseToken.fPlotAlreadyUpdated);
517 for (int k = 0; k < lSubRun.fBulkUseToken.fPlotsToUpdate.count(); k+ +) { 519 for (int k = 0; k < lSubRun.fBulkUseToken.fPlotsToUpdate.count(); k+ +) {
518 SkASSERT(lSubRun.fBulkUseToken.fPlotsToUpdate[k] == 520 SkASSERT(lSubRun.fBulkUseToken.fPlotsToUpdate[k] ==
519 rSubRun.fBulkUseToken.fPlotsToUpdate[k]); 521 rSubRun.fBulkUseToken.fPlotsToUpdate[k]);
520 }*/ 522 }*/
521 } 523 }
522 } 524 }
523 } 525 }
524 526
525 #endif 527 #endif
OLDNEW
« no previous file with comments | « src/gpu/text/GrAtlasTextBlob.h ('k') | src/gpu/text/GrAtlasTextContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698