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

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

Issue 1160633002: real fix for textblob use after gpu free (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: tweaks 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 | « gm/textblobuseaftergpufree.cpp ('k') | src/gpu/GrCommandBuilder.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 #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 1563 matching lines...) Expand 10 before | Expand all | Expand 10 after
1574 GrFontScaler* scaler = NULL; 1574 GrFontScaler* scaler = NULL;
1575 SkTypeface* typeface = NULL; 1575 SkTypeface* typeface = NULL;
1576 1576
1577 for (int i = 0; i < instanceCount; i++) { 1577 for (int i = 0; i < instanceCount; i++) {
1578 Geometry& args = fGeoData[i]; 1578 Geometry& args = fGeoData[i];
1579 Blob* blob = args.fBlob; 1579 Blob* blob = args.fBlob;
1580 Run& run = blob->fRuns[args.fRun]; 1580 Run& run = blob->fRuns[args.fRun];
1581 TextInfo& info = run.fSubRunInfo[args.fSubRun]; 1581 TextInfo& info = run.fSubRunInfo[args.fSubRun];
1582 1582
1583 uint64_t currentAtlasGen = fFontCache->atlasGeneration(fMaskFormat); 1583 uint64_t currentAtlasGen = fFontCache->atlasGeneration(fMaskFormat);
1584 bool regenerateTextureCoords = info.fAtlasGeneration != currentAtlas Gen; 1584 bool regenerateTextureCoords = info.fAtlasGeneration != currentAtlas Gen ||
1585 run.fStrike->isAbandoned();
1585 bool regenerateColors; 1586 bool regenerateColors;
1586 if (fUseDistanceFields) { 1587 if (fUseDistanceFields) {
1587 regenerateColors = !fUseLCDText && run.fColor != args.fColor; 1588 regenerateColors = !fUseLCDText && run.fColor != args.fColor;
1588 } else { 1589 } else {
1589 regenerateColors = kA8_GrMaskFormat == fMaskFormat && run.fColor != args.fColor; 1590 regenerateColors = kA8_GrMaskFormat == fMaskFormat && run.fColor != args.fColor;
1590 } 1591 }
1591 bool regeneratePositions = args.fTransX != 0.f || args.fTransY != 0. f; 1592 bool regeneratePositions = args.fTransX != 0.f || args.fTransY != 0. f;
1592 int glyphCount = info.fGlyphEndIndex - info.fGlyphStartIndex; 1593 int glyphCount = info.fGlyphEndIndex - info.fGlyphStartIndex;
1593 1594
1594 // We regenerate both texture coords and colors in the blob itself, and update the 1595 // We regenerate both texture coords and colors in the blob itself, and update the
(...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after
2262 gTextContext->createDrawTextBlob(rt, clip, grPaint, skPaint, viewMat rix, text, 2263 gTextContext->createDrawTextBlob(rt, clip, grPaint, skPaint, viewMat rix, text,
2263 static_cast<size_t>(textLen), 0, 0, noClip)); 2264 static_cast<size_t>(textLen), 0, 0, noClip));
2264 2265
2265 SkScalar transX = static_cast<SkScalar>(random->nextU()); 2266 SkScalar transX = static_cast<SkScalar>(random->nextU());
2266 SkScalar transY = static_cast<SkScalar>(random->nextU()); 2267 SkScalar transY = static_cast<SkScalar>(random->nextU());
2267 const GrAtlasTextContext::BitmapTextBlob::Run::SubRunInfo& info = blob->fRun s[0].fSubRunInfo[0]; 2268 const GrAtlasTextContext::BitmapTextBlob::Run::SubRunInfo& info = blob->fRun s[0].fSubRunInfo[0];
2268 return gTextContext->createBatch(blob, info, textLen, 0, 0, color, transX, t ransY, skPaint); 2269 return gTextContext->createBatch(blob, info, textLen, 0, 0, color, transX, t ransY, skPaint);
2269 } 2270 }
2270 2271
2271 #endif 2272 #endif
OLDNEW
« no previous file with comments | « gm/textblobuseaftergpufree.cpp ('k') | src/gpu/GrCommandBuilder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698