Chromium Code Reviews| Index: src/gpu/GrAtlasTextContext.h |
| diff --git a/src/gpu/GrAtlasTextContext.h b/src/gpu/GrAtlasTextContext.h |
| index 8a00fa38442748ccb8c8bc2a54550d961b29891b..d18d832bfe4dc5fc39467411120a24bcd88a2c61 100644 |
| --- a/src/gpu/GrAtlasTextContext.h |
| +++ b/src/gpu/GrAtlasTextContext.h |
| @@ -114,6 +114,11 @@ private: |
| // distance field properties |
| bool fDrawAsDistanceFields; |
| bool fUseLCDText; |
| + // Distance field text cannot draw coloremoji, and so has to fall back. However, |
| + // though the distance field text and the coloremoji may share the same run, they |
| + // will have different descriptors. If fOverrideDescriptor is non-NULL, then it |
| + // will be used in place of the run's descriptor to regen texture coords |
| + SkAutoTDelete<SkAutoDescriptor> fOverrideDescriptor; |
|
jvanverth1
2015/04/17 17:07:16
A suggestion to investigate for the future is to c
|
| }; |
| class SubRunInfoArray { |
| @@ -121,8 +126,16 @@ private: |
| SubRunInfoArray() |
| : fSubRunCount(0) |
| , fSubRunAllocation(kMinSubRuns) { |
| + SK_COMPILE_ASSERT(kMinSubRuns > 0, insufficient_subrun_allocation); |
| + // We always seed with one here, so we can assume a valid subrun during |
| + // push_back |
| fPtr = reinterpret_cast<SubRunInfo*>(fSubRunStorage.get()); |
| - this->push_back(); |
| + SkNEW_PLACEMENT(&fPtr[fSubRunCount++], SubRunInfo); |
| + } |
| + ~SubRunInfoArray() { |
| + for (int i = 0; i < fSubRunCount; i++) { |
| + fPtr[i].~SubRunInfo(); |
| + } |
| } |
| int count() const { return fSubRunCount; } |
| @@ -134,6 +147,15 @@ private: |
| fPtr = reinterpret_cast<SubRunInfo*>(fSubRunStorage.get()); |
| } |
| SkNEW_PLACEMENT(&fPtr[fSubRunCount], SubRunInfo); |
| + |
| + // Forward glyph / vertex information to seed the new sub run |
| + SubRunInfo& newSubRun = fPtr[fSubRunCount]; |
| + SubRunInfo& prevSubRun = fPtr[fSubRunCount - 1]; |
| + newSubRun.fGlyphStartIndex = prevSubRun.fGlyphEndIndex; |
| + newSubRun.fGlyphEndIndex = prevSubRun.fGlyphEndIndex; |
| + |
| + newSubRun.fVertexStartIndex = prevSubRun.fVertexEndIndex; |
| + newSubRun.fVertexEndIndex = prevSubRun.fVertexEndIndex; |
| return fPtr[fSubRunCount++]; |
| } |
| SubRunInfo& operator[](int index) { |
| @@ -268,7 +290,7 @@ private: |
| const GrPaint&, const GrClip&); |
| // A helper for drawing BitmapText in a run of distance fields |
| - inline void fallbackDrawPosText(GrRenderTarget*, const GrClip&, |
| + inline void fallbackDrawPosText(BitmapTextBlob*, GrRenderTarget*, const GrClip&, |
| const GrPaint&, |
| const SkPaint&, const SkMatrix& viewMatrix, |
| const SkTDArray<char>& fallbackTxt, |