Rename flag from "distance field" to "device independent."
Review URL: https://codereview.chromium.org/1322433006
diff --git a/bench/nanobench.cpp b/bench/nanobench.cpp
index c79c75d..a5a70d9 100644
--- a/bench/nanobench.cpp
+++ b/bench/nanobench.cpp
@@ -167,7 +167,8 @@
return true;
}
bool init(SkImageInfo info, Benchmark* bench) override {
- uint32_t flags = this->config.useDFText ? SkSurfaceProps::kUseDistanceFieldFonts_Flag : 0;
+ uint32_t flags = this->config.useDFText ? SkSurfaceProps::kUseDeviceIndependentFonts_Flag :
+ 0;
SkSurfaceProps props(flags, SkSurfaceProps::kLegacyFontHost_InitType);
this->surface.reset(SkSurface::NewRenderTarget(gGrFactory->get(this->config.ctxType),
SkSurface::kNo_Budgeted, info,
diff --git a/dm/DMGpuSupport.h b/dm/DMGpuSupport.h
index 3b64bd8..0b9596e 100644
--- a/dm/DMGpuSupport.h
+++ b/dm/DMGpuSupport.h
@@ -29,8 +29,8 @@
GrGLStandard gpuAPI,
SkImageInfo info,
int samples,
- bool useDFText) {
- uint32_t flags = useDFText ? SkSurfaceProps::kUseDistanceFieldFonts_Flag : 0;
+ bool useDIText) {
+ uint32_t flags = useDIText ? SkSurfaceProps::kUseDeviceIndependentFonts_Flag : 0;
SkSurfaceProps props(flags, SkSurfaceProps::kLegacyFontHost_InitType);
return SkSurface::NewRenderTarget(grFactory->get(type, gpuAPI), SkSurface::kNo_Budgeted,
info, samples, &props);
diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp
index e66a452..64c18fc 100644
--- a/dm/DMSrcSink.cpp
+++ b/dm/DMSrcSink.cpp
@@ -638,12 +638,12 @@
GPUSink::GPUSink(GrContextFactory::GLContextType ct,
GrGLStandard api,
int samples,
- bool dfText,
+ bool diText,
bool threaded)
: fContextType(ct)
, fGpuAPI(api)
, fSampleCount(samples)
- , fUseDFText(dfText)
+ , fUseDIText(diText)
, fThreaded(threaded) {}
int GPUSink::enclave() const {
@@ -661,7 +661,7 @@
const SkImageInfo info =
SkImageInfo::Make(size.width(), size.height(), kN32_SkColorType, kPremul_SkAlphaType);
SkAutoTUnref<SkSurface> surface(
- NewGpuSurface(&factory, fContextType, fGpuAPI, info, fSampleCount, fUseDFText));
+ NewGpuSurface(&factory, fContextType, fGpuAPI, info, fSampleCount, fUseDIText));
if (!surface) {
return "Could not create a surface.";
}
diff --git a/dm/DMSrcSink.h b/dm/DMSrcSink.h
index 82a0725..e5f22f8 100644
--- a/dm/DMSrcSink.h
+++ b/dm/DMSrcSink.h
@@ -168,7 +168,7 @@
class GPUSink : public Sink {
public:
- GPUSink(GrContextFactory::GLContextType, GrGLStandard, int samples, bool dfText, bool threaded);
+ GPUSink(GrContextFactory::GLContextType, GrGLStandard, int samples, bool diText, bool threaded);
Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override;
int enclave() const override;
@@ -178,7 +178,7 @@
GrContextFactory::GLContextType fContextType;
GrGLStandard fGpuAPI;
int fSampleCount;
- bool fUseDFText;
+ bool fUseDIText;
bool fThreaded;
};
diff --git a/gm/dftext.cpp b/gm/dftext.cpp
index c66e03f..78b1598 100644
--- a/gm/dftext.cpp
+++ b/gm/dftext.cpp
@@ -49,7 +49,7 @@
#if SK_SUPPORT_GPU
GrContext* ctx = inputCanvas->getGrContext();
SkImageInfo info = SkImageInfo::MakeN32Premul(onISize());
- SkSurfaceProps props(SkSurfaceProps::kUseDistanceFieldFonts_Flag,
+ SkSurfaceProps props(SkSurfaceProps::kUseDeviceIndependentFonts_Flag,
SkSurfaceProps::kLegacyFontHost_InitType);
SkAutoTUnref<SkSurface> surface(SkSurface::NewRenderTarget(ctx, SkSurface::kNo_Budgeted,
info, 0, &props));
diff --git a/gm/textblobmixedsizes.cpp b/gm/textblobmixedsizes.cpp
index 9f745d6..d5c2000 100644
--- a/gm/textblobmixedsizes.cpp
+++ b/gm/textblobmixedsizes.cpp
@@ -97,7 +97,7 @@
// Create a new Canvas to enable DFT
GrContext* ctx = inputCanvas->getGrContext();
SkImageInfo info = SkImageInfo::MakeN32Premul(onISize());
- SkSurfaceProps props(SkSurfaceProps::kUseDistanceFieldFonts_Flag,
+ SkSurfaceProps props(SkSurfaceProps::kUseDeviceIndependentFonts_Flag,
SkSurfaceProps::kLegacyFontHost_InitType);
surface.reset(SkSurface::NewRenderTarget(ctx, SkSurface::kNo_Budgeted, info, 0,
&props));
diff --git a/include/core/SkSurfaceProps.h b/include/core/SkSurfaceProps.h
index 1083599..735561f 100644
--- a/include/core/SkSurfaceProps.h
+++ b/include/core/SkSurfaceProps.h
@@ -51,10 +51,13 @@
class SK_API SkSurfaceProps {
public:
enum Flags {
- kDisallowAntiAlias_Flag = 1 << 0,
- kDisallowDither_Flag = 1 << 1,
- kUseDistanceFieldFonts_Flag = 1 << 2,
+ kDisallowAntiAlias_Flag = 1 << 0,
+ kDisallowDither_Flag = 1 << 1,
+ kUseDeviceIndependentFonts_Flag = 1 << 2,
};
+ /** Deprecated alias used by Chromium. Will be removed. */
+ static const Flags kUseDistanceFieldFonts_Flag = kUseDeviceIndependentFonts_Flag;
+
SkSurfaceProps(uint32_t flags, SkPixelGeometry);
enum InitType {
@@ -69,7 +72,9 @@
bool isDisallowAA() const { return SkToBool(fFlags & kDisallowAntiAlias_Flag); }
bool isDisallowDither() const { return SkToBool(fFlags & kDisallowDither_Flag); }
- bool isUseDistanceFieldFonts() const { return SkToBool(fFlags & kUseDistanceFieldFonts_Flag); }
+ bool isUseDeviceIndependentFonts() const {
+ return SkToBool(fFlags & kUseDeviceIndependentFonts_Flag);
+ }
private:
SkSurfaceProps();
diff --git a/samplecode/SampleApp.cpp b/samplecode/SampleApp.cpp
index 5205007..22e8b8a 100644
--- a/samplecode/SampleApp.cpp
+++ b/samplecode/SampleApp.cpp
@@ -1798,7 +1798,7 @@
void SampleWindow::toggleDistanceFieldFonts() {
SkSurfaceProps props = this->getSurfaceProps();
- uint32_t flags = props.flags() ^ SkSurfaceProps::kUseDistanceFieldFonts_Flag;
+ uint32_t flags = props.flags() ^ SkSurfaceProps::kUseDeviceIndependentFonts_Flag;
this->setSurfaceProps(SkSurfaceProps(flags, props.pixelGeometry()));
this->updateTitle();
@@ -2006,8 +2006,8 @@
if (fPerspAnim) {
title.prepend("<K> ");
}
- if (this->getSurfaceProps().flags() & SkSurfaceProps::kUseDistanceFieldFonts_Flag) {
- title.prepend("<DFF> ");
+ if (this->getSurfaceProps().flags() & SkSurfaceProps::kUseDeviceIndependentFonts_Flag) {
+ title.prepend("<DIF> ");
}
title.prepend(trystate_str(fLCDState, "LCD ", "lcd "));
diff --git a/src/gpu/GrAtlasTextContext.cpp b/src/gpu/GrAtlasTextContext.cpp
index 06d6675..3de0ef8 100644
--- a/src/gpu/GrAtlasTextContext.cpp
+++ b/src/gpu/GrAtlasTextContext.cpp
@@ -458,7 +458,7 @@
return false;
}
- bool useDFT = fSurfaceProps.isUseDistanceFieldFonts();
+ bool useDFT = fSurfaceProps.isUseDeviceIndependentFonts();
#if SK_FORCE_DISTANCE_FIELD_TEXT
useDFT = true;
#endif
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index 2fea2cb..a934501 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -120,12 +120,12 @@
const SkSurfaceProps props(SkSurfacePropsCopyOrDefault(surfaceProps));
SkASSERT(props.pixelGeometry() < kNumPixelGeometries);
- if (!fDrawContext[props.pixelGeometry()][props.isUseDistanceFieldFonts()]) {
- fDrawContext[props.pixelGeometry()][props.isUseDistanceFieldFonts()] =
+ if (!fDrawContext[props.pixelGeometry()][props.isUseDeviceIndependentFonts()]) {
+ fDrawContext[props.pixelGeometry()][props.isUseDeviceIndependentFonts()] =
new GrDrawContext(fContext, fDrawTarget, props);
}
- return fDrawContext[props.pixelGeometry()][props.isUseDistanceFieldFonts()];
+ return fDrawContext[props.pixelGeometry()][props.isUseDeviceIndependentFonts()];
}
////////////////////////////////////////////////////////////////////////////////
diff --git a/src/gpu/GrDrawContext.cpp b/src/gpu/GrDrawContext.cpp
index e56a729..4b86fd0 100644
--- a/src/gpu/GrDrawContext.cpp
+++ b/src/gpu/GrDrawContext.cpp
@@ -62,7 +62,7 @@
const SkSurfaceProps& surfaceProps) {
if (fContext->caps()->shaderCaps()->pathRenderingSupport() &&
renderTarget->isStencilBufferMultisampled() &&
- fSurfaceProps.isUseDistanceFieldFonts()) { // FIXME: Rename the dff flag to be more general.
+ fSurfaceProps.isUseDeviceIndependentFonts()) {
GrStencilAttachment* sb = renderTarget->renderTargetPriv().attachStencilAttachment();
if (sb) {
return GrStencilAndCoverTextContext::Create(fContext, this, surfaceProps);
diff --git a/tools/PictureRenderer.cpp b/tools/PictureRenderer.cpp
index c491e86..21bb933 100644
--- a/tools/PictureRenderer.cpp
+++ b/tools/PictureRenderer.cpp
@@ -161,7 +161,7 @@
target.reset(fGrContext->textureProvider()->createTexture(desc, false, nullptr, 0));
}
- uint32_t flags = fUseDFText ? SkSurfaceProps::kUseDistanceFieldFonts_Flag : 0;
+ uint32_t flags = fUseDFText ? SkSurfaceProps::kUseDeviceIndependentFonts_Flag : 0;
SkSurfaceProps props(flags, SkSurfaceProps::kLegacyFontHost_InitType);
SkAutoTUnref<SkGpuDevice> device(
SkGpuDevice::Create(target->asRenderTarget(), &props,