Remove code guarded by SK_LEGACY_SURFACE_PROPS.

This removes the last of the SkFontHost LCD globals and the
SkSurfaceProps::kLegacyFontHost_InitType.

Bug: skia:3934
Change-Id: Ic2342a3ea3dbcd075d6817cbd3fc27274e376b8d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/329364
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Mike Reed <reed@google.com>
This commit is contained in:
Ben Wagner 2020-10-23 11:29:03 -04:00 committed by Skia Commit-Bot
parent 58a26a8362
commit 9abf719e67
11 changed files with 9 additions and 180 deletions

View File

@ -9,6 +9,12 @@ Milestone 88
* <insert new release notes here>
* Removed SkSurfaceProps::kLegacyFontHost_InitType, SkFontLCDConfig, and related code.
The default pixel geometry for SkSurfaceProps is now kUnknown instead of kRGB_H.
The removal was guarded by the SK_LEGACY_SURFACE_PROPS build flag which was later removed.
https://review.skia.org/322490
https://review.skia.org/329364
* Legacy 8-bit YUV interface removed from SkImageGenerator. Use more flexible SkYUVAPixmaps-
based interface instead.
https://review.skia.org/327917

View File

@ -36,7 +36,6 @@ skia_core_public = [
"$_include/core/SkFlattenable.h",
"$_include/core/SkFont.h",
"$_include/core/SkFontArguments.h",
"$_include/core/SkFontLCDConfig.h",
"$_include/core/SkFontMetrics.h",
"$_include/core/SkFontMgr.h",
"$_include/core/SkFontParameters.h",
@ -205,7 +204,6 @@ skia_core_sources = [
"$_src/core/SkFont.cpp",
"$_src/core/SkFontDescriptor.cpp",
"$_src/core/SkFontDescriptor.h",
"$_src/core/SkFontLCDConfig.cpp",
"$_src/core/SkFontMgr.cpp",
"$_src/core/SkFontMgrPriv.h",
"$_src/core/SkFontPriv.h",

View File

@ -1,60 +0,0 @@
/*
* Copyright 2013 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SkFontLCDConfig_DEFINED
#define SkFontLCDConfig_DEFINED
#include "include/core/SkTypes.h"
#ifdef SK_LEGACY_SURFACE_PROPS
class SK_API SkFontLCDConfig {
public:
/** LCDs either have their color elements arranged horizontally or
vertically. When rendering subpixel glyphs we need to know which way
round they are.
Note, if you change this after startup, you'll need to flush the glyph
cache because it'll have the wrong type of masks cached.
@deprecated use SkPixelGeometry instead.
*/
enum LCDOrientation {
kHorizontal_LCDOrientation = 0, //!< this is the default
kVertical_LCDOrientation = 1,
};
/** @deprecated set on Device creation. */
static void SetSubpixelOrientation(LCDOrientation orientation);
/** @deprecated get from Device. */
static LCDOrientation GetSubpixelOrientation();
/** LCD color elements can vary in order. For subpixel text we need to know
the order which the LCDs uses so that the color fringes are in the
correct place.
Note, if you change this after startup, you'll need to flush the glyph
cache because it'll have the wrong type of masks cached.
kNONE_LCDOrder means that the subpixel elements are not spatially
separated in any usable fashion.
@deprecated use SkPixelGeometry instead.
*/
enum LCDOrder {
kRGB_LCDOrder = 0, //!< this is the default
kBGR_LCDOrder = 1,
kNONE_LCDOrder = 2,
};
/** @deprecated set on Device creation. */
static void SetSubpixelOrder(LCDOrder order);
/** @deprecated get from Device. */
static LCDOrder GetSubpixelOrder();
};
#endif
#endif

View File

@ -56,18 +56,10 @@ public:
/** Deprecated alias used by Chromium. Will be removed. */
static const Flags kUseDistanceFieldFonts_Flag = kUseDeviceIndependentFonts_Flag;
#ifndef SK_LEGACY_SURFACE_PROPS
/** No flags, unknown pixel geometry. */
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&);
@ -85,11 +77,8 @@ public:
bool operator!=(const SkSurfaceProps& that) const {
return !(*this == that);
}
private:
#ifdef SK_LEGACY_SURFACE_PROPS
SkSurfaceProps();
#endif
private:
uint32_t fFlags;
SkPixelGeometry fPixelGeometry;
};

