Pass in clip bounds when creating a GpuDrawHandler for SkDrawable.
Bug: skia: Change-Id: I2f79622aa9796e239e0487987e1fb2833055a99e Reviewed-on: https://skia-review.googlesource.com/c/177891 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Greg Daniel <egdaniel@google.com>
This commit is contained in:
parent
f54883cd90
commit
b2a259cb3b
@ -74,12 +74,13 @@ public:
|
||||
/**
|
||||
* Snaps off a GpuDrawHandler to represent the state of the SkDrawable at the time the snap is
|
||||
* called. This is used for executing GPU backend specific draws intermixed with normal Skia GPU
|
||||
* draws. The GPU API, which will be used for the draw, as well as the full matrix are passed in
|
||||
* as inputs.
|
||||
* draws. The GPU API, which will be used for the draw, as well as the full matrix and device
|
||||
* clip bounds are passed in as inputs.
|
||||
*/
|
||||
std::unique_ptr<GpuDrawHandler> snapGpuDrawHandler(GrBackendApi backendApi,
|
||||
const SkMatrix& matrix) {
|
||||
return this->onSnapGpuDrawHandler(backendApi, matrix);
|
||||
const SkMatrix& matrix,
|
||||
const SkIRect& clipBounds) {
|
||||
return this->onSnapGpuDrawHandler(backendApi, matrix, clipBounds);
|
||||
}
|
||||
|
||||
SkPicture* newPictureSnapshot();
|
||||
@ -131,6 +132,12 @@ protected:
|
||||
virtual SkRect onGetBounds() = 0;
|
||||
virtual void onDraw(SkCanvas*) = 0;
|
||||
|
||||
virtual std::unique_ptr<GpuDrawHandler> onSnapGpuDrawHandler(GrBackendApi, const SkMatrix&,
|
||||
const SkIRect& /*clipBounds*/) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// TODO: Delete this once Android gets updated to take the clipBounds version above.
|
||||
virtual std::unique_ptr<GpuDrawHandler> onSnapGpuDrawHandler(GrBackendApi, const SkMatrix&) {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -1709,7 +1709,7 @@ void SkGpuDevice::drawDrawable(SkDrawable* drawable, const SkMatrix* matrix, SkC
|
||||
const SkMatrix& ctm = canvas->getTotalMatrix();
|
||||
const SkMatrix& combinedMatrix = matrix ? SkMatrix::Concat(ctm, *matrix) : ctm;
|
||||
std::unique_ptr<SkDrawable::GpuDrawHandler> gpuDraw =
|
||||
drawable->snapGpuDrawHandler(api, combinedMatrix);
|
||||
drawable->snapGpuDrawHandler(api, combinedMatrix, canvas->getDeviceClipBounds());
|
||||
if (gpuDraw) {
|
||||
fRenderTargetContext->drawDrawable(std::move(gpuDraw), drawable->getBounds());
|
||||
return;
|
||||
|
@ -87,7 +87,8 @@ public:
|
||||
};
|
||||
|
||||
std::unique_ptr<GpuDrawHandler> onSnapGpuDrawHandler(GrBackendApi backendApi,
|
||||
const SkMatrix& matrix) override {
|
||||
const SkMatrix& matrix,
|
||||
const SkIRect& clipBounds) override {
|
||||
if (backendApi != GrBackendApi::kVulkan) {
|
||||
return nullptr;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user