Move (re)generation of the GrTextBlob from GrTextContext to the blob
This resolves many scoping issues, which complicate this code. Change-Id: Ib0d283d95ff8a563176a333c8d388947650df4d2 Reviewed-on: https://skia-review.googlesource.com/c/169761 Reviewed-by: Mike Klein <mtklein@google.com> Commit-Queue: Herb Derby <herb@google.com>
This commit is contained in:
parent
51b1c12bbc
commit
dc214c2cb5
@ -517,10 +517,10 @@ void GrTextContext::drawGlyphRunList(
|
|||||||
// but we'd have to clear the subrun information
|
// but we'd have to clear the subrun information
|
||||||
textBlobCache->remove(cacheBlob.get());
|
textBlobCache->remove(cacheBlob.get());
|
||||||
cacheBlob = textBlobCache->makeCachedBlob(glyphRunList, key, blurRec, listPaint);
|
cacheBlob = textBlobCache->makeCachedBlob(glyphRunList, key, blurRec, listPaint);
|
||||||
this->regenerateGlyphRunList(cacheBlob.get(), glyphCache,
|
cacheBlob->generateFromGlyphRunList(
|
||||||
*context->contextPriv().caps()->shaderCaps(), listPaint,
|
glyphCache, *context->contextPriv().caps()->shaderCaps(), fOptions,
|
||||||
filteredColor, scalerContextFlags, viewMatrix, props,
|
listPaint, filteredColor, scalerContextFlags, viewMatrix, props,
|
||||||
glyphRunList, target->glyphPainter());
|
glyphRunList, target->glyphPainter());
|
||||||
} else {
|
} else {
|
||||||
textBlobCache->makeMRU(cacheBlob.get());
|
textBlobCache->makeMRU(cacheBlob.get());
|
||||||
|
|
||||||
@ -529,8 +529,8 @@ void GrTextContext::drawGlyphRunList(
|
|||||||
int runCount = glyphRunList.runCount();
|
int runCount = glyphRunList.runCount();
|
||||||
sk_sp<GrTextBlob> sanityBlob(textBlobCache->makeBlob(glyphCount, runCount));
|
sk_sp<GrTextBlob> sanityBlob(textBlobCache->makeBlob(glyphCount, runCount));
|
||||||
sanityBlob->setupKey(key, blurRec, listPaint);
|
sanityBlob->setupKey(key, blurRec, listPaint);
|
||||||
this->regenerateGlyphRunList(
|
cacheBlob->generateFromGlyphRunList(
|
||||||
sanityBlob.get(), glyphCache, *context->contextPriv().caps()->shaderCaps(),
|
glyphCache, *context->contextPriv().caps()->shaderCaps(), fOptions,
|
||||||
listPaint, filteredColor, scalerContextFlags, viewMatrix, props, glyphRunList,
|
listPaint, filteredColor, scalerContextFlags, viewMatrix, props, glyphRunList,
|
||||||
target->glyphPainter());
|
target->glyphPainter());
|
||||||
GrTextBlob::AssertEqual(*sanityBlob, *cacheBlob);
|
GrTextBlob::AssertEqual(*sanityBlob, *cacheBlob);
|
||||||
@ -542,17 +542,17 @@ void GrTextContext::drawGlyphRunList(
|
|||||||
} else {
|
} else {
|
||||||
cacheBlob = textBlobCache->makeBlob(glyphRunList);
|
cacheBlob = textBlobCache->makeBlob(glyphRunList);
|
||||||
}
|
}
|
||||||
this->regenerateGlyphRunList(cacheBlob.get(), glyphCache,
|
cacheBlob->generateFromGlyphRunList(
|
||||||
*context->contextPriv().caps()->shaderCaps(), listPaint,
|
glyphCache, *context->contextPriv().caps()->shaderCaps(), fOptions, listPaint,
|
||||||
filteredColor, scalerContextFlags, viewMatrix, props,
|
filteredColor, scalerContextFlags, viewMatrix, props, glyphRunList,
|
||||||
glyphRunList, target->glyphPainter());
|
target->glyphPainter());
|
||||||
}
|
}
|
||||||
|
|
||||||
cacheBlob->flush(target, props, fDistanceAdjustTable.get(), listPaint, filteredColor,
|
cacheBlob->flush(target, props, fDistanceAdjustTable.get(), listPaint, filteredColor,
|
||||||
clip, viewMatrix, origin.x(), origin.y());
|
clip, viewMatrix, origin.x(), origin.y());
|
||||||
}
|
}
|
||||||
|
|
||||||
void GrTextContext::AppendGlyph(GrTextBlob* blob, int runIndex,
|
static void append_glyph(GrTextBlob* blob, int runIndex,
|
||||||
const sk_sp<GrTextStrike>& strike,
|
const sk_sp<GrTextStrike>& strike,
|
||||||
const SkGlyph& skGlyph, GrGlyph::MaskStyle maskStyle,
|
const SkGlyph& skGlyph, GrGlyph::MaskStyle maskStyle,
|
||||||
SkScalar sx, SkScalar sy,
|
SkScalar sx, SkScalar sy,
|
||||||
@ -580,16 +580,16 @@ void GrTextContext::AppendGlyph(GrTextBlob* blob, int runIndex,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GrTextContext::regenerateGlyphRunList(GrTextBlob* cacheBlob,
|
void GrTextBlob::generateFromGlyphRunList(GrGlyphCache* glyphCache,
|
||||||
GrGlyphCache* glyphCache,
|
const GrShaderCaps& shaderCaps,
|
||||||
const GrShaderCaps& shaderCaps,
|
const GrTextContext::Options& options,
|
||||||
const SkPaint& paint,
|
const SkPaint& paint,
|
||||||
const SkPMColor4f& filteredColor,
|
const SkPMColor4f& filteredColor,
|
||||||
SkScalerContextFlags scalerContextFlags,
|
SkScalerContextFlags scalerContextFlags,
|
||||||
const SkMatrix& viewMatrix,
|
const SkMatrix& viewMatrix,
|
||||||
const SkSurfaceProps& props,
|
const SkSurfaceProps& props,
|
||||||
const SkGlyphRunList& glyphRunList,
|
const SkGlyphRunList& glyphRunList,
|
||||||
SkGlyphRunListPainter* glyphPainter) {
|
SkGlyphRunListPainter* glyphPainter) {
|
||||||
struct ARGBFallbackHelper {
|
struct ARGBFallbackHelper {
|
||||||
void operator ()(const SkPaint& fallbackPaint, SkSpan<const SkGlyphID> glyphIDs,
|
void operator ()(const SkPaint& fallbackPaint, SkSpan<const SkGlyphID> glyphIDs,
|
||||||
SkSpan<const SkPoint> positions, SkScalar textScale,
|
SkSpan<const SkPoint> positions, SkScalar textScale,
|
||||||
@ -605,10 +605,10 @@ void GrTextContext::regenerateGlyphRunList(GrTextBlob* cacheBlob,
|
|||||||
const SkPoint* glyphPos = positions.data();
|
const SkPoint* glyphPos = positions.data();
|
||||||
for (auto glyphID : glyphIDs) {
|
for (auto glyphID : glyphIDs) {
|
||||||
const SkGlyph& glyph = fallbackCache->getGlyphIDMetrics(glyphID);
|
const SkGlyph& glyph = fallbackCache->getGlyphIDMetrics(glyphID);
|
||||||
GrTextContext::AppendGlyph(fBlob, fRunIndex, strike, glyph,
|
append_glyph(fBlob, fRunIndex, strike, glyph,
|
||||||
GrGlyph::kCoverage_MaskStyle,
|
GrGlyph::kCoverage_MaskStyle,
|
||||||
glyphPos->fX, glyphPos->fY, fFilteredColor,
|
glyphPos->fX, glyphPos->fY, fFilteredColor,
|
||||||
fallbackCache.get(), textScale, needsTransform);
|
fallbackCache.get(), textScale, needsTransform);
|
||||||
glyphPos++;
|
glyphPos++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -622,44 +622,44 @@ void GrTextContext::regenerateGlyphRunList(GrTextBlob* cacheBlob,
|
|||||||
};
|
};
|
||||||
|
|
||||||
SkPoint origin = glyphRunList.origin();
|
SkPoint origin = glyphRunList.origin();
|
||||||
cacheBlob->initReusableBlob(
|
this->initReusableBlob(
|
||||||
glyphRunList.paint().computeLuminanceColor(), viewMatrix, origin.x(), origin.y());
|
glyphRunList.paint().computeLuminanceColor(), viewMatrix, origin.x(), origin.y());
|
||||||
|
|
||||||
int runIndex = 0;
|
int runIndex = 0;
|
||||||
for (const auto& glyphRun : glyphRunList) {
|
for (const auto& glyphRun : glyphRunList) {
|
||||||
const SkPaint& runPaint = glyphRun.paint();
|
const SkPaint& runPaint = glyphRun.paint();
|
||||||
cacheBlob->push_back_run(runIndex);
|
this->pushBackRun(runIndex);
|
||||||
|
|
||||||
cacheBlob->setRunPaintFlags(runIndex, runPaint.getFlags());
|
this->setRunPaintFlags(runIndex, runPaint.getFlags());
|
||||||
|
|
||||||
if (CanDrawAsDistanceFields(runPaint, viewMatrix, props,
|
if (GrTextContext::CanDrawAsDistanceFields(runPaint, viewMatrix, props,
|
||||||
shaderCaps.supportsDistanceFieldText(), fOptions)) {
|
shaderCaps.supportsDistanceFieldText(), options)) {
|
||||||
bool hasWCoord = viewMatrix.hasPerspective()
|
bool hasWCoord = viewMatrix.hasPerspective()
|
||||||
|| fOptions.fDistanceFieldVerticesAlwaysHaveW;
|
|| options.fDistanceFieldVerticesAlwaysHaveW;
|
||||||
|
|
||||||
// Setup distance field runPaint and text ratio
|
// Setup distance field runPaint and text ratio
|
||||||
SkScalar textRatio;
|
SkScalar textRatio;
|
||||||
SkPaint distanceFieldPaint{runPaint};
|
SkPaint distanceFieldPaint{runPaint};
|
||||||
SkScalerContextFlags flags;
|
SkScalerContextFlags flags;
|
||||||
InitDistanceFieldPaint(cacheBlob, &distanceFieldPaint, viewMatrix,
|
GrTextContext::InitDistanceFieldPaint(this, &distanceFieldPaint, viewMatrix,
|
||||||
fOptions, &textRatio, &flags);
|
options, &textRatio, &flags);
|
||||||
cacheBlob->setHasDistanceField();
|
this->setHasDistanceField();
|
||||||
cacheBlob->setSubRunHasDistanceFields(runIndex, runPaint.isLCDRenderText(),
|
this->setSubRunHasDistanceFields(runIndex, runPaint.isLCDRenderText(),
|
||||||
runPaint.isAntiAlias(), hasWCoord);
|
runPaint.isAntiAlias(), hasWCoord);
|
||||||
|
|
||||||
{
|
{
|
||||||
auto cache = cacheBlob->setupCache(
|
auto cache = this->setupCache(
|
||||||
runIndex, props, flags, distanceFieldPaint, &SkMatrix::I());
|
runIndex, props, flags, distanceFieldPaint, &SkMatrix::I());
|
||||||
|
|
||||||
sk_sp<GrTextStrike> currStrike = glyphCache->getStrike(cache.get());
|
sk_sp<GrTextStrike> currStrike = glyphCache->getStrike(cache.get());
|
||||||
|
|
||||||
auto perSDF =
|
auto perSDF =
|
||||||
[cacheBlob, runIndex, &currStrike, filteredColor, cache{cache.get()}, textRatio]
|
[this, runIndex, &currStrike, filteredColor, cache{cache.get()}, textRatio]
|
||||||
(const SkGlyph& glyph, SkPoint position) {
|
(const SkGlyph& glyph, SkPoint position) {
|
||||||
if (!glyph.isEmpty()) {
|
if (!glyph.isEmpty()) {
|
||||||
SkScalar sx = position.fX,
|
SkScalar sx = position.fX,
|
||||||
sy = position.fY;
|
sy = position.fY;
|
||||||
AppendGlyph(cacheBlob, runIndex, currStrike,
|
append_glyph(this, runIndex, currStrike,
|
||||||
glyph, GrGlyph::kDistance_MaskStyle, sx, sy,
|
glyph, GrGlyph::kDistance_MaskStyle, sx, sy,
|
||||||
filteredColor,
|
filteredColor,
|
||||||
cache, textRatio, true);
|
cache, textRatio, true);
|
||||||
@ -667,19 +667,19 @@ void GrTextContext::regenerateGlyphRunList(GrTextBlob* cacheBlob,
|
|||||||
};
|
};
|
||||||
|
|
||||||
auto perPath =
|
auto perPath =
|
||||||
[cacheBlob, runIndex, textRatio, cache{cache.get()}]
|
[this, runIndex, textRatio, cache{cache.get()}]
|
||||||
(const SkGlyph& glyph, SkPoint position) {
|
(const SkGlyph& glyph, SkPoint position) {
|
||||||
if (!glyph.isEmpty()) {
|
if (!glyph.isEmpty()) {
|
||||||
if (const SkPath* glyphPath = cache->findPath(glyph)) {
|
if (const SkPath* glyphPath = cache->findPath(glyph)) {
|
||||||
SkScalar sx = position.fX,
|
SkScalar sx = position.fX,
|
||||||
sy = position.fY;
|
sy = position.fY;
|
||||||
cacheBlob->appendPathGlyph(
|
this->appendPathGlyph(
|
||||||
runIndex, *glyphPath, sx, sy, textRatio, false);
|
runIndex, *glyphPath, sx, sy, textRatio, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
ARGBFallbackHelper argbFallback{cacheBlob, runIndex, props, scalerContextFlags,
|
ARGBFallbackHelper argbFallback{this, runIndex, props, scalerContextFlags,
|
||||||
glyphCache, filteredColor};
|
glyphCache, filteredColor};
|
||||||
|
|
||||||
glyphPainter->drawGlyphRunAsSDFWithARGBFallback(
|
glyphPainter->drawGlyphRunAsSDFWithARGBFallback(
|
||||||
@ -691,7 +691,7 @@ void GrTextContext::regenerateGlyphRunList(GrTextBlob* cacheBlob,
|
|||||||
// The glyphs are big, so use paths to draw them.
|
// The glyphs are big, so use paths to draw them.
|
||||||
|
|
||||||
// Ensure the blob is set for bitmaptext
|
// Ensure the blob is set for bitmaptext
|
||||||
cacheBlob->setHasBitmap();
|
this->setHasBitmap();
|
||||||
|
|
||||||
// setup our std runPaint, in hopes of getting hits in the cache
|
// setup our std runPaint, in hopes of getting hits in the cache
|
||||||
SkPaint pathPaint(runPaint);
|
SkPaint pathPaint(runPaint);
|
||||||
@ -701,18 +701,18 @@ void GrTextContext::regenerateGlyphRunList(GrTextBlob* cacheBlob,
|
|||||||
pathPaint, &props, scalerContextFlags, &SkMatrix::I());
|
pathPaint, &props, scalerContextFlags, &SkMatrix::I());
|
||||||
|
|
||||||
// Given a glyph that is not ARGB, draw it.
|
// Given a glyph that is not ARGB, draw it.
|
||||||
auto perPath = [textScale, runIndex, cacheBlob, &pathCache]
|
auto perPath = [textScale, runIndex, this, &pathCache]
|
||||||
(const SkGlyph& glyph, SkPoint position) {
|
(const SkGlyph& glyph, SkPoint position) {
|
||||||
if (!glyph.isEmpty()) {
|
if (!glyph.isEmpty()) {
|
||||||
const SkPath* path = pathCache->findPath(glyph);
|
const SkPath* path = pathCache->findPath(glyph);
|
||||||
if (path != nullptr) {
|
if (path != nullptr) {
|
||||||
cacheBlob->appendPathGlyph(
|
this->appendPathGlyph(
|
||||||
runIndex, *path, position.fX, position.fY, textScale, false);
|
runIndex, *path, position.fX, position.fY, textScale, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
ARGBFallbackHelper argbFallback{cacheBlob, runIndex, props, scalerContextFlags,
|
ARGBFallbackHelper argbFallback{this, runIndex, props, scalerContextFlags,
|
||||||
glyphCache, filteredColor};
|
glyphCache, filteredColor};
|
||||||
|
|
||||||
glyphPainter->drawGlyphRunAsPathWithARGBFallback(
|
glyphPainter->drawGlyphRunAsPathWithARGBFallback(
|
||||||
@ -720,22 +720,22 @@ void GrTextContext::regenerateGlyphRunList(GrTextBlob* cacheBlob,
|
|||||||
std::move(perPath), std::move(argbFallback));
|
std::move(perPath), std::move(argbFallback));
|
||||||
} else {
|
} else {
|
||||||
// Ensure the blob is set for bitmaptext
|
// Ensure the blob is set for bitmaptext
|
||||||
cacheBlob->setHasBitmap();
|
this->setHasBitmap();
|
||||||
|
|
||||||
auto cache = cacheBlob->setupCache(
|
auto cache = this->setupCache(
|
||||||
runIndex, props, scalerContextFlags, runPaint, &viewMatrix);
|
runIndex, props, scalerContextFlags, runPaint, &viewMatrix);
|
||||||
|
|
||||||
sk_sp<GrTextStrike> currStrike = glyphCache->getStrike(cache.get());
|
sk_sp<GrTextStrike> currStrike = glyphCache->getStrike(cache.get());
|
||||||
|
|
||||||
auto perGlyph =
|
auto perGlyph =
|
||||||
[cacheBlob, runIndex, &currStrike, filteredColor, cache{cache.get()}]
|
[this, runIndex, &currStrike, filteredColor, cache{cache.get()}]
|
||||||
(const SkGlyph& glyph, SkPoint mappedPt) {
|
(const SkGlyph& glyph, SkPoint mappedPt) {
|
||||||
if (!glyph.isEmpty()) {
|
if (!glyph.isEmpty()) {
|
||||||
const void* glyphImage = cache->findImage(glyph);
|
const void* glyphImage = cache->findImage(glyph);
|
||||||
if (glyphImage != nullptr) {
|
if (glyphImage != nullptr) {
|
||||||
SkScalar sx = SkScalarFloorToScalar(mappedPt.fX),
|
SkScalar sx = SkScalarFloorToScalar(mappedPt.fX),
|
||||||
sy = SkScalarFloorToScalar(mappedPt.fY);
|
sy = SkScalarFloorToScalar(mappedPt.fY);
|
||||||
AppendGlyph(cacheBlob, runIndex, currStrike,
|
append_glyph(this, runIndex, currStrike,
|
||||||
glyph, GrGlyph::kCoverage_MaskStyle, sx, sy,
|
glyph, GrGlyph::kCoverage_MaskStyle, sx, sy,
|
||||||
filteredColor, cache, SK_Scalar1, false);
|
filteredColor, cache, SK_Scalar1, false);
|
||||||
}
|
}
|
||||||
@ -743,13 +743,13 @@ void GrTextContext::regenerateGlyphRunList(GrTextBlob* cacheBlob,
|
|||||||
};
|
};
|
||||||
|
|
||||||
auto perPath =
|
auto perPath =
|
||||||
[cacheBlob, runIndex, cache{cache.get()}]
|
[this, runIndex, cache{cache.get()}]
|
||||||
(const SkGlyph& glyph, SkPoint position) {
|
(const SkGlyph& glyph, SkPoint position) {
|
||||||
const SkPath* glyphPath = cache->findPath(glyph);
|
const SkPath* glyphPath = cache->findPath(glyph);
|
||||||
if (glyphPath != nullptr) {
|
if (glyphPath != nullptr) {
|
||||||
SkScalar sx = SkScalarFloorToScalar(position.fX),
|
SkScalar sx = SkScalarFloorToScalar(position.fX),
|
||||||
sy = SkScalarFloorToScalar(position.fY);
|
sy = SkScalarFloorToScalar(position.fY);
|
||||||
cacheBlob->appendPathGlyph(
|
this->appendPathGlyph(
|
||||||
runIndex, *glyphPath, sx, sy, SK_Scalar1, true);
|
runIndex, *glyphPath, sx, sy, SK_Scalar1, true);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -794,9 +794,9 @@ std::unique_ptr<GrDrawOp> GrTextContext::createOp_TestingOnly(GrContext* context
|
|||||||
// Use the text and textLen below, because we don't want to mess with the paint.
|
// Use the text and textLen below, because we don't want to mess with the paint.
|
||||||
SkScalerContextFlags scalerContextFlags =
|
SkScalerContextFlags scalerContextFlags =
|
||||||
ComputeScalerContextFlags(rtc->colorSpaceInfo());
|
ComputeScalerContextFlags(rtc->colorSpaceInfo());
|
||||||
textContext->regenerateGlyphRunList(
|
blob->generateFromGlyphRunList(
|
||||||
blob.get(), glyphCache, *context->contextPriv().caps()->shaderCaps(), skPaint,
|
glyphCache, *context->contextPriv().caps()->shaderCaps(), textContext->fOptions,
|
||||||
filteredColor, scalerContextFlags, viewMatrix, surfaceProps,
|
skPaint, filteredColor, scalerContextFlags, viewMatrix, surfaceProps,
|
||||||
glyphRunList, rtc->textTarget()->glyphPainter());
|
glyphRunList, rtc->textTarget()->glyphPainter());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
#ifndef GrDrawingManager_DEFINED
|
#ifndef GrDrawingManager_DEFINED
|
||||||
#define GrDrawingManager_DEFINED
|
#define GrDrawingManager_DEFINED
|
||||||
|
|
||||||
|
#include "GrDeferredUpload.h"
|
||||||
#include "GrPathRenderer.h"
|
#include "GrPathRenderer.h"
|
||||||
#include "GrPathRendererChain.h"
|
#include "GrPathRendererChain.h"
|
||||||
#include "GrResourceCache.h"
|
#include "GrResourceCache.h"
|
||||||
@ -17,6 +18,7 @@
|
|||||||
class GrContext;
|
class GrContext;
|
||||||
class GrCoverageCountingPathRenderer;
|
class GrCoverageCountingPathRenderer;
|
||||||
class GrOnFlushCallbackObject;
|
class GrOnFlushCallbackObject;
|
||||||
|
class GrOpFlushState;
|
||||||
class GrRenderTargetContext;
|
class GrRenderTargetContext;
|
||||||
class GrRenderTargetProxy;
|
class GrRenderTargetProxy;
|
||||||
class GrSingleOWner;
|
class GrSingleOWner;
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
#define GrAtlasTextOp_DEFINED
|
#define GrAtlasTextOp_DEFINED
|
||||||
|
|
||||||
#include "ops/GrMeshDrawOp.h"
|
#include "ops/GrMeshDrawOp.h"
|
||||||
#include "text/GrTextContext.h"
|
#include "text/GrTextBlob.h"
|
||||||
#include "text/GrDistanceFieldAdjustTable.h"
|
#include "text/GrDistanceFieldAdjustTable.h"
|
||||||
#include "text/GrGlyphCache.h"
|
#include "text/GrGlyphCache.h"
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
#include "GrDrawOpAtlas.h"
|
#include "GrDrawOpAtlas.h"
|
||||||
#include "GrGlyphCache.h"
|
#include "GrGlyphCache.h"
|
||||||
#include "GrTextTarget.h"
|
#include "GrTextTarget.h"
|
||||||
|
#include "text/GrTextContext.h"
|
||||||
#include "SkDescriptor.h"
|
#include "SkDescriptor.h"
|
||||||
#include "SkMaskFilterBase.h"
|
#include "SkMaskFilterBase.h"
|
||||||
#include "SkOpts.h"
|
#include "SkOpts.h"
|
||||||
@ -48,11 +49,23 @@ class SkTextBlobRunIterator;
|
|||||||
* *WARNING* If you add new fields to this struct, then you may need to to update AssertEqual
|
* *WARNING* If you add new fields to this struct, then you may need to to update AssertEqual
|
||||||
*/
|
*/
|
||||||
class GrTextBlob : public SkNVRefCnt<GrTextBlob> {
|
class GrTextBlob : public SkNVRefCnt<GrTextBlob> {
|
||||||
|
struct Run;
|
||||||
public:
|
public:
|
||||||
SK_DECLARE_INTERNAL_LLIST_INTERFACE(GrTextBlob);
|
SK_DECLARE_INTERNAL_LLIST_INTERFACE(GrTextBlob);
|
||||||
|
|
||||||
class VertexRegenerator;
|
class VertexRegenerator;
|
||||||
|
|
||||||
|
void generateFromGlyphRunList(GrGlyphCache* glyphCache,
|
||||||
|
const GrShaderCaps& shaderCaps,
|
||||||
|
const GrTextContext::Options& options,
|
||||||
|
const SkPaint& paint,
|
||||||
|
const SkPMColor4f& filteredColor,
|
||||||
|
SkScalerContextFlags scalerContextFlags,
|
||||||
|
const SkMatrix& viewMatrix,
|
||||||
|
const SkSurfaceProps& props,
|
||||||
|
const SkGlyphRunList& glyphRunList,
|
||||||
|
SkGlyphRunListPainter* glyphPainter);
|
||||||
|
|
||||||
static sk_sp<GrTextBlob> Make(int glyphCount, int runCount);
|
static sk_sp<GrTextBlob> Make(int glyphCount, int runCount);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -121,7 +134,7 @@ public:
|
|||||||
|
|
||||||
int runCount() const { return fRunCount; }
|
int runCount() const { return fRunCount; }
|
||||||
|
|
||||||
void push_back_run(int currRun) {
|
void pushBackRun(int currRun) {
|
||||||
SkASSERT(currRun < fRunCount);
|
SkASSERT(currRun < fRunCount);
|
||||||
if (currRun > 0) {
|
if (currRun > 0) {
|
||||||
Run::SubRunInfo& newRun = fRuns[currRun].fSubRunInfo.back();
|
Run::SubRunInfo& newRun = fRuns[currRun].fSubRunInfo.back();
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
#ifndef GrTextBlobCache_DEFINED
|
#ifndef GrTextBlobCache_DEFINED
|
||||||
#define GrTextBlobCache_DEFINED
|
#define GrTextBlobCache_DEFINED
|
||||||
|
|
||||||
#include "GrTextContext.h"
|
#include "GrTextBlob.h"
|
||||||
#include "SkMessageBus.h"
|
#include "SkMessageBus.h"
|
||||||
#include "SkRefCnt.h"
|
#include "SkRefCnt.h"
|
||||||
#include "SkTArray.h"
|
#include "SkTArray.h"
|
||||||
|
@ -10,7 +10,6 @@
|
|||||||
|
|
||||||
#include "GrDistanceFieldAdjustTable.h"
|
#include "GrDistanceFieldAdjustTable.h"
|
||||||
#include "GrGeometryProcessor.h"
|
#include "GrGeometryProcessor.h"
|
||||||
#include "GrTextBlob.h"
|
|
||||||
#include "GrTextTarget.h"
|
#include "GrTextTarget.h"
|
||||||
#include "SkGlyphRun.h"
|
#include "SkGlyphRun.h"
|
||||||
|
|
||||||
@ -21,6 +20,7 @@
|
|||||||
class GrDrawOp;
|
class GrDrawOp;
|
||||||
class GrTextBlobCache;
|
class GrTextBlobCache;
|
||||||
class SkGlyph;
|
class SkGlyph;
|
||||||
|
class GrTextBlob;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Renders text using some kind of an atlas, ie BitmapText or DistanceField text
|
* Renders text using some kind of an atlas, ie BitmapText or DistanceField text
|
||||||
@ -76,24 +76,6 @@ private:
|
|||||||
// Determines if we need to use fake gamma (and contrast boost):
|
// Determines if we need to use fake gamma (and contrast boost):
|
||||||
static SkScalerContextFlags ComputeScalerContextFlags(const GrColorSpaceInfo&);
|
static SkScalerContextFlags ComputeScalerContextFlags(const GrColorSpaceInfo&);
|
||||||
|
|
||||||
void regenerateGlyphRunList(GrTextBlob* bmp,
|
|
||||||
GrGlyphCache*,
|
|
||||||
const GrShaderCaps&,
|
|
||||||
const SkPaint&,
|
|
||||||
const SkPMColor4f& filteredColor,
|
|
||||||
SkScalerContextFlags scalerContextFlags,
|
|
||||||
const SkMatrix& viewMatrix,
|
|
||||||
const SkSurfaceProps&,
|
|
||||||
const SkGlyphRunList& glyphRunList,
|
|
||||||
SkGlyphRunListPainter* glyphPainter);
|
|
||||||
|
|
||||||
static void AppendGlyph(GrTextBlob*, int runIndex,
|
|
||||||
const sk_sp<GrTextStrike>&, const SkGlyph&,
|
|
||||||
GrGlyph::MaskStyle maskStyle, SkScalar sx, SkScalar sy,
|
|
||||||
const SkPMColor4f& color, SkGlyphCache*, SkScalar textRatio,
|
|
||||||
bool needsTransform);
|
|
||||||
|
|
||||||
|
|
||||||
const GrDistanceFieldAdjustTable* dfAdjustTable() const { return fDistanceAdjustTable.get(); }
|
const GrDistanceFieldAdjustTable* dfAdjustTable() const { return fDistanceAdjustTable.get(); }
|
||||||
|
|
||||||
sk_sp<const GrDistanceFieldAdjustTable> fDistanceAdjustTable;
|
sk_sp<const GrDistanceFieldAdjustTable> fDistanceAdjustTable;
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
#include "Resources.h"
|
#include "Resources.h"
|
||||||
#include "SkDraw.h"
|
#include "SkDraw.h"
|
||||||
|
#include "SkGlyphCache.h"
|
||||||
#include "SkGraphics.h"
|
#include "SkGraphics.h"
|
||||||
#include "SkMutex.h"
|
#include "SkMutex.h"
|
||||||
#include "SkRemoteGlyphCache.h"
|
#include "SkRemoteGlyphCache.h"
|
||||||
|
Loading…
Reference in New Issue
Block a user