Revert "Remove use of legacy display globals."
This reverts commit c1916c34febe0c6f9805b5d9fc18349ec8b74008.
Reason for revert: Bots unhappy
Original change's description:
> Remove use of legacy display globals.
>
> In the ongoing effort to remove the display globals from Skia, allow
> their use only if SK_LEGACY_SURFACE_PROPS is defined. Do not define this
> in a normal Skia build and remove all use from Skia code.
>
> Change-Id: I9ff550f5db246b9024aac687a1bc01321f1be4c8
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/319343
> Reviewed-by: Herb Derby <herb@google.com>
> Commit-Queue: Ben Wagner <bungeman@google.com>
TBR=djsollen@google.com,bungeman@google.com,herb@google.com,reed@google.com
Change-Id: I365d2b1d19241a90130bc1b59663651817966f63
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/322400
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
diff --git a/bench/GlyphQuadFillBench.cpp b/bench/GlyphQuadFillBench.cpp
index 8f2966a..680a16c 100644
--- a/bench/GlyphQuadFillBench.cpp
+++ b/bench/GlyphQuadFillBench.cpp
@@ -43,8 +43,7 @@
auto glyphRunList = builder.useGlyphRunList();
SkASSERT(!glyphRunList.empty());
fBlob = GrTextBlob::Make(glyphRunList, view);
- SkSurfaceProps props;
- canvas->getProps(&props);
+ SkSurfaceProps props{SkSurfaceProps::kLegacyFontHost_InitType};
auto colorSpace = SkColorSpace::MakeSRGB();
SkGlyphRunListPainter painter{props, kUnknown_SkColorType,
colorSpace.get(), SkStrikeCache::GlobalStrikeCache()};
diff --git a/bench/SkGlyphCacheBench.cpp b/bench/SkGlyphCacheBench.cpp
index 2e9f25d..695c40c 100644
--- a/bench/SkGlyphCacheBench.cpp
+++ b/bench/SkGlyphCacheBench.cpp
@@ -220,9 +220,8 @@
bool isSuitableFor(Backend b) override { return b == kNonRendering_Backend; }
- void onDraw(int loops, SkCanvas* modelCanvas) override {
- SkSurfaceProps props;
- modelCanvas->getProps(&props);
+ void onDraw(int loops, SkCanvas*) override {
+ const SkSurfaceProps props(SkSurfaceProps::kLegacyFontHost_InitType);
SkTextBlobCacheDiffCanvas canvas{1024, 1024, props, fServer.get()};
loops *= 100;
while (loops --> 0) {
diff --git a/bench/nanobench.cpp b/bench/nanobench.cpp
index a293cb2..3966c83 100644
--- a/bench/nanobench.cpp
+++ b/bench/nanobench.cpp
@@ -251,7 +251,7 @@
this->factory = std::make_unique<GrContextFactory>(options);
uint32_t flags = this->config.useDFText ? SkSurfaceProps::kUseDeviceIndependentFonts_Flag :
0;
- SkSurfaceProps props(flags, kRGB_H_SkPixelGeometry);
+ SkSurfaceProps props(flags, SkSurfaceProps::kLegacyFontHost_InitType);
this->surface = SkSurface::MakeRenderTarget(
this->factory->get(this->config.ctxType, this->config.ctxOverrides),
SkBudgeted::kNo, info, this->config.samples, &props);
diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp
index 9c1c124..88a0d9e 100644
--- a/dm/DMSrcSink.cpp
+++ b/dm/DMSrcSink.cpp
@@ -1474,7 +1474,7 @@
SkImageInfo info = SkImageInfo::Make(size, fColorType, fAlphaType, fColorSpace);
uint32_t flags = fUseDIText ? SkSurfaceProps::kUseDeviceIndependentFonts_Flag : 0;
- SkSurfaceProps props(flags, kRGB_H_SkPixelGeometry);
+ SkSurfaceProps props(flags, SkSurfaceProps::kLegacyFontHost_InitType);
switch (fSurfType) {
case SkCommandLineConfigGpu::SurfType::kDefault:
@@ -2122,7 +2122,7 @@
dst->allocPixelsFlags(SkImageInfo::Make(size, fColorType, alphaType, fColorSpace),
SkBitmap::kZeroPixels_AllocFlag);
- SkCanvas canvas(*dst, SkSurfaceProps(0, kRGB_H_SkPixelGeometry));
+ SkCanvas canvas(*dst);
return src.draw(nullptr, &canvas);
}
diff --git a/example/SkiaSDLExample.cpp b/example/SkiaSDLExample.cpp
index 793416f..95c0828 100644
--- a/example/SkiaSDLExample.cpp
+++ b/example/SkiaSDLExample.cpp
@@ -229,8 +229,8 @@
// setup SkSurface
// To use distance field text, use commented out SkSurfaceProps instead
// SkSurfaceProps props(SkSurfaceProps::kUseDeviceIndependentFonts_Flag,
- // SkSurfaceProps::kUnknown_SkPixelGeometry);
- SkSurfaceProps props;
+ // SkSurfaceProps::kLegacyFontHost_InitType);
+ SkSurfaceProps props(SkSurfaceProps::kLegacyFontHost_InitType);
sk_sp<SkSurface> surface(SkSurface::MakeFromBackendRenderTarget(grContext.get(), target,
kBottomLeft_GrSurfaceOrigin,
diff --git a/gm/dftext.cpp b/gm/dftext.cpp
index 1f2c568..a1f6c84 100644
--- a/gm/dftext.cpp
+++ b/gm/dftext.cpp
@@ -61,10 +61,8 @@
SkISize size = onISize();
SkImageInfo info = SkImageInfo::MakeN32(size.width(), size.height(), kPremul_SkAlphaType,
inputCanvas->imageInfo().refColorSpace());
- SkSurfaceProps inputProps;
- inputCanvas->getProps(&inputProps);
- SkSurfaceProps props(SkSurfaceProps::kUseDeviceIndependentFonts_Flag | inputProps.flags(),
- inputProps.pixelGeometry());
+ SkSurfaceProps props(SkSurfaceProps::kUseDeviceIndependentFonts_Flag,
+ SkSurfaceProps::kLegacyFontHost_InitType);
auto surface(SkSurface::MakeRenderTarget(ctx, SkBudgeted::kNo, info, 0, &props));
SkCanvas* canvas = surface ? surface->getCanvas() : inputCanvas;
// init our new canvas with the old canvas's matrix
diff --git a/gm/dftext_blob_persp.cpp b/gm/dftext_blob_persp.cpp
index f401a1b..9e50628 100644
--- a/gm/dftext_blob_persp.cpp
+++ b/gm/dftext_blob_persp.cpp
@@ -66,10 +66,8 @@
}
SkImageInfo info = SkImageInfo::MakeN32(size.width(), size.height(), kPremul_SkAlphaType,
inputCanvas->imageInfo().refColorSpace());
- SkSurfaceProps inputProps;
- inputCanvas->getProps(&inputProps);
- SkSurfaceProps props(SkSurfaceProps::kUseDeviceIndependentFonts_Flag | inputProps.flags(),
- inputProps.pixelGeometry());
+ SkSurfaceProps props(SkSurfaceProps::kUseDeviceIndependentFonts_Flag,
+ SkSurfaceProps::kLegacyFontHost_InitType);
auto surface = SkSurface::MakeRenderTarget(ctx, SkBudgeted::kNo, info, 0, &props);
SkCanvas* canvas = surface ? surface->getCanvas() : inputCanvas;
// init our new canvas with the old canvas's matrix
diff --git a/gm/lcdblendmodes.cpp b/gm/lcdblendmodes.cpp
index 670a826..91c3d63 100644
--- a/gm/lcdblendmodes.cpp
+++ b/gm/lcdblendmodes.cpp
@@ -72,8 +72,7 @@
canvas->drawRect(r, p);
SkImageInfo info = SkImageInfo::MakeN32Premul(kWidth, kHeight);
- SkSurfaceProps props = SkSurfaceProps(0, kRGB_H_SkPixelGeometry);
- auto surface(ToolUtils::makeSurface(canvas, info, &props));
+ auto surface(ToolUtils::makeSurface(canvas, info));
SkCanvas* surfCanvas = surface->getCanvas();
this->drawColumn(surfCanvas, SK_ColorBLACK, SK_ColorWHITE, false);
diff --git a/gm/textblobmixedsizes.cpp b/gm/textblobmixedsizes.cpp
index 01aae0c..b891c8f 100644
--- a/gm/textblobmixedsizes.cpp
+++ b/gm/textblobmixedsizes.cpp
@@ -110,10 +110,8 @@
sk_sp<SkColorSpace> colorSpace = inputCanvas->imageInfo().refColorSpace();
SkImageInfo info = SkImageInfo::MakeN32(size.width(), size.height(),
kPremul_SkAlphaType, colorSpace);
- SkSurfaceProps inputProps;
- inputCanvas->getProps(&inputProps);
- SkSurfaceProps props(SkSurfaceProps::kUseDeviceIndependentFonts_Flag | inputProps.flags(),
- inputProps.pixelGeometry());
+ SkSurfaceProps props(SkSurfaceProps::kUseDeviceIndependentFonts_Flag,
+ SkSurfaceProps::kLegacyFontHost_InitType);
surface = SkSurface::MakeRenderTarget(ctx, SkBudgeted::kNo, info, 0, &props);
canvas = surface ? surface->getCanvas() : inputCanvas;
// init our new canvas with the old canvas's matrix
diff --git a/include/core/SkCanvas.h b/include/core/SkCanvas.h
index b3004ce..8287ce6 100644
--- a/include/core/SkCanvas.h
+++ b/include/core/SkCanvas.h
@@ -178,7 +178,7 @@
explicit SkCanvas(sk_sp<SkBaseDevice> device);
/** Constructs a canvas that draws into bitmap.
- Sets kUnknown_SkPixelGeometry in constructed SkSurface.
+ Sets SkSurfaceProps::kLegacyFontHost_InitType in constructed SkSurface.
SkBitmap is copied so that subsequently editing bitmap will not affect
constructed SkCanvas.
diff --git a/include/core/SkFontLCDConfig.h b/include/core/SkFontLCDConfig.h
index e63d98c..1d40b82 100644
--- a/include/core/SkFontLCDConfig.h
+++ b/include/core/SkFontLCDConfig.h
@@ -10,7 +10,6 @@
#include "include/core/SkTypes.h"
-#ifdef SK_LEGACY_SURFACE_PROPS
class SK_API SkFontLCDConfig {
public:
/** LCDs either have their color elements arranged horizontally or
@@ -55,6 +54,5 @@
/** @deprecated get from Device. */
static LCDOrder GetSubpixelOrder();
};
-#endif
#endif
diff --git a/include/core/SkSurfaceProps.h b/include/core/SkSurfaceProps.h
index de8daaa..9d7f4e1 100644
--- a/include/core/SkSurfaceProps.h
+++ b/include/core/SkSurfaceProps.h
@@ -56,18 +56,13 @@
/** Deprecated alias used by Chromium. Will be removed. */
static const Flags kUseDistanceFieldFonts_Flag = kUseDeviceIndependentFonts_Flag;
-#ifndef SK_LEGACY_SURFACE_PROPS
- SkSurfaceProps();
-#endif
SkSurfaceProps(uint32_t flags, SkPixelGeometry);
-#ifdef SK_LEGACY_SURFACE_PROPS
enum InitType {
kLegacyFontHost_InitType
};
SkSurfaceProps(InitType);
SkSurfaceProps(uint32_t flags, InitType);
-#endif
SkSurfaceProps(const SkSurfaceProps&);
SkSurfaceProps& operator=(const SkSurfaceProps&);
@@ -86,9 +81,7 @@
return !(*this == that);
}
private:
-#ifdef SK_LEGACY_SURFACE_PROPS
SkSurfaceProps();
-#endif
uint32_t fFlags;
SkPixelGeometry fPixelGeometry;
diff --git a/samplecode/SampleTextureUpload.cpp b/samplecode/SampleTextureUpload.cpp
index 026cb4a..39f82d8 100644
--- a/samplecode/SampleTextureUpload.cpp
+++ b/samplecode/SampleTextureUpload.cpp
@@ -32,7 +32,7 @@
class RenderTargetTexture : public SkRefCnt {
public:
RenderTargetTexture(GrDirectContext* direct, int size) {
- SkSurfaceProps surfaceProps(0, kRGB_H_SkPixelGeometry);
+ SkSurfaceProps surfaceProps(SkSurfaceProps::kLegacyFontHost_InitType);
SkImageInfo imageInfo = SkImageInfo::Make(size, size, kRGBA_8888_SkColorType,
kPremul_SkAlphaType);
fSurface = SkSurface::MakeRenderTarget(direct, SkBudgeted::kNo, imageInfo, 0,
diff --git a/src/core/SkBitmapDevice.cpp b/src/core/SkBitmapDevice.cpp
index 200e345..e7a2792 100644
--- a/src/core/SkBitmapDevice.cpp
+++ b/src/core/SkBitmapDevice.cpp
@@ -213,11 +213,7 @@
}
SkBitmapDevice::SkBitmapDevice(const SkBitmap& bitmap)
-#ifdef SK_LEGACY_SURFACE_PROPS
: INHERITED(bitmap.info(), SkSurfaceProps(SkSurfaceProps::kLegacyFontHost_InitType))
-#else
- : INHERITED(bitmap.info(), SkSurfaceProps())
-#endif
, fBitmap(bitmap)
, fRCStack(bitmap.width(), bitmap.height())
, fGlyphPainter(this->surfaceProps(),
@@ -228,11 +224,7 @@
}
SkBitmapDevice* SkBitmapDevice::Create(const SkImageInfo& info) {
-#ifdef SK_LEGACY_SURFACE_PROPS
return Create(info, SkSurfaceProps(SkSurfaceProps::kLegacyFontHost_InitType));
-#else
- return Create(info, SkSurfaceProps());
-#endif
}
SkBitmapDevice::SkBitmapDevice(const SkBitmap& bitmap, const SkSurfaceProps& surfaceProps,
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index 222c6f4..20fa4cb 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -523,11 +523,7 @@
SkCanvas::SkCanvas()
: fMCStack(sizeof(MCRec), fMCRecStorage, sizeof(fMCRecStorage))
-#ifdef SK_LEGACY_SURFACE_PROPS
, fProps(SkSurfaceProps::kLegacyFontHost_InitType)
-#else
- , fProps()
-#endif
{
inc_canvas();
@@ -545,11 +541,7 @@
SkCanvas::SkCanvas(const SkIRect& bounds)
: fMCStack(sizeof(MCRec), fMCRecStorage, sizeof(fMCRecStorage))
-#ifdef SK_LEGACY_SURFACE_PROPS
, fProps(SkSurfaceProps::kLegacyFontHost_InitType)
-#else
- , fProps()
-#endif
{
inc_canvas();
@@ -579,11 +571,7 @@
SkCanvas::SkCanvas(const SkBitmap& bitmap, std::unique_ptr<SkRasterHandleAllocator> alloc,
SkRasterHandleAllocator::Handle hndl)
: fMCStack(sizeof(MCRec), fMCRecStorage, sizeof(fMCRecStorage))
-#ifdef SK_LEGACY_SURFACE_PROPS
, fProps(SkSurfaceProps::kLegacyFontHost_InitType)
-#else
- , fProps()
-#endif
, fAllocator(std::move(alloc))
{
inc_canvas();
@@ -596,7 +584,9 @@
#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
SkCanvas::SkCanvas(const SkBitmap& bitmap, ColorBehavior)
- : fMCStack(sizeof(MCRec), fMCRecStorage, sizeof(fMCRecStorage)), fProps(), fAllocator(nullptr)
+ : fMCStack(sizeof(MCRec), fMCRecStorage, sizeof(fMCRecStorage))
+ , fProps(SkSurfaceProps::kLegacyFontHost_InitType)
+ , fAllocator(nullptr)
{
inc_canvas();
diff --git a/src/core/SkFontLCDConfig.cpp b/src/core/SkFontLCDConfig.cpp
index ff9c606..f902e2c 100644
--- a/src/core/SkFontLCDConfig.cpp
+++ b/src/core/SkFontLCDConfig.cpp
@@ -7,7 +7,6 @@
#include "include/core/SkFontLCDConfig.h"
-#ifdef SK_LEGACY_SURFACE_PROPS
static SkFontLCDConfig::LCDOrientation gLCDOrientation = SkFontLCDConfig::kHorizontal_LCDOrientation;
static SkFontLCDConfig::LCDOrder gLCDOrder = SkFontLCDConfig::kRGB_LCDOrder;
@@ -26,4 +25,3 @@
void SkFontLCDConfig::SetSubpixelOrder(LCDOrder order) {
gLCDOrder = order;
}
-#endif
diff --git a/src/core/SkScalerContext.h b/src/core/SkScalerContext.h
index 49999c0..735ea19 100644
--- a/src/core/SkScalerContext.h
+++ b/src/core/SkScalerContext.h
@@ -316,11 +316,7 @@
SkScalerContextEffects* effects) {
SkPaint paint;
return MakeRecAndEffects(
-#ifdef SK_LEGACY_SURFACE_PROPS
font, paint, SkSurfaceProps(SkSurfaceProps::kLegacyFontHost_InitType),
-#else
- font, paint, SkSurfaceProps(),
-#endif
SkScalerContextFlags::kNone, SkMatrix::I(), rec, effects);
}
diff --git a/src/core/SkStrikeSpec.cpp b/src/core/SkStrikeSpec.cpp
index d64527d..95a5148 100644
--- a/src/core/SkStrikeSpec.cpp
+++ b/src/core/SkStrikeSpec.cpp
@@ -102,11 +102,7 @@
storage.commonSetup(*canonicalizedFont,
canonicalizedPaint,
-#ifdef SK_LEGACY_SURFACE_PROPS
SkSurfaceProps(SkSurfaceProps::kLegacyFontHost_InitType),
-#else
- SkSurfaceProps(),
-#endif
kFakeGammaAndBoostContrast,
SkMatrix::I());
return storage;
@@ -122,11 +118,7 @@
storage.commonSetup(font,
setupPaint,
-#ifdef SK_LEGACY_SURFACE_PROPS
SkSurfaceProps(SkSurfaceProps::kLegacyFontHost_InitType),
-#else
- SkSurfaceProps(),
-#endif
kFakeGammaAndBoostContrast,
SkMatrix::I());
diff --git a/src/core/SkSurfacePriv.h b/src/core/SkSurfacePriv.h
index f3e6f55..6e5ff09 100644
--- a/src/core/SkSurfacePriv.h
+++ b/src/core/SkSurfacePriv.h
@@ -16,11 +16,7 @@
if (props) {
return *props;
} else {
-#ifdef SK_LEGACY_SURFACE_PROPS
return SkSurfaceProps(SkSurfaceProps::kLegacyFontHost_InitType);
-#else
- return SkSurfaceProps();
-#endif
}
}
diff --git a/src/image/SkSurface.cpp b/src/image/SkSurface.cpp
index f7620d6..72e2de6 100644
--- a/src/image/SkSurface.cpp
+++ b/src/image/SkSurface.cpp
@@ -15,9 +15,6 @@
#include "src/image/SkRescaleAndReadPixels.h"
#include "src/image/SkSurface_Base.h"
-SkSurfaceProps::SkSurfaceProps() : fFlags(0), fPixelGeometry(kUnknown_SkPixelGeometry) {}
-
-#ifdef SK_LEGACY_SURFACE_PROPS
static SkPixelGeometry compute_default_geometry() {
SkFontLCDConfig::LCDOrder order = SkFontLCDConfig::GetSubpixelOrder();
if (SkFontLCDConfig::kNONE_LCDOrder == order) {
@@ -42,13 +39,14 @@
}
}
+SkSurfaceProps::SkSurfaceProps() : fFlags(0), fPixelGeometry(kUnknown_SkPixelGeometry) {}
+
SkSurfaceProps::SkSurfaceProps(InitType) : fFlags(0), fPixelGeometry(compute_default_geometry()) {}
SkSurfaceProps::SkSurfaceProps(uint32_t flags, InitType)
: fFlags(flags)
, fPixelGeometry(compute_default_geometry())
{}
-#endif
SkSurfaceProps::SkSurfaceProps(uint32_t flags, SkPixelGeometry pg)
: fFlags(flags), fPixelGeometry(pg)
diff --git a/tests/SkRemoteGlyphCacheTest.cpp b/tests/SkRemoteGlyphCacheTest.cpp
index eb5edb7..9635a0a 100644
--- a/tests/SkRemoteGlyphCacheTest.cpp
+++ b/tests/SkRemoteGlyphCacheTest.cpp
@@ -248,7 +248,7 @@
const SkPaint paint;
int glyphCount = 10;
auto serverBlob = buildTextBlob(serverTf, glyphCount);
- const SkSurfaceProps props;
+ const SkSurfaceProps props(SkSurfaceProps::kLegacyFontHost_InitType);
SkTextBlobCacheDiffCanvas cache_diff_canvas(
10, 10, props, &server, ctxInfo.directContext()->supportsDistanceFieldText());
cache_diff_canvas.drawTextBlob(serverBlob.get(), 0, 0, paint);
@@ -273,7 +273,7 @@
int glyphCount = 10;
auto serverBlob = buildTextBlob(serverTf, glyphCount);
- const SkSurfaceProps props;
+ const SkSurfaceProps props(SkSurfaceProps::kLegacyFontHost_InitType);
SkTextBlobCacheDiffCanvas cache_diff_canvas(10, 10, props, &server);
SkPaint paint;
cache_diff_canvas.drawTextBlob(serverBlob.get(), 0, 0, paint);
@@ -307,7 +307,7 @@
int glyphCount = 10;
auto serverBlob = buildTextBlob(serverTf, glyphCount);
- const SkSurfaceProps props;
+ const SkSurfaceProps props(SkSurfaceProps::kLegacyFontHost_InitType);
SkTextBlobCacheDiffCanvas cache_diff_canvas(10, 10, props, &server);
SkPaint paint;
cache_diff_canvas.drawTextBlob(serverBlob.get(), 0, 0, paint);
@@ -344,7 +344,7 @@
int glyphCount = 10;
auto serverBlob = buildTextBlob(serverTf, glyphCount);
- const SkSurfaceProps props;
+ const SkSurfaceProps props(SkSurfaceProps::kLegacyFontHost_InitType);
SkTextBlobCacheDiffCanvas cache_diff_canvas(10, 10, props, &server);
SkPaint paint;
cache_diff_canvas.drawTextBlob(serverBlob.get(), 0, 0, paint);
@@ -383,7 +383,7 @@
int glyphCount = 10;
auto serverBlob = buildTextBlob(serverTf, glyphCount);
- const SkSurfaceProps props;
+ const SkSurfaceProps props(SkSurfaceProps::kLegacyFontHost_InitType);
SkTextBlobCacheDiffCanvas cache_diff_canvas(10, 10, props, &server);
SkPaint paint;
cache_diff_canvas.drawTextBlob(serverBlob.get(), 0, 0, paint);
@@ -410,7 +410,7 @@
int glyphCount = 10;
auto serverBlob = buildTextBlob(serverTf, glyphCount);
- const SkSurfaceProps props;
+ const SkSurfaceProps props(SkSurfaceProps::kLegacyFontHost_InitType);
SkTextBlobCacheDiffCanvas cache_diff_canvas(10, 10, props, &server);
SkPaint paint;
REPORTER_ASSERT(reporter, server.remoteStrikeMapSizeForTesting() == 0u);
@@ -431,7 +431,7 @@
int glyphCount = 10;
auto serverBlob = buildTextBlob(serverTf, glyphCount);
- const SkSurfaceProps props;
+ const SkSurfaceProps props(SkSurfaceProps::kLegacyFontHost_InitType);
SkTextBlobCacheDiffCanvas cache_diff_canvas(10, 10, props, &server);
SkPaint paint;
REPORTER_ASSERT(reporter, server.remoteStrikeMapSizeForTesting() == 1u);
@@ -693,7 +693,7 @@
int glyphCount = 10;
auto serverBlob = buildTextBlob(serverTf, glyphCount);
- const SkSurfaceProps props;
+ const SkSurfaceProps props(SkSurfaceProps::kLegacyFontHost_InitType);
SkTextBlobCacheDiffCanvas cache_diff_canvas(
10, 10, props, &server, direct->supportsDistanceFieldText());
cache_diff_canvas.concat(matrix);
diff --git a/tests/TextBlobCacheTest.cpp b/tests/TextBlobCacheTest.cpp
index 19d0113..c02a9d1 100644
--- a/tests/TextBlobCacheTest.cpp
+++ b/tests/TextBlobCacheTest.cpp
@@ -67,7 +67,7 @@
bool stressTest) {
// setup surface
uint32_t flags = 0;
- SkSurfaceProps props(flags, kRGB_H_SkPixelGeometry);
+ SkSurfaceProps props(flags, SkSurfaceProps::kLegacyFontHost_InitType);
// configure our context for maximum stressing of cache and atlas
if (stressTest) {
diff --git a/tests/VkProtectedContextTest.cpp b/tests/VkProtectedContextTest.cpp
index 440a770..878de67 100644
--- a/tests/VkProtectedContextTest.cpp
+++ b/tests/VkProtectedContextTest.cpp
@@ -31,7 +31,7 @@
REPORTER_ASSERT(reporter, backendTex.isValid());
REPORTER_ASSERT(reporter, backendTex.isProtected());
- SkSurfaceProps surfaceProps = SkSurfaceProps(0, kRGB_H_SkPixelGeometry);
+ SkSurfaceProps surfaceProps = SkSurfaceProps(0, SkSurfaceProps::kLegacyFontHost_InitType);
sk_sp<SkSurface> surface = SkSurface::MakeFromBackendTexture(
dContext, backendTex, kTopLeft_GrSurfaceOrigin, 1,
kRGBA_8888_SkColorType, nullptr, &surfaceProps);
@@ -69,7 +69,7 @@
REPORTER_ASSERT(reporter, backendTex.isValid());
REPORTER_ASSERT(reporter, backendTex.isProtected());
- SkSurfaceProps surfaceProps = SkSurfaceProps(0, kRGB_H_SkPixelGeometry);
+ SkSurfaceProps surfaceProps = SkSurfaceProps(0, SkSurfaceProps::kLegacyFontHost_InitType);
sk_sp<SkSurface> surface = SkSurface::MakeFromBackendTextureAsRenderTarget(
dContext, backendTex, kTopLeft_GrSurfaceOrigin, 1,
kRGBA_8888_SkColorType, nullptr, &surfaceProps);
diff --git a/tools/fm/fm.cpp b/tools/fm/fm.cpp
index 3cba25e..b47c5f9 100644
--- a/tools/fm/fm.cpp
+++ b/tools/fm/fm.cpp
@@ -306,7 +306,7 @@
uint32_t flags = FLAGS_dit ? SkSurfaceProps::kUseDeviceIndependentFonts_Flag
: 0;
- SkSurfaceProps props(flags, kRGB_H_SkPixelGeometry);
+ SkSurfaceProps props(flags, SkSurfaceProps::kLegacyFontHost_InitType);
sk_sp<SkSurface> surface;
GrBackendTexture backendTexture;
diff --git a/tools/remote_demo.cpp b/tools/remote_demo.cpp
index 3dc6216..35ca41b 100644
--- a/tools/remote_demo.cpp
+++ b/tools/remote_demo.cpp
@@ -135,7 +135,7 @@
static bool push_font_data(const SkPicture& pic, SkStrikeServer* strikeServer,
sk_sp<SkColorSpace> colorSpace, int writeFd) {
const SkIRect bounds = pic.cullRect().round();
- const SkSurfaceProps props(0, kRGB_H_SkPixelGeometry);
+ const SkSurfaceProps props(SkSurfaceProps::kLegacyFontHost_InitType);
SkTextBlobCacheDiffCanvas filter(bounds.width(), bounds.height(), props,
strikeServer, std::move(colorSpace), true);
pic.playback(&filter);
diff --git a/tools/sk_app/DisplayParams.h b/tools/sk_app/DisplayParams.h
index c6a3e3d..afad8e1 100644
--- a/tools/sk_app/DisplayParams.h
+++ b/tools/sk_app/DisplayParams.h
@@ -18,7 +18,7 @@
: fColorType(kN32_SkColorType)
, fColorSpace(nullptr)
, fMSAASampleCount(1)
- , fSurfaceProps(0, kRGB_H_SkPixelGeometry)
+ , fSurfaceProps(SkSurfaceProps::kLegacyFontHost_InitType)
, fDisableVsync(false)
{}
diff --git a/tools/skottie_ios_app/SkMetalViewBridge.mm b/tools/skottie_ios_app/SkMetalViewBridge.mm
index 7f1ca2b..dd5de64 100644
--- a/tools/skottie_ios_app/SkMetalViewBridge.mm
+++ b/tools/skottie_ios_app/SkMetalViewBridge.mm
@@ -22,7 +22,7 @@
const SkColorType colorType = kBGRA_8888_SkColorType; // MTLPixelFormatBGRA8Unorm
sk_sp<SkColorSpace> colorSpace = nullptr; // MTLPixelFormatBGRA8Unorm
const GrSurfaceOrigin origin = kTopLeft_GrSurfaceOrigin;
- const SkSurfaceProps surfaceProps;
+ const SkSurfaceProps surfaceProps(SkSurfaceProps::kLegacyFontHost_InitType);
int sampleCount = (int)[mtkView sampleCount];
return SkSurface::MakeFromMTKView(rContext, (__bridge GrMTLHandle)mtkView, origin, sampleCount,
diff --git a/tools/skottie_ios_app/SkiaGLContext.mm b/tools/skottie_ios_app/SkiaGLContext.mm
index 9c3f5e4..916e3f4 100644
--- a/tools/skottie_ios_app/SkiaGLContext.mm
+++ b/tools/skottie_ios_app/SkiaGLContext.mm
@@ -25,7 +25,7 @@
static sk_sp<SkSurface> make_gl_surface(GrDirectContext* dContext, int width, int height) {
static constexpr int kStencilBits = 8;
static constexpr int kSampleCount = 1;
- static const SkSurfaceProps surfaceProps;
+ static const SkSurfaceProps surfaceProps = SkSurfaceProps::kLegacyFontHost_InitType;
if (!dContext || width <= 0 || height <= 0) {
return nullptr;
}
diff --git a/tools/skpbench/skpbench.cpp b/tools/skpbench/skpbench.cpp
index 15d8cbb..5a7527b 100644
--- a/tools/skpbench/skpbench.cpp
+++ b/tools/skpbench/skpbench.cpp
@@ -590,7 +590,7 @@
SkImageInfo::Make(width, height, config->getColorType(), config->getAlphaType(),
sk_ref_sp(config->getColorSpace()));
uint32_t flags = config->getUseDIText() ? SkSurfaceProps::kUseDeviceIndependentFonts_Flag : 0;
- SkSurfaceProps props(flags, kRGB_H_SkPixelGeometry);
+ SkSurfaceProps props(flags, SkSurfaceProps::kLegacyFontHost_InitType);
sk_sp<SkSurface> surface =
SkSurface::MakeRenderTarget(ctx, SkBudgeted::kNo, info, config->getSamples(), &props);
if (!surface) {
diff --git a/tools/skqp/src/skqp.cpp b/tools/skqp/src/skqp.cpp
index 20a7e75..48216e0 100644
--- a/tools/skqp/src/skqp.cpp
+++ b/tools/skqp/src/skqp.cpp
@@ -289,7 +289,7 @@
const int h = size.height();
const SkImageInfo info =
SkImageInfo::Make(w, h, skqp::kColorType, kPremul_SkAlphaType, nullptr);
- const SkSurfaceProps props(0, kRGB_H_SkPixelGeometry);
+ const SkSurfaceProps props(0, SkSurfaceProps::kLegacyFontHost_InitType);
sk_sp<SkSurface> surf = SkSurface::MakeRenderTarget(
testCtx->makeContext(context_options(gm.get())).get(),
diff --git a/tools/viewer/Viewer.cpp b/tools/viewer/Viewer.cpp
index 61c68a0..daafba4 100644
--- a/tools/viewer/Viewer.cpp
+++ b/tools/viewer/Viewer.cpp
@@ -369,7 +369,6 @@
displayParams.fGrContextOptions.fShaderErrorHandler = &gShaderErrorHandler;
displayParams.fGrContextOptions.fSuppressPrints = true;
fWindow->setRequestedDisplayParams(displayParams);
- fDisplay = fWindow->getRequestedDisplayParams();
fRefresh = FLAGS_redraw;
// Configure timers
@@ -494,9 +493,8 @@
fCommands.addCommand('G', "Modes", "Geometry", [this]() {
DisplayParams params = fWindow->getRequestedDisplayParams();
uint32_t flags = params.fSurfaceProps.flags();
- SkPixelGeometry defaultPixelGeometry = fDisplay.fSurfaceProps.pixelGeometry();
- if (!fDisplayOverrides.fSurfaceProps.fPixelGeometry) {
- fDisplayOverrides.fSurfaceProps.fPixelGeometry = true;
+ if (!fPixelGeometryOverrides) {
+ fPixelGeometryOverrides = true;
params.fSurfaceProps = SkSurfaceProps(flags, kUnknown_SkPixelGeometry);
} else {
switch (params.fSurfaceProps.pixelGeometry()) {
@@ -513,8 +511,8 @@
params.fSurfaceProps = SkSurfaceProps(flags, kBGR_V_SkPixelGeometry);
break;
case kBGR_V_SkPixelGeometry:
- params.fSurfaceProps = SkSurfaceProps(flags, defaultPixelGeometry);
- fDisplayOverrides.fSurfaceProps.fPixelGeometry = false;
+ params.fSurfaceProps = SkSurfaceProps(flags, SkSurfaceProps::kLegacyFontHost_InitType);
+ fPixelGeometryOverrides = false;
break;
}
}
@@ -1024,7 +1022,7 @@
}
const DisplayParams& params = fWindow->getRequestedDisplayParams();
- if (fDisplayOverrides.fSurfaceProps.fPixelGeometry) {
+ if (fPixelGeometryOverrides) {
switch (params.fSurfaceProps.pixelGeometry()) {
case kUnknown_SkPixelGeometry:
title.append( " Flat");
@@ -1412,7 +1410,7 @@
}
auto make_surface = [=](int w, int h) {
- SkSurfaceProps props(fWindow->getRequestedDisplayParams().fSurfaceProps);
+ SkSurfaceProps props(SkSurfaceProps::kLegacyFontHost_InitType);
slideCanvas->getProps(&props);
SkImageInfo info = SkImageInfo::Make(w, h, colorType, kPremul_SkAlphaType, colorSpace);
@@ -1830,7 +1828,7 @@
}
int pixelGeometryIdx = 0;
- if (fDisplayOverrides.fSurfaceProps.fPixelGeometry) {
+ if (fPixelGeometryOverrides) {
pixelGeometryIdx = params.fSurfaceProps.pixelGeometry() + 1;
}
if (ImGui::Combo("Pixel Geometry", &pixelGeometryIdx,
@@ -1838,11 +1836,10 @@
{
uint32_t flags = params.fSurfaceProps.flags();
if (pixelGeometryIdx == 0) {
- fDisplayOverrides.fSurfaceProps.fPixelGeometry = false;
- SkPixelGeometry pixelGeometry = fDisplay.fSurfaceProps.pixelGeometry();
- params.fSurfaceProps = SkSurfaceProps(flags, pixelGeometry);
+ fPixelGeometryOverrides = false;
+ params.fSurfaceProps = SkSurfaceProps(flags, SkSurfaceProps::kLegacyFontHost_InitType);
} else {
- fDisplayOverrides.fSurfaceProps.fPixelGeometry = true;
+ fPixelGeometryOverrides = true;
SkPixelGeometry pixelGeometry = SkTo<SkPixelGeometry>(pixelGeometryIdx - 1);
params.fSurfaceProps = SkSurfaceProps(flags, pixelGeometry);
}
diff --git a/tools/viewer/Viewer.h b/tools/viewer/Viewer.h
index 52d4493..47913ae 100644
--- a/tools/viewer/Viewer.h
+++ b/tools/viewer/Viewer.h
@@ -92,18 +92,6 @@
bool fStyle = false;
bool fFilterQuality = false;
};
- struct SkSurfacePropsFields {
- bool fFlags = false;
- bool fPixelGeometry = false;
- };
- struct DisplayFields {
- bool fColorType = false;
- bool fColorSpace = false;
- bool fMSAASampleCount = false;
- bool fGrContextOptions = false;
- SkSurfacePropsFields fSurfaceProps;
- bool fDisableVsync = false;
- };
private:
enum class ColorMode {
kLegacy, // 8888, no color management
@@ -202,18 +190,11 @@
SkTArray<std::function<void(void)>> fDeferredActions;
- // fPaint contains override values, fPaintOverrides controls if overrides are applied.
SkPaint fPaint;
SkPaintFields fPaintOverrides;
-
- // fFont contains override values, fFontOverrides controls if overrides are applied.
SkFont fFont;
SkFontFields fFontOverrides;
-
- // fDisplay contains default values (fWindow.fRequestedDisplayParams contains the overrides),
- // fDisplayOverrides controls if overrides are applied.
- sk_app::DisplayParams fDisplay;
- DisplayFields fDisplayOverrides;
+ bool fPixelGeometryOverrides = false;
struct CachedShader {
bool fHovered = false;