| 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 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 | 383 |
| 384 SkIRect clipRect; | 384 SkIRect clipRect; |
| 385 clip.getConservativeBounds(rt->width(), rt->height(), &clipRect); | 385 clip.getConservativeBounds(rt->width(), rt->height(), &clipRect); |
| 386 | 386 |
| 387 SkScalar transX = 0.f; | 387 SkScalar transX = 0.f; |
| 388 SkScalar transY = 0.f; | 388 SkScalar transY = 0.f; |
| 389 | 389 |
| 390 // Though for the time being runs in the textblob can override the paint, th
ey only touch font | 390 // Though for the time being runs in the textblob can override the paint, th
ey only touch font |
| 391 // info. | 391 // info. |
| 392 GrPaint grPaint; | 392 GrPaint grPaint; |
| 393 if (!SkPaintToGrPaint(fContext, skPaint, viewMatrix, &grPaint)) { | 393 if (!SkPaintToGrPaint(fContext, skPaint, viewMatrix, &grPaint, rt)) { |
| 394 return; | 394 return; |
| 395 } | 395 } |
| 396 | 396 |
| 397 if (cacheBlob) { | 397 if (cacheBlob) { |
| 398 if (MustRegenerateBlob(&transX, &transY, *cacheBlob, skPaint, grPaint.ge
tColor(), blurRec, | 398 if (MustRegenerateBlob(&transX, &transY, *cacheBlob, skPaint, grPaint.ge
tColor(), blurRec, |
| 399 viewMatrix, x, y)) { | 399 viewMatrix, x, y)) { |
| 400 // We have to remake the blob because changes may invalidate our mas
ks. | 400 // We have to remake the blob because changes may invalidate our mas
ks. |
| 401 // TODO we could probably get away reuse most of the time if the poi
nter is unique, | 401 // TODO we could probably get away reuse most of the time if the poi
nter is unique, |
| 402 // but we'd have to clear the subrun information | 402 // but we'd have to clear the subrun information |
| 403 fCache->remove(cacheBlob); | 403 fCache->remove(cacheBlob); |
| (...skipping 1042 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1446 SkDebugf("Cannot invert viewmatrix\n"); | 1446 SkDebugf("Cannot invert viewmatrix\n"); |
| 1447 return; | 1447 return; |
| 1448 } | 1448 } |
| 1449 | 1449 |
| 1450 GrTexture* texture = fFontCache->getTexture(this->maskFormat()); | 1450 GrTexture* texture = fFontCache->getTexture(this->maskFormat()); |
| 1451 if (!texture) { | 1451 if (!texture) { |
| 1452 SkDebugf("Could not allocate backing texture for atlas\n"); | 1452 SkDebugf("Could not allocate backing texture for atlas\n"); |
| 1453 return; | 1453 return; |
| 1454 } | 1454 } |
| 1455 | 1455 |
| 1456 // This guy is only ever uploaded to |
| 1457 texture->setException(true); |
| 1458 |
| 1456 bool usesDistanceFields = this->usesDistanceFields(); | 1459 bool usesDistanceFields = this->usesDistanceFields(); |
| 1457 GrMaskFormat maskFormat = this->maskFormat(); | 1460 GrMaskFormat maskFormat = this->maskFormat(); |
| 1458 bool isLCD = this->isLCD(); | 1461 bool isLCD = this->isLCD(); |
| 1459 | 1462 |
| 1460 SkAutoTUnref<const GrGeometryProcessor> gp; | 1463 SkAutoTUnref<const GrGeometryProcessor> gp; |
| 1461 if (usesDistanceFields) { | 1464 if (usesDistanceFields) { |
| 1462 gp.reset(this->setupDfProcessor(this->viewMatrix(), fFilteredColor,
this->color(), | 1465 gp.reset(this->setupDfProcessor(this->viewMatrix(), fFilteredColor,
this->color(), |
| 1463 texture)); | 1466 texture, this->rt2())); |
| 1464 } else { | 1467 } else { |
| 1465 GrTextureParams params(SkShader::kClamp_TileMode, GrTextureParams::k
None_FilterMode); | 1468 GrTextureParams params(SkShader::kClamp_TileMode, GrTextureParams::k
None_FilterMode); |
| 1466 gp.reset(GrBitmapTextGeoProc::Create(this->color(), | 1469 gp.reset(GrBitmapTextGeoProc::Create(this->color(), |
| 1467 texture, | 1470 texture, |
| 1468 params, | 1471 params, |
| 1469 maskFormat, | 1472 maskFormat, |
| 1470 localMatrix, | 1473 localMatrix, |
| 1471 this->usesLocalCoords())); | 1474 this->usesLocalCoords(), this->
rt2())); |
| 1472 } | 1475 } |
| 1473 | 1476 |
| 1474 FlushInfo flushInfo; | 1477 FlushInfo flushInfo; |
| 1475 flushInfo.fGlyphsToFlush = 0; | 1478 flushInfo.fGlyphsToFlush = 0; |
| 1476 size_t vertexStride = gp->getVertexStride(); | 1479 size_t vertexStride = gp->getVertexStride(); |
| 1477 SkASSERT(vertexStride == (usesDistanceFields ? | 1480 SkASSERT(vertexStride == (usesDistanceFields ? |
| 1478 get_vertex_stride_df(maskFormat, isLCD) : | 1481 get_vertex_stride_df(maskFormat, isLCD) : |
| 1479 get_vertex_stride(maskFormat))); | 1482 get_vertex_stride(maskFormat))); |
| 1480 | 1483 |
| 1481 target->initDraw(gp, this->pipeline()); | 1484 target->initDraw(gp, this->pipeline()); |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1599 brokenRun = glyphIdx > 0; | 1602 brokenRun = glyphIdx > 0; |
| 1600 | 1603 |
| 1601 SkDEBUGCODE(bool success =) strike->addGlyphToAtlas(
target, | 1604 SkDEBUGCODE(bool success =) strike->addGlyphToAtlas(
target, |
| 1602
glyph, | 1605
glyph, |
| 1603
scaler, | 1606
scaler, |
| 1604
skGlyph, | 1607
skGlyph, |
| 1605
maskFormat); | 1608
maskFormat); |
| 1606 SkASSERT(success); | 1609 SkASSERT(success); |
| 1607 } | 1610 } |
| 1608 fFontCache->addGlyphToBulkAndSetUseToken(&info.fBulkUseT
oken, glyph, | 1611 fFontCache->addGlyphToBulkAndSetUseToken(&info.fBulkUseT
oken, glyph, |
| 1609 target->current
Token()); | 1612 target->current
Token1()); |
| 1610 | 1613 |
| 1611 // Texture coords are the last vertex attribute so we ge
t a pointer to the | 1614 // Texture coords are the last vertex attribute so we ge
t a pointer to the |
| 1612 // first one and then map with stride in regenerateTextu
reCoords | 1615 // first one and then map with stride in regenerateTextu
reCoords |
| 1613 intptr_t vertex = reinterpret_cast<intptr_t>(blob->fVert
ices); | 1616 intptr_t vertex = reinterpret_cast<intptr_t>(blob->fVert
ices); |
| 1614 vertex += info.fVertexStartIndex; | 1617 vertex += info.fVertexStartIndex; |
| 1615 vertex += vertexStride * glyphIdx * kVerticesPerGlyph; | 1618 vertex += vertexStride * glyphIdx * kVerticesPerGlyph; |
| 1616 vertex += vertexStride - sizeof(SkIPoint16); | 1619 vertex += vertexStride - sizeof(SkIPoint16); |
| 1617 | 1620 |
| 1618 this->regenerateTextureCoords(glyph, vertex, vertexStrid
e); | 1621 this->regenerateTextureCoords(glyph, vertex, vertexStrid
e); |
| 1619 } | 1622 } |
| (...skipping 23 matching lines...) Expand all Loading... |
| 1643 info.fStrike.reset(SkRef(strike)); | 1646 info.fStrike.reset(SkRef(strike)); |
| 1644 } | 1647 } |
| 1645 info.fAtlasGeneration = brokenRun ? GrBatchAtlas::kInvalidAt
lasGeneration : | 1648 info.fAtlasGeneration = brokenRun ? GrBatchAtlas::kInvalidAt
lasGeneration : |
| 1646 fFontCache->atlasGenerat
ion(maskFormat); | 1649 fFontCache->atlasGenerat
ion(maskFormat); |
| 1647 } | 1650 } |
| 1648 } else { | 1651 } else { |
| 1649 flushInfo.fGlyphsToFlush += glyphCount; | 1652 flushInfo.fGlyphsToFlush += glyphCount; |
| 1650 | 1653 |
| 1651 // set use tokens for all of the glyphs in our subrun. This is
only valid if we | 1654 // set use tokens for all of the glyphs in our subrun. This is
only valid if we |
| 1652 // have a valid atlas generation | 1655 // have a valid atlas generation |
| 1653 fFontCache->setUseTokenBulk(info.fBulkUseToken, target->currentT
oken(), maskFormat); | 1656 fFontCache->setUseTokenBulk(info.fBulkUseToken, target->currentT
oken1(), maskFormat); |
| 1654 } | 1657 } |
| 1655 | 1658 |
| 1656 // now copy all vertices | 1659 // now copy all vertices |
| 1657 size_t byteCount = info.fVertexEndIndex - info.fVertexStartIndex; | 1660 size_t byteCount = info.fVertexEndIndex - info.fVertexStartIndex; |
| 1658 memcpy(currVertex, blob->fVertices + info.fVertexStartIndex, byteCou
nt); | 1661 memcpy(currVertex, blob->fVertices + info.fVertexStartIndex, byteCou
nt); |
| 1659 | 1662 |
| 1660 currVertex += byteCount; | 1663 currVertex += byteCount; |
| 1661 } | 1664 } |
| 1662 // Make sure to attach the last cache if applicable | 1665 // Make sure to attach the last cache if applicable |
| 1663 if (cache) { | 1666 if (cache) { |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1835 that->fGeoCount = 0; | 1838 that->fGeoCount = 0; |
| 1836 fGeoCount = newGeoCount; | 1839 fGeoCount = newGeoCount; |
| 1837 | 1840 |
| 1838 this->joinBounds(that->bounds()); | 1841 this->joinBounds(that->bounds()); |
| 1839 return true; | 1842 return true; |
| 1840 } | 1843 } |
| 1841 | 1844 |
| 1842 // TODO just use class params | 1845 // TODO just use class params |
| 1843 // TODO trying to figure out why lcd is so whack | 1846 // TODO trying to figure out why lcd is so whack |
| 1844 GrGeometryProcessor* setupDfProcessor(const SkMatrix& viewMatrix, SkColor fi
lteredColor, | 1847 GrGeometryProcessor* setupDfProcessor(const SkMatrix& viewMatrix, SkColor fi
lteredColor, |
| 1845 GrColor color, GrTexture* texture) { | 1848 GrColor color, GrTexture* texture, GrR
enderTarget* dst) { |
| 1846 GrTextureParams params(SkShader::kClamp_TileMode, GrTextureParams::kBile
rp_FilterMode); | 1849 GrTextureParams params(SkShader::kClamp_TileMode, GrTextureParams::kBile
rp_FilterMode); |
| 1847 bool isLCD = this->isLCD(); | 1850 bool isLCD = this->isLCD(); |
| 1848 // set up any flags | 1851 // set up any flags |
| 1849 uint32_t flags = viewMatrix.isSimilarity() ? kSimilarity_DistanceFieldEf
fectFlag : 0; | 1852 uint32_t flags = viewMatrix.isSimilarity() ? kSimilarity_DistanceFieldEf
fectFlag : 0; |
| 1850 | 1853 |
| 1851 // see if we need to create a new effect | 1854 // see if we need to create a new effect |
| 1852 if (isLCD) { | 1855 if (isLCD) { |
| 1853 flags |= kUseLCD_DistanceFieldEffectFlag; | 1856 flags |= kUseLCD_DistanceFieldEffectFlag; |
| 1854 flags |= viewMatrix.rectStaysRect() ? kRectToRect_DistanceFieldEffec
tFlag : 0; | 1857 flags |= viewMatrix.rectStaysRect() ? kRectToRect_DistanceFieldEffec
tFlag : 0; |
| 1855 flags |= fUseBGR ? kBGR_DistanceFieldEffectFlag : 0; | 1858 flags |= fUseBGR ? kBGR_DistanceFieldEffectFlag : 0; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1866 GrDistanceFieldLCDTextGeoProc::DistanceAdjust::Make(redCorrectio
n, | 1869 GrDistanceFieldLCDTextGeoProc::DistanceAdjust::Make(redCorrectio
n, |
| 1867 greenCorrect
ion, | 1870 greenCorrect
ion, |
| 1868 blueCorrecti
on); | 1871 blueCorrecti
on); |
| 1869 | 1872 |
| 1870 return GrDistanceFieldLCDTextGeoProc::Create(color, | 1873 return GrDistanceFieldLCDTextGeoProc::Create(color, |
| 1871 viewMatrix, | 1874 viewMatrix, |
| 1872 texture, | 1875 texture, |
| 1873 params, | 1876 params, |
| 1874 widthAdjust, | 1877 widthAdjust, |
| 1875 flags, | 1878 flags, |
| 1876 this->usesLocalCoords()
); | 1879 this->usesLocalCoords()
, dst); |
| 1877 } else { | 1880 } else { |
| 1878 flags |= kColorAttr_DistanceFieldEffectFlag; | 1881 flags |= kColorAttr_DistanceFieldEffectFlag; |
| 1879 #ifdef SK_GAMMA_APPLY_TO_A8 | 1882 #ifdef SK_GAMMA_APPLY_TO_A8 |
| 1880 U8CPU lum = SkColorSpaceLuminance::computeLuminance(SK_GAMMA_EXPONEN
T, filteredColor); | 1883 U8CPU lum = SkColorSpaceLuminance::computeLuminance(SK_GAMMA_EXPONEN
T, filteredColor); |
| 1881 float correction = (*fDistanceAdjustTable)[lum >> kDistanceAdjustLum
Shift]; | 1884 float correction = (*fDistanceAdjustTable)[lum >> kDistanceAdjustLum
Shift]; |
| 1882 return GrDistanceFieldA8TextGeoProc::Create(color, | 1885 return GrDistanceFieldA8TextGeoProc::Create(color, |
| 1883 viewMatrix, | 1886 viewMatrix, |
| 1884 texture, | 1887 texture, |
| 1885 params, | 1888 params, |
| 1886 correction, | 1889 correction, |
| 1887 flags, | 1890 flags, |
| 1888 this->usesLocalCoords())
; | 1891 this->usesLocalCoords(),
dst); |
| 1889 #else | 1892 #else |
| 1890 return GrDistanceFieldA8TextGeoProc::Create(color, | 1893 return GrDistanceFieldA8TextGeoProc::Create(color, |
| 1891 viewMatrix, | 1894 viewMatrix, |
| 1892 texture, | 1895 texture, |
| 1893 params, | 1896 params, |
| 1894 flags, | 1897 flags, |
| 1895 this->usesLocalCoords())
; | 1898 this->usesLocalCoords())
; |
| 1896 #endif | 1899 #endif |
| 1897 } | 1900 } |
| 1898 | 1901 |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2007 geometry.fTransX = transX; | 2010 geometry.fTransX = transX; |
| 2008 geometry.fTransY = transY; | 2011 geometry.fTransY = transY; |
| 2009 batch->init(); | 2012 batch->init(); |
| 2010 | 2013 |
| 2011 return batch; | 2014 return batch; |
| 2012 } | 2015 } |
| 2013 | 2016 |
| 2014 inline void GrAtlasTextContext::flushRun(GrDrawContext* dc, GrPipelineBuilder* p
ipelineBuilder, | 2017 inline void GrAtlasTextContext::flushRun(GrDrawContext* dc, GrPipelineBuilder* p
ipelineBuilder, |
| 2015 GrAtlasTextBlob* cacheBlob, int run, Gr
Color color, | 2018 GrAtlasTextBlob* cacheBlob, int run, Gr
Color color, |
| 2016 SkScalar transX, SkScalar transY, | 2019 SkScalar transX, SkScalar transY, |
| 2017 const SkPaint& skPaint) { | 2020 const SkPaint& skPaint, |
| 2021 GrRenderTarget* rt) { |
| 2018 for (int subRun = 0; subRun < cacheBlob->fRuns[run].fSubRunInfo.count(); sub
Run++) { | 2022 for (int subRun = 0; subRun < cacheBlob->fRuns[run].fSubRunInfo.count(); sub
Run++) { |
| 2019 const PerSubRunInfo& info = cacheBlob->fRuns[run].fSubRunInfo[subRun]; | 2023 const PerSubRunInfo& info = cacheBlob->fRuns[run].fSubRunInfo[subRun]; |
| 2020 int glyphCount = info.fGlyphEndIndex - info.fGlyphStartIndex; | 2024 int glyphCount = info.fGlyphEndIndex - info.fGlyphStartIndex; |
| 2021 if (0 == glyphCount) { | 2025 if (0 == glyphCount) { |
| 2022 continue; | 2026 continue; |
| 2023 } | 2027 } |
| 2024 | 2028 |
| 2025 SkAutoTUnref<GrDrawBatch> batch(this->createBatch(cacheBlob, info, glyph
Count, run, | 2029 SkAutoTUnref<GrDrawBatch> batch(this->createBatch(cacheBlob, info, glyph
Count, run, |
| 2026 subRun, color, transX,
transY, | 2030 subRun, color, transX,
transY, |
| 2027 skPaint)); | 2031 skPaint)); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2074 | 2078 |
| 2075 SkTextBlobRunIterator it(blob); | 2079 SkTextBlobRunIterator it(blob); |
| 2076 for (int run = 0; !it.done(); it.next(), run++) { | 2080 for (int run = 0; !it.done(); it.next(), run++) { |
| 2077 if (cacheBlob->fRuns[run].fDrawAsPaths) { | 2081 if (cacheBlob->fRuns[run].fDrawAsPaths) { |
| 2078 this->flushRunAsPaths(dc, rt, it, clip, skPaint, | 2082 this->flushRunAsPaths(dc, rt, it, clip, skPaint, |
| 2079 drawFilter, viewMatrix, clipBounds, x, y); | 2083 drawFilter, viewMatrix, clipBounds, x, y); |
| 2080 continue; | 2084 continue; |
| 2081 } | 2085 } |
| 2082 cacheBlob->fRuns[run].fVertexBounds.offset(transX, transY); | 2086 cacheBlob->fRuns[run].fVertexBounds.offset(transX, transY); |
| 2083 this->flushRun(dc, &pipelineBuilder, cacheBlob, run, color, | 2087 this->flushRun(dc, &pipelineBuilder, cacheBlob, run, color, |
| 2084 transX, transY, skPaint); | 2088 transX, transY, skPaint, rt); |
| 2085 } | 2089 } |
| 2086 | 2090 |
| 2087 // Now flush big glyphs | 2091 // Now flush big glyphs |
| 2088 this->flushBigGlyphs(cacheBlob, dc, rt, clip, skPaint, transX, transY, clipB
ounds); | 2092 this->flushBigGlyphs(cacheBlob, dc, rt, clip, skPaint, transX, transY, clipB
ounds); |
| 2089 } | 2093 } |
| 2090 | 2094 |
| 2091 void GrAtlasTextContext::flush(GrAtlasTextBlob* cacheBlob, | 2095 void GrAtlasTextContext::flush(GrAtlasTextBlob* cacheBlob, |
| 2092 GrDrawContext* dc, | 2096 GrDrawContext* dc, |
| 2093 GrRenderTarget* rt, | 2097 GrRenderTarget* rt, |
| 2094 const SkPaint& skPaint, | 2098 const SkPaint& skPaint, |
| 2095 const GrPaint& grPaint, | 2099 const GrPaint& grPaint, |
| 2096 const GrClip& clip, | 2100 const GrClip& clip, |
| 2097 const SkIRect& clipBounds) { | 2101 const SkIRect& clipBounds) { |
| 2098 GrPipelineBuilder pipelineBuilder(grPaint, rt, clip); | 2102 GrPipelineBuilder pipelineBuilder(grPaint, rt, clip); |
| 2099 | 2103 |
| 2100 GrColor color = grPaint.getColor(); | 2104 GrColor color = grPaint.getColor(); |
| 2101 for (int run = 0; run < cacheBlob->fRunCount; run++) { | 2105 for (int run = 0; run < cacheBlob->fRunCount; run++) { |
| 2102 this->flushRun(dc, &pipelineBuilder, cacheBlob, run, color, 0, 0, skPain
t); | 2106 this->flushRun(dc, &pipelineBuilder, cacheBlob, run, color, 0, 0, skPain
t, rt); |
| 2103 } | 2107 } |
| 2104 | 2108 |
| 2105 // Now flush big glyphs | 2109 // Now flush big glyphs |
| 2106 this->flushBigGlyphs(cacheBlob, dc, rt, clip, skPaint, 0, 0, clipBounds); | 2110 this->flushBigGlyphs(cacheBlob, dc, rt, clip, skPaint, 0, 0, clipBounds); |
| 2107 } | 2111 } |
| 2108 | 2112 |
| 2109 ////////////////////////////////////////////////////////////////////////////////
/////////////////// | 2113 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
| 2110 | 2114 |
| 2111 #ifdef GR_TEST_UTILS | 2115 #ifdef GR_TEST_UTILS |
| 2112 | 2116 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 2140 // Setup dummy SkPaint / GrPaint | 2144 // Setup dummy SkPaint / GrPaint |
| 2141 GrColor color = GrRandomColor(random); | 2145 GrColor color = GrRandomColor(random); |
| 2142 SkMatrix viewMatrix = GrTest::TestMatrixInvertible(random); | 2146 SkMatrix viewMatrix = GrTest::TestMatrixInvertible(random); |
| 2143 SkPaint skPaint; | 2147 SkPaint skPaint; |
| 2144 skPaint.setColor(color); | 2148 skPaint.setColor(color); |
| 2145 skPaint.setLCDRenderText(random->nextBool()); | 2149 skPaint.setLCDRenderText(random->nextBool()); |
| 2146 skPaint.setAntiAlias(skPaint.isLCDRenderText() ? true : random->nextBool()); | 2150 skPaint.setAntiAlias(skPaint.isLCDRenderText() ? true : random->nextBool()); |
| 2147 skPaint.setSubpixelText(random->nextBool()); | 2151 skPaint.setSubpixelText(random->nextBool()); |
| 2148 | 2152 |
| 2149 GrPaint grPaint; | 2153 GrPaint grPaint; |
| 2150 if (!SkPaintToGrPaint(context, skPaint, viewMatrix, &grPaint)) { | 2154 if (!SkPaintToGrPaint(context, skPaint, viewMatrix, &grPaint, rt)) { |
| 2151 SkFAIL("couldn't convert paint\n"); | 2155 SkFAIL("couldn't convert paint\n"); |
| 2152 } | 2156 } |
| 2153 | 2157 |
| 2154 const char* text = "The quick brown fox jumps over the lazy dog."; | 2158 const char* text = "The quick brown fox jumps over the lazy dog."; |
| 2155 int textLen = (int)strlen(text); | 2159 int textLen = (int)strlen(text); |
| 2156 | 2160 |
| 2157 // Setup clip | 2161 // Setup clip |
| 2158 GrClip clip; | 2162 GrClip clip; |
| 2159 SkIRect noClip = SkIRect::MakeLargest(); | 2163 SkIRect noClip = SkIRect::MakeLargest(); |
| 2160 | 2164 |
| 2161 // right now we don't handle textblobs, nor do we handle drawPosText. Since
we only | 2165 // right now we don't handle textblobs, nor do we handle drawPosText. Since
we only |
| 2162 // intend to test the batch with this unit test, that is okay. | 2166 // intend to test the batch with this unit test, that is okay. |
| 2163 SkAutoTUnref<GrAtlasTextBlob> blob( | 2167 SkAutoTUnref<GrAtlasTextBlob> blob( |
| 2164 gTextContext->createDrawTextBlob(rt, clip, grPaint, skPaint, viewMat
rix, text, | 2168 gTextContext->createDrawTextBlob(rt, clip, grPaint, skPaint, viewMat
rix, text, |
| 2165 static_cast<size_t>(textLen), 0, 0,
noClip)); | 2169 static_cast<size_t>(textLen), 0, 0,
noClip)); |
| 2166 | 2170 |
| 2167 SkScalar transX = static_cast<SkScalar>(random->nextU()); | 2171 SkScalar transX = static_cast<SkScalar>(random->nextU()); |
| 2168 SkScalar transY = static_cast<SkScalar>(random->nextU()); | 2172 SkScalar transY = static_cast<SkScalar>(random->nextU()); |
| 2169 const GrAtlasTextBlob::Run::SubRunInfo& info = blob->fRuns[0].fSubRunInfo[0]
; | 2173 const GrAtlasTextBlob::Run::SubRunInfo& info = blob->fRuns[0].fSubRunInfo[0]
; |
| 2170 return gTextContext->createBatch(blob, info, textLen, 0, 0, color, transX, t
ransY, skPaint); | 2174 return gTextContext->createBatch(blob, info, textLen, 0, 0, color, transX, t
ransY, skPaint); |
| 2171 } | 2175 } |
| 2172 | 2176 |
| 2173 #endif | 2177 #endif |
| OLD | NEW |