Revert "rename GrSDFTOptions to GrSDFTControl"

This reverts commit 40a9061203.

Reason for revert: breaking chrome roll (android-pie)?

Original change's description:
> rename GrSDFTOptions to GrSDFTControl
>
> Change-Id: Ie03fce7a99a9f71b18d54e3cd35e7675fb7f8912
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/379616
> Commit-Queue: Herb Derby <herb@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>

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

Change-Id: I0483cbada23c76bdd5ccdb51936bb20a819343cb
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/379839
Reviewed-by: Mike Reed <reed@google.com>
This commit is contained in:
Mike Reed 2021-03-05 11:15:07 +00:00
parent 606a9ab831
commit 9edff53a73
17 changed files with 56 additions and 56 deletions

View File

@ -49,14 +49,14 @@ class DirectMaskGlyphVertexFillBenchmark : public Benchmark {
SkGlyphRunListPainter painter{props, kUnknown_SkColorType,
colorSpace.get(), SkStrikeCache::GlobalStrikeCache()};
GrSDFTControl control{false, props.isUseDeviceIndependentFonts(), 256, 256};
GrSDFTOptions options{false, props.isUseDeviceIndependentFonts(), 256, 256};
const SkPoint drawOrigin = glyphRunList.origin();
const SkPaint& drawPaint = glyphRunList.paint();
SkMatrix drawMatrix = view;
drawMatrix.preTranslate(drawOrigin.x(), drawOrigin.y());
for (auto& glyphRun : glyphRunList) {
painter.processGlyphRun(glyphRun, drawMatrix, drawPaint, control, fBlob.get());
painter.processGlyphRun(glyphRun, drawMatrix, drawPaint, options, fBlob.get());
}
SkASSERT(!fBlob->subRunList().isEmpty());

View File

@ -499,8 +499,8 @@ skia_gpu_sources = [
"$_src/gpu/text/GrDistanceFieldAdjustTable.h",
"$_src/gpu/text/GrSDFMaskFilter.cpp",
"$_src/gpu/text/GrSDFMaskFilter.h",
"$_src/gpu/text/GrSDFTControl.cpp",
"$_src/gpu/text/GrSDFTControl.h",
"$_src/gpu/text/GrSDFTOptions.cpp",
"$_src/gpu/text/GrSDFTOptions.h",
"$_src/gpu/text/GrStrikeCache.cpp",
"$_src/gpu/text/GrStrikeCache.h",
"$_src/gpu/text/GrTextBlob.cpp",

View File

@ -16,7 +16,7 @@
#include "src/gpu/GrSurfaceDrawContext.h"
#include "src/gpu/SkGr.h"
#include "src/gpu/ops/GrAtlasTextOp.h"
#include "src/gpu/text/GrSDFTControl.h"
#include "src/gpu/text/GrSDFTOptions.h"
#include "src/gpu/text/GrTextBlobCache.h"
#endif
@ -48,7 +48,7 @@ SkGlyphRunListPainter::SkGlyphRunListPainter(const SkSurfaceProps& props,
, fColorType{colorType}, fScalerContextFlags{flags}
, fStrikeCache{strikeCache} {}
// TODO: unify with code in GrSDFTControl.cpp
// TODO: unify with code in GrSDFTOptions.cpp
static SkScalerContextFlags compute_scaler_context_flags(const SkColorSpace* cs) {
// If we're doing linear blending, then we can disable the gamma hacks.
// Otherwise, leave them on. In either case, we still want the contrast boost:
@ -140,18 +140,18 @@ void SkGlyphRunListPainter::drawForBitmapDevice(
void SkGlyphRunListPainter::processGlyphRun(const SkGlyphRun& glyphRun,
const SkMatrix& drawMatrix,
const SkPaint& runPaint,
const GrSDFTControl& control,
const GrSDFTOptions& options,
SkGlyphRunPainterInterface* process) {
ScopedBuffers _ = this->ensureBuffers(glyphRun);
fRejects.setSource(glyphRun.source());
const SkFont& runFont = glyphRun.font();
GrSDFTControl::DrawingType drawingType = control.drawingType(runFont, runPaint, drawMatrix);
GrSDFTOptions::DrawingType drawingType = options.drawingType(runFont, runPaint, drawMatrix);
if (drawingType == GrSDFTControl::kSDFT) {
if (drawingType == GrSDFTOptions::kSDFT) {
// Process SDFT - This should be the .009% case.
const auto& [strikeSpec, minScale, maxScale] =
SkStrikeSpec::MakeSDFT(runFont, runPaint, fDeviceProps, drawMatrix, control);
SkStrikeSpec::MakeSDFT(runFont, runPaint, fDeviceProps, drawMatrix, options);
if (!strikeSpec.isEmpty()) {
SkScopedStrikeForGPU strike = strikeSpec.findOrCreateScopedStrike(fStrikeCache);
@ -169,7 +169,7 @@ void SkGlyphRunListPainter::processGlyphRun(const SkGlyphRun& glyphRun,
}
}
if (drawingType != GrSDFTControl::kPath && !fRejects.source().empty()) {
if (drawingType != GrSDFTOptions::kPath && !fRejects.source().empty()) {
// Process masks including ARGB - this should be the 99.99% case.
SkStrikeSpec strikeSpec = SkStrikeSpec::MakeMask(

View File

@ -16,7 +16,7 @@
#include "src/core/SkTextBlobPriv.h"
#if SK_SUPPORT_GPU
#include "src/gpu/text/GrSDFTControl.h"
#include "src/gpu/text/GrSDFTOptions.h"
class GrColorInfo;
class GrSurfaceDrawContext;
#endif
@ -86,7 +86,7 @@ public:
void processGlyphRun(const SkGlyphRun& glyphRun,
const SkMatrix& drawMatrix,
const SkPaint& drawPaint,
const GrSDFTControl& control,
const GrSDFTOptions& options,
SkGlyphRunPainterInterface* process);
#endif // SK_SUPPORT_GPU

View File

@ -33,7 +33,7 @@
#if SK_SUPPORT_GPU
#include "include/gpu/GrContextOptions.h"
#include "src/gpu/GrDrawOpAtlas.h"
#include "src/gpu/text/GrSDFTControl.h"
#include "src/gpu/text/GrSDFTOptions.h"
#endif
static SkDescriptor* auto_descriptor_from_desc(const SkDescriptor* source_desc,
@ -818,8 +818,8 @@ protected:
void drawGlyphRunList(const SkGlyphRunList& glyphRunList) override {
#if SK_SUPPORT_GPU
GrContextOptions ctxOptions;
GrSDFTControl control =
GrSDFTControl{fDFTSupport,
GrSDFTOptions options =
GrSDFTOptions{fDFTSupport,
this->surfaceProps().isUseDeviceIndependentFonts(),
ctxOptions.fMinDistanceFieldFontSize,
ctxOptions.fGlyphsAsPathsFontSize};
@ -830,7 +830,7 @@ protected:
fPainter.processGlyphRun(glyphRun,
drawMatrix,
glyphRunList.paint(),
control,
options,
nullptr);
}
#endif // SK_SUPPORT_GPU

View File

@ -15,7 +15,7 @@
#if SK_SUPPORT_GPU
#include "src/gpu/text/GrSDFMaskFilter.h"
#include "src/gpu/text/GrSDFTControl.h"
#include "src/gpu/text/GrSDFTOptions.h"
#include "src/gpu/text/GrStrikeCache.h"
#endif
@ -163,18 +163,18 @@ SkStrikeSpec SkStrikeSpec::MakePDFVector(const SkTypeface& typeface, int* size)
std::tuple<SkStrikeSpec, SkScalar, SkScalar>
SkStrikeSpec::MakeSDFT(const SkFont& font, const SkPaint& paint,
const SkSurfaceProps& surfaceProps, const SkMatrix& deviceMatrix,
const GrSDFTControl& control) {
const GrSDFTOptions& options) {
SkPaint dfPaint{paint};
dfPaint.setMaskFilter(GrSDFMaskFilter::Make());
SkScalar strikeToSourceRatio;
SkFont dfFont = control.getSDFFont(font, deviceMatrix, &strikeToSourceRatio);
SkFont dfFont = options.getSDFFont(font, deviceMatrix, &strikeToSourceRatio);
// Fake-gamma and subpixel antialiasing are applied in the shader, so we ignore the
// passed-in scaler context flags. (It's only used when we fall-back to bitmap text).
SkScalerContextFlags flags = SkScalerContextFlags::kNone;
SkScalar minScale, maxScale;
std::tie(minScale, maxScale) = control.computeSDFMinMaxScale(font.getSize(), deviceMatrix);
std::tie(minScale, maxScale) = options.computeSDFMinMaxScale(font.getSize(), deviceMatrix);
SkStrikeSpec strikeSpec(dfFont, dfPaint, surfaceProps, flags,
SkMatrix::I(), strikeToSourceRatio);

View File

@ -13,7 +13,7 @@
#include "src/core/SkStrikeForGPU.h"
#if SK_SUPPORT_GPU
#include "src/gpu/text/GrSDFTControl.h"
#include "src/gpu/text/GrSDFTOptions.h"
class GrStrikeCache;
class GrTextStrike;
#endif
@ -75,7 +75,7 @@ public:
const SkPaint& paint,
const SkSurfaceProps& surfaceProps,
const SkMatrix& deviceMatrix,
const GrSDFTControl& control);
const GrSDFTOptions& options);
sk_sp<GrTextStrike> findOrCreateGrStrike(GrStrikeCache* cache) const;
#endif

View File

@ -44,7 +44,7 @@
#include "src/gpu/GrWaitRenderTask.h"
#include "src/gpu/GrWritePixelsRenderTask.h"
#include "src/gpu/ccpr/GrCoverageCountingPathRenderer.h"
#include "src/gpu/text/GrSDFTControl.h"
#include "src/gpu/text/GrSDFTOptions.h"
#include "src/image/SkSurface_Gpu.h"
///////////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -14,8 +14,8 @@ void GrRecordingContextPriv::moveRenderTasksToDDL(SkDeferredDisplayList* ddl) {
fContext->drawingManager()->moveRenderTasksToDDL(ddl);
}
GrSDFTControl GrRecordingContextPriv::getSDFTControl(bool useSDFTForSmallText) const {
return GrSDFTControl{
GrSDFTOptions GrRecordingContextPriv::getSDFTOptions(bool useSDFTForSmallText) const {
return GrSDFTOptions{
this->caps()->shaderCaps()->supportsDistanceFieldText(),
useSDFTForSmallText,
this->options().fMinDistanceFieldFontSize,

View File

@ -9,7 +9,7 @@
#define GrRecordingContextPriv_DEFINED
#include "include/gpu/GrRecordingContext.h"
#include "src/gpu/text/GrSDFTControl.h"
#include "src/gpu/text/GrSDFTOptions.h"
class SkDeferredDisplayList;
@ -102,7 +102,7 @@ public:
return &fContext->fStats;
}
GrSDFTControl getSDFTControl(bool useSDFTForSmallText) const;
GrSDFTOptions getSDFTOptions(bool useSDFTForSmallText) const;
/**
* Create a GrRecordingContext without a resource cache

View File

@ -67,7 +67,7 @@
#include "src/gpu/ops/GrStencilPathOp.h"
#include "src/gpu/ops/GrStrokeRectOp.h"
#include "src/gpu/ops/GrTextureOp.h"
#include "src/gpu/text/GrSDFTControl.h"
#include "src/gpu/text/GrSDFTOptions.h"
#include "src/gpu/text/GrTextBlobCache.h"
#define ASSERT_OWNED_RESOURCE(R) SkASSERT(!(R) || (R)->getContext() == this->drawingManager()->getContext())
@ -364,8 +364,8 @@ void GrSurfaceDrawContext::drawGlyphRunList(const GrClip* clip,
return;
}
GrSDFTControl control =
this->recordingContext()->priv().getSDFTControl(
GrSDFTOptions options =
this->recordingContext()->priv().getSDFTOptions(
this->surfaceProps().isUseDeviceIndependentFonts());
GrTextBlobCache* textBlobCache = fContext->priv().getTextBlobCache();
@ -419,10 +419,10 @@ void GrSurfaceDrawContext::drawGlyphRunList(const GrClip* clip,
// Calculate the set of drawing types.
key.fSetOfDrawingTypes = 0;
for (auto& run : glyphRunList) {
key.fSetOfDrawingTypes |= control.drawingType(run.font(), drawPaint, drawMatrix);
key.fSetOfDrawingTypes |= options.drawingType(run.font(), drawPaint, drawMatrix);
}
if (key.fSetOfDrawingTypes & GrSDFTControl::kDirect) {
if (key.fSetOfDrawingTypes & GrSDFTOptions::kDirect) {
// Store the fractional offset of the position. We know that the matrix can't be
// perspective at this point.
SkPoint mappedOrigin = drawMatrix.mapOrigin();
@ -453,7 +453,7 @@ void GrSurfaceDrawContext::drawGlyphRunList(const GrClip* clip,
glyphRunList,
drawMatrix,
drawPaint,
control);
options);
if (canCache) {
blob->addKey(key);

View File

@ -500,8 +500,8 @@ GrOp::Owner GrAtlasTextOp::CreateOpTestingOnly(GrSurfaceDrawContext* rtc,
}
auto rContext = rtc->recordingContext();
GrSDFTControl control =
rContext->priv().getSDFTControl(rtc->surfaceProps().isUseDeviceIndependentFonts());
GrSDFTOptions SDFOptions =
rContext->priv().getSDFTOptions(rtc->surfaceProps().isUseDeviceIndependentFonts());
sk_sp<GrTextBlob> blob = GrTextBlob::Make(glyphRunList, drawMatrix);
SkGlyphRunListPainter* painter = rtc->glyphRunPainter();
@ -509,7 +509,7 @@ GrOp::Owner GrAtlasTextOp::CreateOpTestingOnly(GrSurfaceDrawContext* rtc,
*glyphRunList.begin(),
drawMatrix,
glyphRunList.paint(),
control,
SDFOptions,
blob.get());
if (blob->subRunList().isEmpty()) {
return nullptr;

View File

@ -5,7 +5,7 @@
* found in the LICENSE file.
*/
#include "src/gpu/text/GrSDFTControl.h"
#include "src/gpu/text/GrSDFTOptions.h"
#include "include/core/SkFont.h"
#include "include/core/SkGraphics.h"
@ -19,7 +19,7 @@
// DF sizes and thresholds for usage of the small and medium sizes. For example, above
// kSmallDFFontLimit we will use the medium size. The large size is used up until the size at
// which we switch over to drawing as paths as controlled by Control.
// which we switch over to drawing as paths as controlled by Options.
static const int kSmallDFFontSize = 32;
static const int kSmallDFFontLimit = 32;
static const int kMediumDFFontSize = 72;
@ -30,14 +30,14 @@ static const int kLargeDFFontLimit = 162;
static const int kExtraLargeDFFontSize = 256;
#endif
SkScalar GrSDFTControl::MinSDFTRange(bool useSDFTForSmallText, SkScalar min) {
SkScalar GrSDFTOptions::MinSDFTRange(bool useSDFTForSmallText, SkScalar min) {
if (!useSDFTForSmallText) {
return kLargeDFFontSize;
}
return min;
}
GrSDFTControl::GrSDFTControl(
GrSDFTOptions::GrSDFTOptions(
bool ableToUseSDFT, bool useSDFTForSmallText, SkScalar min, SkScalar max)
: fMinDistanceFieldFontSize{MinSDFTRange(useSDFTForSmallText, min)}
, fMaxDistanceFieldFontSize{max}
@ -45,7 +45,7 @@ GrSDFTControl::GrSDFTControl(
SkASSERT_RELEASE(0 < min && min <= max);
}
auto GrSDFTControl::drawingType(
auto GrSDFTOptions::drawingType(
const SkFont& font, const SkPaint& paint, const SkMatrix& viewMatrix) const -> DrawingType {
// Use paths as the first choice for hairlines and perspective.
@ -95,7 +95,7 @@ SkScalar scaled_text_size(const SkScalar textSize, const SkMatrix& viewMatrix) {
return scaledTextSize;
}
SkFont GrSDFTControl::getSDFFont(const SkFont& font,
SkFont GrSDFTOptions::getSDFFont(const SkFont& font,
const SkMatrix& viewMatrix,
SkScalar* textRatio) const {
SkScalar textSize = font.getSize();
@ -133,7 +133,7 @@ SkFont GrSDFTControl::getSDFFont(const SkFont& font,
return dfFont;
}
std::pair<SkScalar, SkScalar> GrSDFTControl::computeSDFMinMaxScale(
std::pair<SkScalar, SkScalar> GrSDFTOptions::computeSDFMinMaxScale(
SkScalar textSize, const SkMatrix& viewMatrix) const {
SkScalar scaledTextSize = scaled_text_size(textSize, viewMatrix);

View File

@ -5,8 +5,8 @@
* found in the LICENSE file.
*/
#ifndef GrSDFTControl_DEFINED
#define GrSDFTControl_DEFINED
#ifndef GrSDFTOptions_DEFINED
#define GrSDFTOptions_DEFINED
#include "include/core/SkFont.h"
#include "include/core/SkScalar.h"
@ -14,9 +14,9 @@
class SkMatrix;
class SkSurfaceProps;
class GrSDFTControl {
class GrSDFTOptions {
public:
GrSDFTControl(bool ableToUseSDFT, bool useSDFTForSmallText, SkScalar min, SkScalar max);
GrSDFTOptions(bool ableToUseSDFT, bool useSDFTForSmallText, SkScalar min, SkScalar max);
enum DrawingType : uint8_t {
kDirect = 1,
@ -45,4 +45,4 @@ private:
const bool fAbleToUseSDFT;
};
#endif // GrSDFTControl_DEFINED
#endif // GrSDFTOptions_DEFINED

View File

@ -1365,7 +1365,7 @@ bool GrTextBlob::Key::operator==(const GrTextBlob::Key& that) const {
return false;
}
if (fSetOfDrawingTypes & GrSDFTControl::kDirect) {
if (fSetOfDrawingTypes & GrSDFTOptions::kDirect) {
auto [compatible, _] = check_integer_translate(fDrawMatrix, that.fDrawMatrix);
return compatible;
}
@ -1487,12 +1487,12 @@ void GrTextBlob::makeSubRuns(SkGlyphRunListPainter* painter,
const SkGlyphRunList& glyphRunList,
const SkMatrix& drawMatrix,
const SkPaint& runPaint,
const GrSDFTControl& control) {
const GrSDFTOptions& options) {
for (auto& glyphRun : glyphRunList) {
painter->processGlyphRun(glyphRun,
drawMatrix,
runPaint,
control,
options,
this);
}
}

View File

@ -409,7 +409,7 @@ public:
const SkGlyphRunList& glyphRunList,
const SkMatrix& drawMatrix,
const SkPaint& runPaint,
const GrSDFTControl& control);
const GrSDFTOptions& options);
static const Key& GetKey(const GrTextBlob& blob);
static uint32_t Hash(const Key& key);

View File

@ -20,7 +20,7 @@
#include "src/core/SkTypeface_remote.h"
#include "src/gpu/GrDirectContextPriv.h"
#include "src/gpu/GrRecordingContextPriv.h"
#include "src/gpu/text/GrSDFTControl.h"
#include "src/gpu/text/GrSDFTOptions.h"
#include "tests/Test.h"
#include "tools/Resources.h"
#include "tools/ToolUtils.h"
@ -683,8 +683,8 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SkRemoteGlyphCache_DrawTextAsDFT, reporter, c
// A scale transform forces fallback to dft.
SkMatrix matrix = SkMatrix::Scale(16, 16);
GrSDFTControl control = direct->priv().asRecordingContext()->priv().getSDFTControl(true);
REPORTER_ASSERT(reporter, control.drawingType(font, paint, matrix) == GrSDFTControl::kSDFT);
GrSDFTOptions options = direct->priv().asRecordingContext()->priv().getSDFTOptions(true);
REPORTER_ASSERT(reporter, options.drawingType(font, paint, matrix) == GrSDFTOptions::kSDFT);
// Server.
auto serverTf = SkTypeface::MakeFromName("monospace", SkFontStyle());