[graphite] For now, draw glyphs as paths.
Adds a parameter to SDFTControl that forces all glyphs to fail as SDF or Direct, and sets it in the Graphite Device constructor. Bug: skia:13118 Change-Id: I212e35e992bb14925ec66fca610bb0825ff467b8 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/550618 Reviewed-by: Herb Derby <herb@google.com> Commit-Queue: Jim Van Verth <jvanverth@google.com>
This commit is contained in:
parent
40e3b3c605
commit
7f1bc92a34
@ -196,7 +196,7 @@ Device::Device(Recorder* recorder, sk_sp<DrawContext> dc)
|
||||
, fCachedLocalToDevice(SkM44())
|
||||
, fCurrentDepth(DrawOrder::kClearDepth)
|
||||
// TODO: set this up based on ContextOptions
|
||||
, fSDFTControl(true, false, 18, 324)
|
||||
, fSDFTControl(true, false, 18, 324, true)
|
||||
, fDrawsOverlap(false) {
|
||||
SkASSERT(SkToBool(fDC) && SkToBool(fRecorder));
|
||||
fRecorder->registerDevice(this);
|
||||
|
@ -38,20 +38,23 @@ SkScalar SDFTControl::MinSDFTRange(bool useSDFTForSmallText, SkScalar min) {
|
||||
}
|
||||
|
||||
SDFTControl::SDFTControl(
|
||||
bool ableToUseSDFT, bool useSDFTForSmallText, SkScalar min, SkScalar max)
|
||||
bool ableToUseSDFT, bool useSDFTForSmallText, SkScalar min, SkScalar max, bool forcePaths)
|
||||
: fMinDistanceFieldFontSize{MinSDFTRange(useSDFTForSmallText, min)}
|
||||
, fMaxDistanceFieldFontSize{max}
|
||||
, fAbleToUseSDFT{ableToUseSDFT} {
|
||||
, fAbleToUseSDFT{ableToUseSDFT}
|
||||
, fForcePaths{forcePaths} {
|
||||
SkASSERT_RELEASE(0 < min && min <= max);
|
||||
}
|
||||
|
||||
bool SDFTControl::isDirect(SkScalar approximateDeviceTextSize, const SkPaint& paint) const {
|
||||
return !isSDFT(approximateDeviceTextSize, paint) &&
|
||||
return !fForcePaths &&
|
||||
!isSDFT(approximateDeviceTextSize, paint) &&
|
||||
approximateDeviceTextSize < SkStrikeCommon::kSkSideTooBigForAtlas;
|
||||
}
|
||||
|
||||
bool SDFTControl::isSDFT(SkScalar approximateDeviceTextSize, const SkPaint& paint) const {
|
||||
return fAbleToUseSDFT &&
|
||||
return !fForcePaths &&
|
||||
fAbleToUseSDFT &&
|
||||
paint.getMaskFilter() == nullptr &&
|
||||
paint.getStyle() == SkPaint::kFill_Style &&
|
||||
fMinDistanceFieldFontSize <= approximateDeviceTextSize &&
|
||||
|
@ -35,7 +35,8 @@ private:
|
||||
|
||||
class SDFTControl {
|
||||
public:
|
||||
SDFTControl(bool ableToUseSDFT, bool useSDFTForSmallText, SkScalar min, SkScalar max);
|
||||
SDFTControl(bool ableToUseSDFT, bool useSDFTForSmallText, SkScalar min, SkScalar max,
|
||||
bool forcePaths = false);
|
||||
|
||||
// Produce a font, a scale factor from the nominal size to the source space size, and matrix
|
||||
// range where this font can be reused.
|
||||
@ -44,6 +45,7 @@ public:
|
||||
|
||||
bool isDirect(SkScalar approximateDeviceTextSize, const SkPaint& paint) const;
|
||||
bool isSDFT(SkScalar approximateDeviceTextSize, const SkPaint& paint) const;
|
||||
bool forcePaths() const { return fForcePaths; }
|
||||
|
||||
private:
|
||||
static SkScalar MinSDFTRange(bool useSDFTForSmallText, SkScalar min);
|
||||
@ -56,6 +58,7 @@ private:
|
||||
const SkScalar fMaxDistanceFieldFontSize;
|
||||
|
||||
const bool fAbleToUseSDFT;
|
||||
const bool fForcePaths;
|
||||
};
|
||||
|
||||
} // namespace sktext::gpu
|
||||
|
@ -2226,7 +2226,7 @@ std::tuple<bool, SubRunContainerOwner> SubRunContainer::MakeInAlloc(
|
||||
}
|
||||
}
|
||||
|
||||
if (!rejected->source().empty()) {
|
||||
if (!rejected->source().empty() && !SDFTControl.forcePaths()) {
|
||||
// Process masks including ARGB - this should be the 99.99% case.
|
||||
// This will handle medium size emoji that are sharing the run with SDFT drawn text.
|
||||
// If things are too big they will be passed along to the drawing of last resort
|
||||
|
Loading…
Reference in New Issue
Block a user