View File

@ -213,11 +213,7 @@ static bool valid_for_bitmap_device(const SkImageInfo& info,
}
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(const SkBitmap& bitmap)
}
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,

View File

@ -515,14 +515,9 @@ void SkCanvas::init(sk_sp<SkBaseDevice> device) {
SkCanvas::SkCanvas()
: fMCStack(sizeof(MCRec), fMCRecStorage, sizeof(fMCRecStorage))
#ifdef SK_LEGACY_SURFACE_PROPS
, fProps(SkSurfaceProps::kLegacyFontHost_InitType)
#else
, fProps()
#endif
{
inc_canvas();
this->init(nullptr);
}
@ -537,11 +532,7 @@ SkCanvas::SkCanvas(int width, int height, const SkSurfaceProps* props)
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();
@ -571,11 +562,7 @@ SkCanvas::SkCanvas(const SkBitmap& bitmap, const SkSurfaceProps& props)
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();

View File

@ -1,29 +0,0 @@
/*
* Copyright 2009 The Android Open Source Project
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "include/core/SkFontLCDConfig.h"
#ifdef SK_LEGACY_SURFACE_PROPS
static SkFontLCDConfig::LCDOrientation gLCDOrientation = SkFontLCDConfig::kHorizontal_LCDOrientation;
static SkFontLCDConfig::LCDOrder gLCDOrder = SkFontLCDConfig::kRGB_LCDOrder;
SkFontLCDConfig::LCDOrientation SkFontLCDConfig::GetSubpixelOrientation() {
return gLCDOrientation;
}
void SkFontLCDConfig::SetSubpixelOrientation(LCDOrientation orientation) {
gLCDOrientation = orientation;
}
SkFontLCDConfig::LCDOrder SkFontLCDConfig::GetSubpixelOrder() {
return gLCDOrder;
}
void SkFontLCDConfig::SetSubpixelOrder(LCDOrder order) {
gLCDOrder = order;
}
#endif

View File

@ -316,11 +316,7 @@ public:
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);
}

View File

@ -102,11 +102,7 @@ SkStrikeSpec SkStrikeSpec::MakeCanonicalized(const SkFont& font, const SkPaint*
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 @@ SkStrikeSpec SkStrikeSpec::MakeWithNoDevice(const SkFont& font, const SkPaint* p
storage.commonSetup(font,
setupPaint,
#ifdef SK_LEGACY_SURFACE_PROPS
SkSurfaceProps(SkSurfaceProps::kLegacyFontHost_InitType),
#else
SkSurfaceProps(),
#endif
kFakeGammaAndBoostContrast,
SkMatrix::I());

View File

@ -13,15 +13,7 @@
struct SkImageInfo;
static inline SkSurfaceProps SkSurfacePropsCopyOrDefault(const SkSurfaceProps* props) {
if (props) {
return *props;
} else {
#ifdef SK_LEGACY_SURFACE_PROPS
return SkSurfaceProps(SkSurfaceProps::kLegacyFontHost_InitType);
#else
return SkSurfaceProps();
#endif
}
return props ? *props : SkSurfaceProps();
}
constexpr size_t kIgnoreRowBytesValue = static_cast<size_t>(~0);

View File

@ -8,7 +8,6 @@
#include <atomic>
#include <cmath>
#include "include/core/SkCanvas.h"
#include "include/core/SkFontLCDConfig.h"
#include "include/gpu/GrBackendSurface.h"
#include "src/core/SkAutoPixmapStorage.h"
#include "src/core/SkImagePriv.h"
@ -17,39 +16,6 @@
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) {
return kUnknown_SkPixelGeometry;
} else {
// Bit0 is RGB(0), BGR(1)
// Bit1 is H(0), V(1)
const SkPixelGeometry gGeo[] = {
kRGB_H_SkPixelGeometry,
kBGR_H_SkPixelGeometry,
kRGB_V_SkPixelGeometry,
kBGR_V_SkPixelGeometry,
};
int index = 0;
if (SkFontLCDConfig::kBGR_LCDOrder == order) {
index |= 1;
}
if (SkFontLCDConfig::kVertical_LCDOrientation == SkFontLCDConfig::GetSubpixelOrientation()){
index |= 2;
}
return gGeo[index];
}
}
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)
{}