More callers using SkDrawBase

- and fix bug in A8 blitter for masks

Bug: skia:14192
Change-Id: Iba3de5c83e4c6d6cbf7dde7f146b02f95eb94881
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/657676
Reviewed-by: Florin Malita <fmalita@google.com>
Commit-Queue: Florin Malita <fmalita@google.com>
diff --git a/src/core/SkAutoBlitterChoose.h b/src/core/SkAutoBlitterChoose.h
index 8f6319d..34f4272 100644
--- a/src/core/SkAutoBlitterChoose.h
+++ b/src/core/SkAutoBlitterChoose.h
@@ -11,7 +11,7 @@
 #include "include/private/base/SkMacros.h"
 #include "src/base/SkArenaAlloc.h"
 #include "src/core/SkBlitter.h"
-#include "src/core/SkDraw.h"
+#include "src/core/SkDrawBase.h"
 #include "src/core/SkMatrixProvider.h"
 #include "src/core/SkRasterClip.h"
 #include "src/core/SkSurfacePriv.h"
@@ -23,7 +23,7 @@
 class SkAutoBlitterChoose : SkNoncopyable {
 public:
     SkAutoBlitterChoose() {}
-    SkAutoBlitterChoose(const SkDraw& draw, const SkMatrixProvider* matrixProvider,
+    SkAutoBlitterChoose(const SkDrawBase& draw, const SkMatrixProvider* matrixProvider,
                         const SkPaint& paint, bool drawCoverage = false) {
         this->choose(draw, matrixProvider, paint, drawCoverage);
     }
@@ -31,7 +31,7 @@
     SkBlitter*  operator->() { return fBlitter; }
     SkBlitter*  get() const { return fBlitter; }
 
-    SkBlitter* choose(const SkDraw& draw, const SkMatrixProvider* matrixProvider,
+    SkBlitter* choose(const SkDrawBase& draw, const SkMatrixProvider* matrixProvider,
                       const SkPaint& paint, bool drawCoverage = false) {
         SkASSERT(!fBlitter);
         if (!matrixProvider) {
diff --git a/src/core/SkBlitter_A8.cpp b/src/core/SkBlitter_A8.cpp
index d251324..ea01296 100644
--- a/src/core/SkBlitter_A8.cpp
+++ b/src/core/SkBlitter_A8.cpp
@@ -14,7 +14,6 @@
     : fDevice(device)
 {
     SkASSERT(nullptr == paint.getShader());
-    SkASSERT(paint.isSrcOver());
     SkASSERT(nullptr == paint.getColorFilter());
 }
 
@@ -184,7 +183,6 @@
                            const SkPaint& paint) : fDevice(device) {
     SkASSERT(nullptr == paint.getShader());
     SkASSERT(nullptr == paint.getColorFilter());
-    SkASSERT(nullptr == paint.getBlender());
     auto mode = paint.asBlendMode();
     SkASSERT(mode);
     auto pair = find_a8_rowproc_pair(*mode);
@@ -232,7 +230,7 @@
 
     if (aa == 0xFF) {
         while (--height >= 0) {
-            *device = fOneProc(*device, fSrc);
+            *device = fOneProc(fSrc, *device);
             device += dstRB;
         }
     } else if (aa != 0) {
@@ -271,7 +269,7 @@
 
     while (--height >= 0) {
         for (int i = 0; i < width; ++i) {
-            dst[i] = fOneProc(div255(src[i] * fSrc), dst[i]);
+            dst[i] = u8_lerp(dst[i], fOneProc(fSrc, dst[i]), src[i]);
         }
         dst += dstRB;
         src += srcRB;
diff --git a/src/core/SkDraw.cpp b/src/core/SkDraw.cpp
index 76ad778..5928174 100644
--- a/src/core/SkDraw.cpp
+++ b/src/core/SkDraw.cpp
@@ -60,10 +60,6 @@
     fBlitterChooser = SkBlitter::Choose;
 }
 
-SkDraw::SkDraw(const SkDrawBase& b) : SkDrawBase(b) {
-    fBlitterChooser = SkBlitter::Choose;
-}
-
 struct PtProcRec {
     SkCanvas::PointMode fMode;
     const SkPaint*  fPaint;
diff --git a/src/core/SkDraw.h b/src/core/SkDraw.h
index 5e1d17c..aa7502f 100644
--- a/src/core/SkDraw.h
+++ b/src/core/SkDraw.h
@@ -39,7 +39,6 @@
 class SkDraw : public SkDrawBase {
 public:
     SkDraw();
-    SkDraw(const SkDrawBase&);
 
     /* If dstOrNull is null, computes a dst by mapping the bitmap's bounds through the matrix. */
     void    drawBitmap(const SkBitmap&, const SkMatrix&, const SkRect* dstOrNull,
diff --git a/src/core/SkDrawBase.cpp b/src/core/SkDrawBase.cpp
index bd1f875..7d5a51d 100644
--- a/src/core/SkDrawBase.cpp
+++ b/src/core/SkDrawBase.cpp
@@ -25,7 +25,7 @@
 #include "src/base/SkZip.h"
 #include "src/core/SkAutoBlitterChoose.h"
 #include "src/core/SkBlendModePriv.h"
-#include "src/core/SkDraw.h"
+#include "src/core/SkBlitter_A8.h"
 #include "src/core/SkDrawProcs.h"
 #include "src/core/SkMask.h"
 #include "src/core/SkMaskFilterBase.h"
@@ -142,9 +142,9 @@
     return reinterpret_cast<SkPoint*>(&r);
 }
 
-static void draw_rect_as_path(const SkDraw& orig, const SkRect& prePaintRect,
+static void draw_rect_as_path(const SkDrawBase& orig, const SkRect& prePaintRect,
                               const SkPaint& paint, const SkMatrixProvider* matrixProvider) {
-    SkDraw draw(orig);
+    SkDrawBase draw(orig);
     draw.fMatrixProvider = matrixProvider;
     SkPath  tmp;
     tmp.addRect(prePaintRect);
@@ -531,7 +531,8 @@
 
 static void draw_into_mask(const SkMask& mask, const SkPath& devPath,
                            SkStrokeRec::InitStyle style) {
-    SkDraw draw;
+    SkDrawBase draw;
+    draw.fBlitterChooser = SkA8Blitter_Choose;
     if (!draw.fDst.reset(mask)) {
         return;
     }