Hoist pixel geometry adjustments out of SkBaseDevice::CreateInfo()
We only call CreateInfo() from internalSaveLayer(), and always pass kNever_TileUsage. Move the related pixel geo override to internalSaveLayer, and remove CreateInfo::AdjustPixelGeometry(). (also swap the args order to "prove" we're covering all callers) NOTREECHECKS=true Change-Id: Ie11c3f501d262f070cf97797cb549d3afa87d679 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/286876 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Florin Malita <fmalita@chromium.org>
This commit is contained in:
parent
ef41d500cc
commit
e55e56038c
@ -1167,12 +1167,17 @@ void SkCanvas::internalSaveLayer(const SaveLayerRec& rec, SaveLayerStrategy stra
|
||||
sk_sp<SkBaseDevice> newDevice;
|
||||
{
|
||||
SkASSERT(info.alphaType() != kOpaque_SkAlphaType);
|
||||
const SkBaseDevice::TileUsage usage = SkBaseDevice::kNever_TileUsage;
|
||||
|
||||
// TODO: reinstate kPreserveLCDText_SaveLayerFlag
|
||||
geo = kUnknown_SkPixelGeometry;
|
||||
|
||||
const bool trackCoverage =
|
||||
SkToBool(saveLayerFlags & kMaskAgainstCoverage_EXPERIMENTAL_DONT_USE_SaveLayerFlag);
|
||||
const SkBaseDevice::CreateInfo createInfo = SkBaseDevice::CreateInfo(info, usage, geo,
|
||||
trackCoverage,
|
||||
fAllocator.get());
|
||||
const auto createInfo = SkBaseDevice::CreateInfo(info,
|
||||
geo,
|
||||
SkBaseDevice::kNever_TileUsage,
|
||||
trackCoverage,
|
||||
fAllocator.get());
|
||||
newDevice.reset(priorDevice->onCreateDevice(createInfo, paint));
|
||||
if (!newDevice) {
|
||||
return;
|
||||
|
@ -106,20 +106,6 @@ bool SkBaseDevice::getLocalToMarker(uint32_t id, SkM44* localToMarker) const {
|
||||
return false;
|
||||
}
|
||||
|
||||
SkPixelGeometry SkBaseDevice::CreateInfo::AdjustGeometry(TileUsage tileUsage, SkPixelGeometry geo) {
|
||||
switch (tileUsage) {
|
||||
case kPossible_TileUsage:
|
||||
// (we think) for compatibility with old clients, we assume this layer can support LCD
|
||||
// even though they may not have marked it as opaque... seems like we should update
|
||||
// our callers (reed/robertphilips).
|
||||
break;
|
||||
case kNever_TileUsage:
|
||||
geo = kUnknown_SkPixelGeometry;
|
||||
break;
|
||||
}
|
||||
return geo;
|
||||
}
|
||||
|
||||
static inline bool is_int(float x) {
|
||||
return x == (float) sk_float_round2int(x);
|
||||
}
|
||||
|
@ -339,17 +339,14 @@ protected:
|
||||
virtual bool onAccessPixels(SkPixmap*) { return false; }
|
||||
|
||||
struct CreateInfo {
|
||||
static SkPixelGeometry AdjustGeometry(TileUsage, SkPixelGeometry);
|
||||
|
||||
// The constructor may change the pixel geometry based on other parameters.
|
||||
CreateInfo(const SkImageInfo& info,
|
||||
TileUsage tileUsage,
|
||||
SkPixelGeometry geo,
|
||||
TileUsage tileUsage,
|
||||
bool trackCoverage,
|
||||
SkRasterHandleAllocator* allocator)
|
||||
: fInfo(info)
|
||||
, fTileUsage(tileUsage)
|
||||
, fPixelGeometry(AdjustGeometry(tileUsage, geo))
|
||||
, fPixelGeometry(geo)
|
||||
, fTrackCoverage(trackCoverage)
|
||||
, fAllocator(allocator)
|
||||
{}
|
||||
|
Loading…
Reference in New Issue
Block a user