| 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 "GrBatch.h" | 9 #include "GrBatch.h" |
| 10 #include "GrBatchFontCache.h" | 10 #include "GrBatchFontCache.h" |
| (...skipping 2129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2140 subRun, color, tra
nsX, transY, | 2140 subRun, color, tra
nsX, transY, |
| 2141 skPaint)); | 2141 skPaint)); |
| 2142 target->drawBatch(pipelineBuilder, batch); | 2142 target->drawBatch(pipelineBuilder, batch); |
| 2143 } | 2143 } |
| 2144 } | 2144 } |
| 2145 | 2145 |
| 2146 inline void GrAtlasTextContext::flushBigGlyphs(BitmapTextBlob* cacheBlob, GrRend
erTarget* rt, | 2146 inline void GrAtlasTextContext::flushBigGlyphs(BitmapTextBlob* cacheBlob, GrRend
erTarget* rt, |
| 2147 const SkPaint& skPaint, | 2147 const SkPaint& skPaint, |
| 2148 SkScalar transX, SkScalar transY, | 2148 SkScalar transX, SkScalar transY, |
| 2149 const SkIRect& clipBounds) { | 2149 const SkIRect& clipBounds) { |
| 2150 if (!cacheBlob->fBigGlyphs.count()) { |
| 2151 return; |
| 2152 } |
| 2153 |
| 2154 SkMatrix pathMatrix; |
| 2155 if (!cacheBlob->fViewMatrix.invert(&pathMatrix)) { |
| 2156 SkDebugf("could not invert viewmatrix\n"); |
| 2157 return; |
| 2158 } |
| 2159 |
| 2150 for (int i = 0; i < cacheBlob->fBigGlyphs.count(); i++) { | 2160 for (int i = 0; i < cacheBlob->fBigGlyphs.count(); i++) { |
| 2151 BitmapTextBlob::BigGlyph& bigGlyph = cacheBlob->fBigGlyphs[i]; | 2161 BitmapTextBlob::BigGlyph& bigGlyph = cacheBlob->fBigGlyphs[i]; |
| 2152 bigGlyph.fVx += transX; | 2162 bigGlyph.fVx += transX; |
| 2153 bigGlyph.fVy += transY; | 2163 bigGlyph.fVy += transY; |
| 2154 SkMatrix translate; | 2164 SkMatrix translate = cacheBlob->fViewMatrix; |
| 2155 translate.setTranslate(bigGlyph.fVx, bigGlyph.fVy); | 2165 translate.postTranslate(bigGlyph.fVx, bigGlyph.fVy); |
| 2156 fGpuDevice->internalDrawPath(bigGlyph.fPath, skPaint, SkMatrix::I(), &tr
anslate, clipBounds, | 2166 |
| 2167 fGpuDevice->internalDrawPath(bigGlyph.fPath, skPaint, translate, &pathMa
trix, clipBounds, |
| 2157 false); | 2168 false); |
| 2158 } | 2169 } |
| 2159 } | 2170 } |
| 2160 | 2171 |
| 2161 void GrAtlasTextContext::flush(GrDrawTarget* target, | 2172 void GrAtlasTextContext::flush(GrDrawTarget* target, |
| 2162 const SkTextBlob* blob, | 2173 const SkTextBlob* blob, |
| 2163 BitmapTextBlob* cacheBlob, | 2174 BitmapTextBlob* cacheBlob, |
| 2164 GrRenderTarget* rt, | 2175 GrRenderTarget* rt, |
| 2165 const SkPaint& skPaint, | 2176 const SkPaint& skPaint, |
| 2166 const GrPaint& grPaint, | 2177 const GrPaint& grPaint, |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2268 gTextContext->createDrawTextBlob(rt, clip, grPaint, skPaint, viewMat
rix, text, | 2279 gTextContext->createDrawTextBlob(rt, clip, grPaint, skPaint, viewMat
rix, text, |
| 2269 static_cast<size_t>(textLen), 0, 0,
noClip)); | 2280 static_cast<size_t>(textLen), 0, 0,
noClip)); |
| 2270 | 2281 |
| 2271 SkScalar transX = static_cast<SkScalar>(random->nextU()); | 2282 SkScalar transX = static_cast<SkScalar>(random->nextU()); |
| 2272 SkScalar transY = static_cast<SkScalar>(random->nextU()); | 2283 SkScalar transY = static_cast<SkScalar>(random->nextU()); |
| 2273 const GrAtlasTextContext::BitmapTextBlob::Run::SubRunInfo& info = blob->fRun
s[0].fSubRunInfo[0]; | 2284 const GrAtlasTextContext::BitmapTextBlob::Run::SubRunInfo& info = blob->fRun
s[0].fSubRunInfo[0]; |
| 2274 return gTextContext->createBatch(blob, info, textLen, 0, 0, color, transX, t
ransY, skPaint); | 2285 return gTextContext->createBatch(blob, info, textLen, 0, 0, color, transX, t
ransY, skPaint); |
| 2275 } | 2286 } |
| 2276 | 2287 |
| 2277 #endif | 2288 #endif |
| OLD | NEW |