Preserve sdf text in SkPictureImageFilter

This code appears to be clearing out the SkSurfaceProps in order to
disable LCD text. We ought to be able to only disable the LCD text,
while preserving the SkSurfaceProps flags.

Bug: skia:11396
Change-Id: I7c1f49f59639404535a445f0318ab97b07c20c84
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/397636
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
This commit is contained in:
Chris Dalton 2021-04-19 16:33:29 -06:00 committed by Skia Commit-Bot
parent 4d92e41839
commit e0ee932e5e
2 changed files with 7 additions and 2 deletions

View File

@ -63,6 +63,10 @@ public:
SkSurfaceProps(const SkSurfaceProps&);
SkSurfaceProps& operator=(const SkSurfaceProps&);
SkSurfaceProps cloneWithPixelGeometry(SkPixelGeometry newPixelGeometry) const {
return SkSurfaceProps(fFlags, newPixelGeometry);
}
uint32_t flags() const { return fFlags; }
SkPixelGeometry pixelGeometry() const { return fPixelGeometry; }

View File

@ -100,8 +100,9 @@ sk_sp<SkSpecialImage> SkPictureImageFilter::onFilterImage(const Context& ctx,
SkASSERT(!bounds.isEmpty());
// Given the standard usage of the picture image filter (i.e., to render content at a fixed
// resolution that, most likely, differs from the screen's) disable LCD text.
SkSurfaceProps props(0, kUnknown_SkPixelGeometry);
// resolution that, most likely, differs from the screen's) disable LCD text by removing any
// knowledge of the pixel geometry.
SkSurfaceProps props = ctx.surfaceProps()->cloneWithPixelGeometry(kUnknown_SkPixelGeometry);
sk_sp<SkSpecialSurface> surf(ctx.makeSurface(bounds.size(), &props));
if (!surf) {
return nullptr;