Remove the return value of setDeviceCoordinateSystem
In https://skia-review.googlesource.com/c/skia/+/527505 we removed the 'invert' call from 'SetDeviceCoordinateSystem', removing the only place where the function might return 'false'. This patch changes the return value from bool to void, as it is obsolete. Change-Id: I0262f82d2cf339879ea716bdb5f16ca26d453cb9 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/536097 Reviewed-by: Michael Ludwig <michaelludwig@google.com> Commit-Queue: Michael Ludwig <michaelludwig@google.com>
This commit is contained in:
parent
eae1848ec7
commit
5ab804aff4
@ -1114,21 +1114,12 @@ void SkCanvas::internalSaveLayer(const SaveLayerRec& rec, SaveLayerStrategy stra
|
||||
// The setDeviceCoordinateSystem applies the prior device's global transform since
|
||||
// 'newLayerMapping' only defines the transforms between the two devices and it must be updated
|
||||
// to the global coordinate system.
|
||||
if (!newDevice->setDeviceCoordinateSystem(
|
||||
priorDevice->deviceToGlobal() * SkM44(newLayerMapping.layerToDevice()),
|
||||
SkM44(newLayerMapping.deviceToLayer()) * priorDevice->globalToDevice(),
|
||||
SkM44(newLayerMapping.layerMatrix()),
|
||||
layerBounds.left(),
|
||||
layerBounds.top())) {
|
||||
// If we made it this far and the coordinate system is invalid, we most likely had a valid
|
||||
// mapping until being combined with the previous device-to-global matrix, at which point
|
||||
// it overflowed or floating point rounding caused it to no longer be invertible. There's
|
||||
// not much we can do but clean up the layer and mark the clip as empty. This tends to come
|
||||
// up in fuzzer-generated inputs, so this policy is not unreasonable and helps avoids UB.
|
||||
newDevice = nullptr;
|
||||
abortLayer();
|
||||
return;
|
||||
}
|
||||
newDevice->setDeviceCoordinateSystem(
|
||||
priorDevice->deviceToGlobal() * SkM44(newLayerMapping.layerToDevice()),
|
||||
SkM44(newLayerMapping.deviceToLayer()) * priorDevice->globalToDevice(),
|
||||
SkM44(newLayerMapping.layerMatrix()),
|
||||
layerBounds.left(),
|
||||
layerBounds.top());
|
||||
|
||||
if (initBackdrop) {
|
||||
SkPaint backdropPaint;
|
||||
|
@ -45,7 +45,7 @@ SkBaseDevice::SkBaseDevice(const SkImageInfo& info, const SkSurfaceProps& surfac
|
||||
fGlobalToDevice.setIdentity();
|
||||
}
|
||||
|
||||
bool SkBaseDevice::setDeviceCoordinateSystem(const SkM44& deviceToGlobal,
|
||||
void SkBaseDevice::setDeviceCoordinateSystem(const SkM44& deviceToGlobal,
|
||||
const SkM44& globalToDevice,
|
||||
const SkM44& localToDevice,
|
||||
int bufferOriginX,
|
||||
@ -64,7 +64,6 @@ bool SkBaseDevice::setDeviceCoordinateSystem(const SkM44& deviceToGlobal,
|
||||
}
|
||||
fLocalToDevice33 = fLocalToDevice.asM33();
|
||||
fLocalToDeviceDirty = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
void SkBaseDevice::setGlobalCTM(const SkM44& ctm) {
|
||||
|
@ -464,18 +464,15 @@ private:
|
||||
// is anchored in the device space. The final device-to-global matrix stored by the SkDevice
|
||||
// will include a pre-translation by T(deviceOriginX, deviceOriginY), and the final
|
||||
// local-to-device matrix will have a post-translation of T(-deviceOriginX, -deviceOriginY).
|
||||
//
|
||||
// Returns false if the final device coordinate space is invalid, in which case the canvas
|
||||
// should discard the device
|
||||
bool SK_WARN_UNUSED_RESULT setDeviceCoordinateSystem(const SkM44& deviceToGlobal,
|
||||
const SkM44& globalToDevice,
|
||||
const SkM44& localToDevice,
|
||||
int bufferOriginX,
|
||||
int bufferOriginY);
|
||||
void setDeviceCoordinateSystem(const SkM44& deviceToGlobal,
|
||||
const SkM44& globalToDevice,
|
||||
const SkM44& localToDevice,
|
||||
int bufferOriginX,
|
||||
int bufferOriginY);
|
||||
// Convenience to configure the device to be axis-aligned with the root canvas, but with a
|
||||
// unique origin.
|
||||
void setOrigin(const SkM44& globalCTM, int x, int y) {
|
||||
SkAssertResult(this->setDeviceCoordinateSystem(SkM44(), SkM44(), globalCTM, x, y));
|
||||
this->setDeviceCoordinateSystem(SkM44(), SkM44(), globalCTM, x, y);
|
||||
}
|
||||
|
||||
virtual SkImageFilterCache* getImageFilterCache() { return nullptr; }
|
||||
|
Loading…
Reference in New Issue
Block a user