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

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

Issue 1241263003: adding assert to GrAtlasTextContext (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 5 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/GrAtlasTextBlob.cpp ('k') | no next file » | 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 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 // We have to remake the blob because changes may invalidate our mas ks. 402 // We have to remake the blob because changes may invalidate our mas ks.
403 // TODO we could probably get away reuse most of the time if the poi nter is unique, 403 // TODO we could probably get away reuse most of the time if the poi nter is unique,
404 // but we'd have to clear the subrun information 404 // but we'd have to clear the subrun information
405 fCache->remove(cacheBlob); 405 fCache->remove(cacheBlob);
406 cacheBlob.reset(SkRef(fCache->createCachedBlob(blob, key, blurRec, s kPaint, 406 cacheBlob.reset(SkRef(fCache->createCachedBlob(blob, key, blurRec, s kPaint,
407 kGrayTextVASize))); 407 kGrayTextVASize)));
408 this->regenerateTextBlob(cacheBlob, skPaint, grPaint.getColor(), vie wMatrix, 408 this->regenerateTextBlob(cacheBlob, skPaint, grPaint.getColor(), vie wMatrix,
409 blob, x, y, drawFilter, clipRect, rt, clip, grPaint); 409 blob, x, y, drawFilter, clipRect, rt, clip, grPaint);
410 } else { 410 } else {
411 // If we can reuse the blob, then make sure we update the blob's vie wmatrix, and x/y 411 // If we can reuse the blob, then make sure we update the blob's vie wmatrix, and x/y
412 // offsets 412 // offsets. Note, we offset the vertex bounds right before flushing
413 // TODO bounds are wrong
414 cacheBlob->fViewMatrix = viewMatrix; 413 cacheBlob->fViewMatrix = viewMatrix;
415 cacheBlob->fX = x; 414 cacheBlob->fX = x;
416 cacheBlob->fY = y; 415 cacheBlob->fY = y;
417 fCache->makeMRU(cacheBlob); 416 fCache->makeMRU(cacheBlob);
418 #ifdef CACHE_SANITY_CHECK 417 #ifdef CACHE_SANITY_CHECK
419 { 418 {
420 int glyphCount = 0; 419 int glyphCount = 0;
421 int runCount = 0; 420 int runCount = 0;
422 GrTextBlobCache::BlobGlyphCount(&glyphCount, &runCount, blob); 421 GrTextBlobCache::BlobGlyphCount(&glyphCount, &runCount, blob);
423 SkAutoTUnref<GrAtlasTextBlob> sanityBlob(fCache->createBlob(glyp hCount, runCount, 422 SkAutoTUnref<GrAtlasTextBlob> sanityBlob(fCache->createBlob(glyp hCount, runCount,
(...skipping 1244 matching lines...) Expand 10 before | Expand all | Expand 10 after
1668 GrGlyph* glyph; 1667 GrGlyph* glyph;
1669 if (regenerateGlyphs) { 1668 if (regenerateGlyphs) {
1670 // Get the id from the old glyph, and use the new st rike to lookup 1669 // Get the id from the old glyph, and use the new st rike to lookup
1671 // the glyph. 1670 // the glyph.
1672 glyph = blob->fGlyphs[glyphOffset]; 1671 glyph = blob->fGlyphs[glyphOffset];
1673 blob->fGlyphs[glyphOffset] = strike->getGlyph(glyph- >fPackedID, 1672 blob->fGlyphs[glyphOffset] = strike->getGlyph(glyph- >fPackedID,
1674 scaler ); 1673 scaler );
1675 } 1674 }
1676 glyph = blob->fGlyphs[glyphOffset]; 1675 glyph = blob->fGlyphs[glyphOffset];
1677 SkASSERT(glyph); 1676 SkASSERT(glyph);
1677 SkASSERT(glyph->fMaskFormat == fMaskFormat);
1678 1678
1679 if (!fFontCache->hasGlyph(glyph) && 1679 if (!fFontCache->hasGlyph(glyph) &&
1680 !strike->addGlyphToAtlas(batchTarget, glyph, scaler) ) { 1680 !strike->addGlyphToAtlas(batchTarget, glyph, scaler) ) {
1681 this->flush(batchTarget, &flushInfo); 1681 this->flush(batchTarget, &flushInfo);
1682 batchTarget->initDraw(gp, pipeline); 1682 batchTarget->initDraw(gp, pipeline);
1683 brokenRun = glyphIdx > 0; 1683 brokenRun = glyphIdx > 0;
1684 1684
1685 SkDEBUGCODE(bool success =) strike->addGlyphToAtlas( batchTarget, 1685 SkDEBUGCODE(bool success =) strike->addGlyphToAtlas( batchTarget,
1686 glyph, 1686 glyph,
1687 scaler); 1687 scaler);
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after
2284 gTextContext->createDrawTextBlob(rt, clip, grPaint, skPaint, viewMat rix, text, 2284 gTextContext->createDrawTextBlob(rt, clip, grPaint, skPaint, viewMat rix, text,
2285 static_cast<size_t>(textLen), 0, 0, noClip)); 2285 static_cast<size_t>(textLen), 0, 0, noClip));
2286 2286
2287 SkScalar transX = static_cast<SkScalar>(random->nextU()); 2287 SkScalar transX = static_cast<SkScalar>(random->nextU());
2288 SkScalar transY = static_cast<SkScalar>(random->nextU()); 2288 SkScalar transY = static_cast<SkScalar>(random->nextU());
2289 const GrAtlasTextBlob::Run::SubRunInfo& info = blob->fRuns[0].fSubRunInfo[0] ; 2289 const GrAtlasTextBlob::Run::SubRunInfo& info = blob->fRuns[0].fSubRunInfo[0] ;
2290 return gTextContext->createBatch(blob, info, textLen, 0, 0, color, transX, t ransY, skPaint); 2290 return gTextContext->createBatch(blob, info, textLen, 0, 0, color, transX, t ransY, skPaint);
2291 } 2291 }
2292 2292
2293 #endif 2293 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrAtlasTextBlob.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698