| 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 1563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1574 bool usesDistanceFields = this->usesDistanceFields(); | 1574 bool usesDistanceFields = this->usesDistanceFields(); |
| 1575 GrMaskFormat maskFormat = this->maskFormat(); | 1575 GrMaskFormat maskFormat = this->maskFormat(); |
| 1576 bool isLCD = this->isLCD(); | 1576 bool isLCD = this->isLCD(); |
| 1577 | 1577 |
| 1578 SkAutoTUnref<const GrGeometryProcessor> gp; | 1578 SkAutoTUnref<const GrGeometryProcessor> gp; |
| 1579 if (usesDistanceFields) { | 1579 if (usesDistanceFields) { |
| 1580 gp.reset(this->setupDfProcessor(this->viewMatrix(), fFilteredColor,
this->color(), | 1580 gp.reset(this->setupDfProcessor(this->viewMatrix(), fFilteredColor,
this->color(), |
| 1581 texture)); | 1581 texture)); |
| 1582 } else { | 1582 } else { |
| 1583 GrTextureParams params(SkShader::kClamp_TileMode, GrTextureParams::k
None_FilterMode); | 1583 GrTextureParams params(SkShader::kClamp_TileMode, GrTextureParams::k
None_FilterMode); |
| 1584 gp.reset(GrBitmapTextGeoProc::Create(this->color(), | 1584 if ((maskFormat == kARGB_GrMaskFormat && fBatch.fColorIgnored)) { |
| 1585 texture, | 1585 gp.reset(GrGeometryProcessor::CreatePassthroughGP(kColorTextVASi
ze)); |
| 1586 params, | 1586 } else { |
| 1587 maskFormat, | 1587 gp.reset(GrBitmapTextGeoProc::Create(this->color(), |
| 1588 localMatrix, | 1588 texture, |
| 1589 this->usesLocalCoords())); | 1589 params, |
| 1590 maskFormat, |
| 1591 localMatrix, |
| 1592 this->usesLocalCoords())); |
| 1593 } |
| 1590 } | 1594 } |
| 1591 | 1595 |
| 1592 FlushInfo flushInfo; | 1596 FlushInfo flushInfo; |
| 1593 flushInfo.fGlyphsToFlush = 0; | 1597 flushInfo.fGlyphsToFlush = 0; |
| 1594 size_t vertexStride = gp->getVertexStride(); | 1598 size_t vertexStride = gp->getVertexStride(); |
| 1595 SkASSERT(vertexStride == (usesDistanceFields ? | 1599 SkASSERT(vertexStride == (usesDistanceFields ? |
| 1596 get_vertex_stride_df(maskFormat, isLCD) : | 1600 get_vertex_stride_df(maskFormat, isLCD) : |
| 1597 get_vertex_stride(maskFormat))); | 1601 get_vertex_stride(maskFormat))); |
| 1598 | 1602 |
| 1599 target->initDraw(gp, this->pipeline()); | 1603 target->initDraw(gp, this->pipeline()); |
| (...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2282 gTextContext->createDrawTextBlob(rt, clip, grPaint, skPaint, viewMat
rix, text, | 2286 gTextContext->createDrawTextBlob(rt, clip, grPaint, skPaint, viewMat
rix, text, |
| 2283 static_cast<size_t>(textLen), 0, 0,
noClip)); | 2287 static_cast<size_t>(textLen), 0, 0,
noClip)); |
| 2284 | 2288 |
| 2285 SkScalar transX = static_cast<SkScalar>(random->nextU()); | 2289 SkScalar transX = static_cast<SkScalar>(random->nextU()); |
| 2286 SkScalar transY = static_cast<SkScalar>(random->nextU()); | 2290 SkScalar transY = static_cast<SkScalar>(random->nextU()); |
| 2287 const GrAtlasTextBlob::Run::SubRunInfo& info = blob->fRuns[0].fSubRunInfo[0]
; | 2291 const GrAtlasTextBlob::Run::SubRunInfo& info = blob->fRuns[0].fSubRunInfo[0]
; |
| 2288 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); |
| 2289 } | 2293 } |
| 2290 | 2294 |
| 2291 #endif | 2295 #endif |
| OLD | NEW |