Revert "Add maxDimension() to glyph"

This reverts commit c19cf51df4.

Reason for revert: speculative: broke win7 layout tests

Original change's description:
> Add maxDimension() to glyph
> 
> Expand the too large for atlas calculation. Considering making
> a "small enough" function on glyph.
> 
> Change-Id: I113831f4182df0939110f651fb4a5921447124c1
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/206705
> Commit-Queue: Herb Derby <herb@google.com>
> Commit-Queue: Ben Wagner <bungeman@google.com>
> Auto-Submit: Herb Derby <herb@google.com>
> Reviewed-by: Ben Wagner <bungeman@google.com>

TBR=bungeman@google.com,herb@google.com

Change-Id: Ie11df8e314ccf801f1d223d56344640b49200633
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/206695
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
This commit is contained in:
Mike Reed 2019-04-09 12:48:25 +00:00 committed by Skia Commit-Bot
parent 9a7c7be159
commit d3516170ac
3 changed files with 15 additions and 16 deletions

View File

@ -158,13 +158,6 @@ public:
return fPathData != nullptr && fPathData->fHasPath ? &fPathData->fPath : nullptr;
}
int maxDimension() const {
// width and height are only defined if a metrics call was made.
SkASSERT(fMaskFormat != MASK_FORMAT_UNKNOWN);
return std::max(fWidth, fHeight);
}
// Returns the size allocated on the arena.
size_t copyImageData(const SkGlyph& from, SkArenaAlloc* alloc);

View File

@ -71,6 +71,10 @@ SkIPoint SkStrikeCommon::SubpixelLookup(SkAxisAlignment axisAlignment, SkPoint p
return {lookupX, lookupY};
}
bool SkStrikeCommon::GlyphTooBigForAtlas(const SkGlyph& glyph) {
return glyph.fWidth > kSkSideTooBigForAtlas || glyph.fHeight > kSkSideTooBigForAtlas;
}
// -- SkGlyphRunListPainter ------------------------------------------------------------------------
SkGlyphRunListPainter::SkGlyphRunListPainter(const SkSurfaceProps& props,
SkColorType colorType,
@ -383,10 +387,10 @@ void SkGlyphRunListPainter::processGlyphRunList(const SkGlyphRunList& glyphRunLi
ScopedBuffers _ = this->ensureBuffers(glyphRun);
auto addFallback = [this, &maxFallbackDimension]
(const SkGlyph& glyph, SkPoint sourcePosition) {
maxFallbackDimension = std::max(maxFallbackDimension,
SkIntToScalar(glyph.maxDimension()));
fARGBGlyphsIDs.push_back(glyph.getGlyphID());
(SkGlyphID glyphID, int width, int height, SkPoint sourcePosition) {
SkScalar largestDimension = std::max(width, height);
maxFallbackDimension = std::max(maxFallbackDimension, largestDimension);
fARGBGlyphsIDs.push_back(glyphID);
fARGBPositions.push_back(sourcePosition);
};
@ -435,13 +439,13 @@ void SkGlyphRunListPainter::processGlyphRunList(const SkGlyphRunList& glyphRunLi
if (glyph.isEmpty()) {
// do nothing
} else if (glyph.fMaskFormat == SkMask::kSDF_Format
&& glyph.maxDimension() <= SkStrikeCommon::kSkSideTooBigForAtlas) {
&& !SkStrikeCommon::GlyphTooBigForAtlas(glyph)) {
fGlyphPos[glyphCount++] = {&glyph, glyphSourcePosition};
} else if (glyph.fMaskFormat != SkMask::kARGB32_Format
&& strike->decideCouldDrawFromPath(glyph)) {
fPaths.push_back({&glyph, glyphSourcePosition});
} else {
addFallback(glyph, glyphSourcePosition);
addFallback(glyphID, glyph.fWidth, glyph.fHeight, glyphSourcePosition);
}
}
@ -511,7 +515,7 @@ void SkGlyphRunListPainter::processGlyphRunList(const SkGlyphRunList& glyphRunLi
&& strike->decideCouldDrawFromPath(glyph)) {
fGlyphPos[glyphCount++] = {&glyph, glyphSourcePosition};
} else {
addFallback(glyph, glyphSourcePosition);
addFallback(glyphID, glyph.fWidth, glyph.fHeight, glyphSourcePosition);
}
}
@ -560,13 +564,13 @@ void SkGlyphRunListPainter::processGlyphRunList(const SkGlyphRunList& glyphRunLi
const SkGlyph& glyph = strike->getGlyphMetrics(glyphID, glyphDevicePosition);
if (glyph.isEmpty()) {
// do nothing
} else if (glyph.maxDimension() <= SkStrikeCommon::kSkSideTooBigForAtlas) {
} else if (!SkStrikeCommon::GlyphTooBigForAtlas(glyph)) {
fGlyphPos[glyphsWithMaskCount++] = {&glyph, glyphDevicePosition};
} else if (glyph.fMaskFormat != SkMask::kARGB32_Format
&& strike->decideCouldDrawFromPath(glyph)) {
fPaths.push_back({&glyph, glyphDevicePosition});
} else {
addFallback(glyph, glyphSourcePosition);
addFallback(glyphID, glyph.fWidth, glyph.fHeight, glyphSourcePosition);
}
}

View File

@ -32,6 +32,8 @@ public:
// An atlas consists of plots, and plots hold glyphs. The minimum a plot can be is 256x256.
// This means that the maximum size a glyph can be is 256x256.
static constexpr uint16_t kSkSideTooBigForAtlas = 256;
static bool GlyphTooBigForAtlas(const SkGlyph& glyph);
};
class SkGlyphRunListPainter {