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

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

Issue 1716443005: Calculate translations to apply to vertices in batch (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 10 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.cpp ('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 2016 Google Inc. 2 * Copyright 2016 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 "GrBatchFlushState.h" 10 #include "GrBatchFlushState.h"
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 228
229 #define REGEN_ARGS target, fontCache, helper, &run, &info, cache, typeface, scal er, desc, \ 229 #define REGEN_ARGS target, fontCache, helper, &run, &info, cache, typeface, scal er, desc, \
230 *glyphCount, vertexStride, color, transX, transY 230 *glyphCount, vertexStride, color, transX, transY
231 231
232 void GrAtlasTextBlob::regenInBatch(GrDrawBatch::Target* target, 232 void GrAtlasTextBlob::regenInBatch(GrDrawBatch::Target* target,
233 GrBatchFontCache* fontCache, 233 GrBatchFontCache* fontCache,
234 GrBlobRegenHelper *helper, 234 GrBlobRegenHelper *helper,
235 int runIndex, int subRunIndex, SkGlyphCache** cache, 235 int runIndex, int subRunIndex, SkGlyphCache** cache,
236 SkTypeface** typeface, GrFontScaler** scaler, 236 SkTypeface** typeface, GrFontScaler** scaler,
237 const SkDescriptor** desc, size_t vertexStrid e, 237 const SkDescriptor** desc, size_t vertexStrid e,
238 GrColor color, SkScalar transX, 238 const SkMatrix& viewMatrix, SkScalar x, SkSca lar y,
239 SkScalar transY, 239 GrColor color,
240 void** vertices, size_t* byteCount, int* glyp hCount) { 240 void** vertices, size_t* byteCount, int* glyp hCount) {
241 Run& run = fRuns[runIndex]; 241 Run& run = fRuns[runIndex];
242 Run::SubRunInfo& info = run.fSubRunInfo[subRunIndex]; 242 Run::SubRunInfo& info = run.fSubRunInfo[subRunIndex];
243 243
244 uint64_t currentAtlasGen = fontCache->atlasGeneration(info.maskFormat()); 244 uint64_t currentAtlasGen = fontCache->atlasGeneration(info.maskFormat());
245 245
246 // Compute translation if any
247 SkScalar transX, transY;
248 info.computeTranslation(viewMatrix, x, y, &transX, &transY);
249
246 // Because the GrBatchFontCache may evict the strike a blob depends on using for 250 // Because the GrBatchFontCache may evict the strike a blob depends on using for
247 // generating its texture coords, we have to track whether or not the strike has 251 // generating its texture coords, we have to track whether or not the strike has
248 // been abandoned. If it hasn't been abandoned, then we can use the GrGlyph *s as is 252 // been abandoned. If it hasn't been abandoned, then we can use the GrGlyph *s as is
249 // otherwise we have to get the new strike, and use that to get the correct glyphs. 253 // otherwise we have to get the new strike, and use that to get the correct glyphs.
250 // Because we do not have the packed ids, and thus can't look up our glyphs in the 254 // Because we do not have the packed ids, and thus can't look up our glyphs in the
251 // new strike, we instead keep our ref to the old strike and use the packed ids from 255 // new strike, we instead keep our ref to the old strike and use the packed ids from
252 // it. These ids will still be valid as long as we hold the ref. When we a re done 256 // it. These ids will still be valid as long as we hold the ref. When we a re done
253 // updating our cache of the GrGlyph*s, we drop our ref on the old strike 257 // updating our cache of the GrGlyph*s, we drop our ref on the old strike
254 bool regenerateGlyphs = info.strike()->isAbandoned(); 258 bool regenerateGlyphs = info.strike()->isAbandoned();
255 bool regenerateTextureCoords = info.atlasGeneration() != currentAtlasGen || 259 bool regenerateTextureCoords = info.atlasGeneration() != currentAtlasGen ||
(...skipping 30 matching lines...) Expand all
286 // set use tokens for all of the glyphs in our subrun. This is only valid if we 290 // set use tokens for all of the glyphs in our subrun. This is only valid if we
287 // have a valid atlas generation 291 // have a valid atlas generation
288 fontCache->setUseTokenBulk(*info.bulkUseToken(), target->currentToke n(), 292 fontCache->setUseTokenBulk(*info.bulkUseToken(), target->currentToke n(),
289 info.maskFormat()); 293 info.maskFormat());
290 break; 294 break;
291 } 295 }
292 296
293 *byteCount = info.byteCount(); 297 *byteCount = info.byteCount();
294 *vertices = fVertices + info.vertexStartIndex(); 298 *vertices = fVertices + info.vertexStartIndex();
295 } 299 }
OLDNEW
« no previous file with comments | « src/gpu/text/GrAtlasTextBlob.cpp ('k') | src/gpu/text/GrAtlasTextContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698