| OLD | NEW |
| 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 "GrBatchFontCache.h" | 9 #include "GrBatchFontCache.h" |
| 10 #include "GrBatchFlushState.h" | 10 #include "GrBatchFlushState.h" |
| (...skipping 1653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1664 // Because we do not have the packed ids, and thus can't look up
our glyphs in the | 1664 // Because we do not have the packed ids, and thus can't look up
our glyphs in the |
| 1665 // new strike, we instead keep our ref to the old strike and use
the packed ids from | 1665 // new strike, we instead keep our ref to the old strike and use
the packed ids from |
| 1666 // it. These ids will still be valid as long as we hold the ref
. When we are done | 1666 // it. These ids will still be valid as long as we hold the ref
. When we are done |
| 1667 // updating our cache of the GrGlyph*s, we drop our ref on the o
ld strike | 1667 // updating our cache of the GrGlyph*s, we drop our ref on the o
ld strike |
| 1668 bool regenerateGlyphs = false; | 1668 bool regenerateGlyphs = false; |
| 1669 GrBatchTextStrike* strike = nullptr; | 1669 GrBatchTextStrike* strike = nullptr; |
| 1670 if (regenerateTextureCoords) { | 1670 if (regenerateTextureCoords) { |
| 1671 info.fBulkUseToken.reset(); | 1671 info.fBulkUseToken.reset(); |
| 1672 | 1672 |
| 1673 // We can reuse if we have a valid strike and our descriptor
s / typeface are the | 1673 // We can reuse if we have a valid strike and our descriptor
s / typeface are the |
| 1674 // same | 1674 // same. The override descriptor is only for the non distan
ce field text within |
| 1675 const SkDescriptor* newDesc = run.fOverrideDescriptor ? | 1675 // a run |
| 1676 const SkDescriptor* newDesc = (run.fOverrideDescriptor && !u
sesDistanceFields) ? |
| 1676 run.fOverrideDescriptor->getDe
sc() : | 1677 run.fOverrideDescriptor->getDe
sc() : |
| 1677 run.fDescriptor.getDesc(); | 1678 run.fDescriptor.getDesc(); |
| 1678 if (!cache || !SkTypeface::Equal(typeface, run.fTypeface) || | 1679 if (!cache || !SkTypeface::Equal(typeface, run.fTypeface) || |
| 1679 !(desc->equals(*newDesc))) { | 1680 !(desc->equals(*newDesc))) { |
| 1680 if (cache) { | 1681 if (cache) { |
| 1681 SkGlyphCache::AttachCache(cache); | 1682 SkGlyphCache::AttachCache(cache); |
| 1682 } | 1683 } |
| 1683 desc = newDesc; | 1684 desc = newDesc; |
| 1684 cache = SkGlyphCache::DetachCache(run.fTypeface, desc); | 1685 cache = SkGlyphCache::DetachCache(run.fTypeface, desc); |
| 1685 scaler = GrTextContext::GetGrFontScaler(cache); | 1686 scaler = GrTextContext::GetGrFontScaler(cache); |
| (...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2285 gTextContext->createDrawTextBlob(rt, clip, grPaint, skPaint, viewMat
rix, text, | 2286 gTextContext->createDrawTextBlob(rt, clip, grPaint, skPaint, viewMat
rix, text, |
| 2286 static_cast<size_t>(textLen), 0, 0,
noClip)); | 2287 static_cast<size_t>(textLen), 0, 0,
noClip)); |
| 2287 | 2288 |
| 2288 SkScalar transX = static_cast<SkScalar>(random->nextU()); | 2289 SkScalar transX = static_cast<SkScalar>(random->nextU()); |
| 2289 SkScalar transY = static_cast<SkScalar>(random->nextU()); | 2290 SkScalar transY = static_cast<SkScalar>(random->nextU()); |
| 2290 const GrAtlasTextBlob::Run::SubRunInfo& info = blob->fRuns[0].fSubRunInfo[0]
; | 2291 const GrAtlasTextBlob::Run::SubRunInfo& info = blob->fRuns[0].fSubRunInfo[0]
; |
| 2291 return gTextContext->createBatch(blob, info, textLen, 0, 0, color, transX, t
ransY, skPaint); | 2292 return gTextContext->createBatch(blob, info, textLen, 0, 0, color, transX, t
ransY, skPaint); |
| 2292 } | 2293 } |
| 2293 | 2294 |
| 2294 #endif | 2295 #endif |
| OLD | NEW |