Revert "Have Renderer use combined path code"
This reverts commit 5dee1802ae
.
Reason for revert: breaking ios-simulator bot on Chrome roll.
Something to do with SK_SUPPORT_GPU?
https://logs.chromium.org/logs/chromium/buildbucket/cr-buildbucket.appspot.com/8934155862192553888/+/steps/compile__with_patch_/0/stdout
Original change's description:
> Have Renderer use combined path code
>
> Currently, the GPU code uses the unified code path
> in painter to draw. Have the remote glyph cache use it too.
>
> Change-Id: Ibb1728a9602dbb3ace3a57781c5e7a20cdbe3cdf
> Reviewed-on: https://skia-review.googlesource.com/157521
> Reviewed-by: Mike Klein <mtklein@google.com>
> Commit-Queue: Mike Klein <mtklein@google.com>
TBR=mtklein@google.com,herb@google.com
Change-Id: Ica31880f38a9d3a62a8616e64cbb84e6ae9827a4
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/157740
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
This commit is contained in:
parent
10d12834c8
commit
f88f49d2a5
@ -595,13 +595,11 @@ void GrTextContext::regenerateGlyphRunList(GrTextBlob* cacheBlob,
|
|||||||
// 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, cacheBlob, &pathCache]
|
||||||
(const SkGlyph& glyph, SkPoint position) {
|
(const SkGlyph& glyph, SkPoint position) {
|
||||||
if (!glyph.isEmpty()) {
|
|
||||||
const SkPath* path = pathCache->findPath(glyph);
|
const SkPath* path = pathCache->findPath(glyph);
|
||||||
if (path != nullptr) {
|
if (path != nullptr) {
|
||||||
cacheBlob->appendPathGlyph(
|
cacheBlob->appendPathGlyph(
|
||||||
runIndex, *path, position.fX, position.fY, textScale, false);
|
runIndex, *path, position.fX, position.fY, textScale, false);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Handle the fallback glyphs given the fallbackPaint, matrix, and scale.
|
// Handle the fallback glyphs given the fallbackPaint, matrix, and scale.
|
||||||
|
@ -175,6 +175,7 @@ void SkGlyphRunListPainter::drawGlyphRunAsPathWithARGBFallback(
|
|||||||
(SkGlyphID glyphID, SkPoint position) {
|
(SkGlyphID glyphID, SkPoint position) {
|
||||||
if (SkScalarsAreFinite(position.x(), position.y())) {
|
if (SkScalarsAreFinite(position.x(), position.y())) {
|
||||||
const SkGlyph& glyph = pathCache->getGlyphMetrics(glyphID, {0, 0});
|
const SkGlyph& glyph = pathCache->getGlyphMetrics(glyphID, {0, 0});
|
||||||
|
if (!glyph.isEmpty()) {
|
||||||
if (glyph.fMaskFormat != SkMask::kARGB32_Format) {
|
if (glyph.fMaskFormat != SkMask::kARGB32_Format) {
|
||||||
perPath(glyph, origin + position);
|
perPath(glyph, origin + position);
|
||||||
} else {
|
} else {
|
||||||
@ -184,6 +185,7 @@ void SkGlyphRunListPainter::drawGlyphRunAsPathWithARGBFallback(
|
|||||||
fARGBPositions.push_back(position);
|
fARGBPositions.push_back(position);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
glyphRun.forEachGlyphAndPosition(eachGlyph);
|
glyphRun.forEachGlyphAndPosition(eachGlyph);
|
||||||
|
@ -182,6 +182,7 @@ bool read_path(Deserializer* deserializer, SkGlyph* glyph, SkGlyphCache* cache)
|
|||||||
return cache->initializePath(glyph, path, pathSize);
|
return cache->initializePath(glyph, path, pathSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if SK_SUPPORT_GPU
|
||||||
void add_glyph_to_cache(SkStrikeServer::SkGlyphCacheState* cache, SkTypeface* tf,
|
void add_glyph_to_cache(SkStrikeServer::SkGlyphCacheState* cache, SkTypeface* tf,
|
||||||
const SkScalerContextEffects& effects, SkGlyphID glyphID) {
|
const SkScalerContextEffects& effects, SkGlyphID glyphID) {
|
||||||
SkASSERT(cache != nullptr);
|
SkASSERT(cache != nullptr);
|
||||||
@ -189,7 +190,6 @@ void add_glyph_to_cache(SkStrikeServer::SkGlyphCacheState* cache, SkTypeface* tf
|
|||||||
cache->addGlyph(SkPackedGlyphID(glyphID, 0, 0), false);
|
cache->addGlyph(SkPackedGlyphID(glyphID, 0, 0), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if SK_SUPPORT_GPU
|
|
||||||
void add_fallback_text_to_cache(const GrTextContext::FallbackGlyphRunHelper& helper,
|
void add_fallback_text_to_cache(const GrTextContext::FallbackGlyphRunHelper& helper,
|
||||||
const SkSurfaceProps& props,
|
const SkSurfaceProps& props,
|
||||||
const SkMatrix& matrix,
|
const SkMatrix& matrix,
|
||||||
@ -272,7 +272,7 @@ void SkTextBlobCacheDiffCanvas::TrackLayerDevice::processGlyphRun(
|
|||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
if (SkDraw::ShouldDrawTextAsPaths(runPaint, runMatrix)) {
|
if (SkDraw::ShouldDrawTextAsPaths(runPaint, runMatrix)) {
|
||||||
this->processGlyphRunForPaths(glyphRun, runMatrix, origin);
|
this->processGlyphRunForPaths(glyphRun, runMatrix);
|
||||||
} else {
|
} else {
|
||||||
this->processGlyphRunForMask(glyphRun, runMatrix, origin);
|
this->processGlyphRunForMask(glyphRun, runMatrix, origin);
|
||||||
}
|
}
|
||||||
@ -306,44 +306,43 @@ void SkTextBlobCacheDiffCanvas::TrackLayerDevice::processGlyphRunForMask(
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SkTextBlobCacheDiffCanvas::TrackLayerDevice::processGlyphRunForPaths(
|
void SkTextBlobCacheDiffCanvas::TrackLayerDevice::processGlyphRunForPaths(
|
||||||
const SkGlyphRun& glyphRun, const SkMatrix& runMatrix, SkPoint origin) {
|
const SkGlyphRun& glyphRun, const SkMatrix& runMatrix) {
|
||||||
TRACE_EVENT0("skia", "SkTextBlobCacheDiffCanvas::processGlyphRunForPaths");
|
TRACE_EVENT0("skia", "SkTextBlobCacheDiffCanvas::processGlyphRunForPaths");
|
||||||
const SkPaint& runPaint = glyphRun.paint();
|
const SkPaint& runPaint = glyphRun.paint();
|
||||||
SkPaint pathPaint{runPaint};
|
|
||||||
|
|
||||||
SkScalar textScale = pathPaint.setupForAsPaths();
|
// The code below borrowed from GrTextContext::DrawBmpPosTextAsPaths.
|
||||||
|
SkPaint pathPaint(runPaint);
|
||||||
|
#if SK_SUPPORT_GPU
|
||||||
|
SkScalar matrixScale = pathPaint.setupForAsPaths();
|
||||||
|
GrTextContext::FallbackGlyphRunHelper fallbackTextHelper(runMatrix, runPaint, matrixScale);
|
||||||
|
#else
|
||||||
|
pathPaint.setupForAsPaths();
|
||||||
|
#endif
|
||||||
|
|
||||||
SkScalerContextEffects effects;
|
SkScalerContextEffects effects;
|
||||||
auto* glyphCacheState = fStrikeServer->getOrCreateCache(
|
auto* glyphCacheState = fStrikeServer->getOrCreateCache(
|
||||||
pathPaint, this->surfaceProps(), SkMatrix::I(),
|
pathPaint, this->surfaceProps(), SkMatrix::I(),
|
||||||
SkScalerContextFlags::kFakeGammaAndBoostContrast, &effects);
|
SkScalerContextFlags::kFakeGammaAndBoostContrast, &effects);
|
||||||
|
|
||||||
auto perPath = [glyphCacheState](const SkGlyph& glyph, SkPoint position) {
|
|
||||||
const bool asPath = true;
|
const bool asPath = true;
|
||||||
glyphCacheState->addGlyph(glyph.getGlyphID(), asPath);
|
auto glyphs = glyphRun.shuntGlyphsIDs();
|
||||||
};
|
for (uint32_t index = 0; index < glyphRun.runSize(); index++) {
|
||||||
|
auto glyphID = glyphs[index];
|
||||||
auto argbFallback = [this, &runMatrix]
|
#if SK_SUPPORT_GPU
|
||||||
(const SkPaint& fallbackPaint, SkSpan<const SkGlyphID> glyphIDs,
|
const auto& glyph = glyphCacheState->findGlyph(glyphID);
|
||||||
SkSpan<const SkPoint> positions, SkScalar textScale,
|
if (SkMask::kARGB32_Format == glyph.fMaskFormat) {
|
||||||
const SkMatrix& glyphCacheMatrix,
|
// Note that we send data for the original glyph even in the case of fallback
|
||||||
SkGlyphRunListPainter::NeedsTransform needsTransform) {
|
// since its glyph metrics will still be used on the client.
|
||||||
TRACE_EVENT0("skia", "argbFallback_path");
|
fallbackTextHelper.appendGlyph(glyph, glyphID, {0, 0});
|
||||||
SkMatrix fallbackMatrix = runMatrix;
|
}
|
||||||
|
#endif
|
||||||
SkScalerContextEffects effects;
|
glyphCacheState->addGlyph(glyphID, asPath);
|
||||||
auto* glyphCacheState =
|
|
||||||
fStrikeServer->getOrCreateCache(
|
|
||||||
fallbackPaint, surfaceProps(), fallbackMatrix,
|
|
||||||
SkScalerContextFlags::kFakeGammaAndBoostContrast, &effects);
|
|
||||||
|
|
||||||
for (auto glyphID : glyphIDs) {
|
|
||||||
add_glyph_to_cache(glyphCacheState, fallbackPaint.getTypeface(), effects, glyphID);
|
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
fPainter.drawGlyphRunAsPathWithARGBFallback(
|
#if SK_SUPPORT_GPU
|
||||||
glyphCacheState, glyphRun, origin, runMatrix, textScale, perPath, argbFallback);
|
add_fallback_text_to_cache(fallbackTextHelper, this->surfaceProps(), runMatrix, runPaint,
|
||||||
|
fStrikeServer);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if SK_SUPPORT_GPU
|
#if SK_SUPPORT_GPU
|
||||||
|
@ -100,8 +100,7 @@ private:
|
|||||||
void processGlyphRunForMask(
|
void processGlyphRunForMask(
|
||||||
const SkGlyphRun& glyphRun, const SkMatrix& runMatrix, SkPoint origin);
|
const SkGlyphRun& glyphRun, const SkMatrix& runMatrix, SkPoint origin);
|
||||||
|
|
||||||
void processGlyphRunForPaths(
|
void processGlyphRunForPaths(const SkGlyphRun& glyphRun, const SkMatrix& runMatrix);
|
||||||
const SkGlyphRun& glyphRun, const SkMatrix& runMatrix, SkPoint origin);
|
|
||||||
|
|
||||||
#if SK_SUPPORT_GPU
|
#if SK_SUPPORT_GPU
|
||||||
bool maybeProcessGlyphRunForDFT(const SkGlyphRun& glyphRun, const SkMatrix& runMatrix);
|
bool maybeProcessGlyphRunForDFT(const SkGlyphRun& glyphRun, const SkMatrix& runMatrix);
|
||||||
|
Loading…
Reference in New Issue
Block a user