Make sure we use device bounds for DrawableOp.

The bounds stored on the SkDrawable are in local space, but the bounds
we want on the Op need to be in device space. Not doing this transform
caused a bug where other ops were incorrectly being reodered around the
drawable on the gpu.

This also fixes an issue where vulkan would draw to the base device
instead of the top device.

Bug: b/198924563
Change-Id: I7c3d8ac9efdeb2b18d9be9e1f812f0132aa05893
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/447591
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
(cherry picked from commit 0c2cca569869feb42d4e20e52e421bf6d4c387a0)
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/448317
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index 833df74..bcfb5f9 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -2364,7 +2364,7 @@
     // drawable bounds are no longer reliable (e.g. android displaylist)
     // so don't use them for quick-reject
     this->predrawNotify();
-    this->baseDevice()->drawDrawable(dr, matrix, this);
+    this->topDevice()->drawDrawable(dr, matrix, this);
 }
 
 void SkCanvas::onDrawAtlas2(const SkImage* atlas, const SkRSXform xform[], const SkRect tex[],
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index fc6a862..14496da 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -950,13 +950,13 @@
 
     GrBackendApi api = this->recordingContext()->backend();
     if (GrBackendApi::kVulkan == api) {
-        const SkMatrix& ctm = canvas->getLocalToDeviceAs3x3();
+        const SkMatrix& ctm = this->localToDevice();
         const SkMatrix& combinedMatrix = matrix ? SkMatrix::Concat(ctm, *matrix) : ctm;
-        std::unique_ptr<SkDrawable::GpuDrawHandler> gpuDraw =
-                drawable->snapGpuDrawHandler(api, combinedMatrix, canvas->getDeviceClipBounds(),
-                                             this->imageInfo());
+        std::unique_ptr<SkDrawable::GpuDrawHandler> gpuDraw = drawable->snapGpuDrawHandler(
+                api, combinedMatrix, this->devClipBounds(), this->imageInfo());
         if (gpuDraw) {
-            fSurfaceDrawContext->drawDrawable(std::move(gpuDraw), drawable->getBounds());
+            fSurfaceDrawContext->drawDrawable(std::move(gpuDraw),
+                                              combinedMatrix.mapRect(drawable->getBounds()));
             return;
         }
     }