Move DeviceFlags and CheckAlphaTypeAndGetFlags to skgpu::BaseDevice

skgpu::v2::Device will also need both of these so move them somewhere accessible

Bug: skia:11837
Change-Id: Iacaf0332da933515451056eeda62949b049378b7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/446180
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/BaseDevice.h b/src/gpu/BaseDevice.h
index fe88870..0a7cbf4 100644
--- a/src/gpu/BaseDevice.h
+++ b/src/gpu/BaseDevice.h
@@ -24,9 +24,9 @@
 
 class BaseDevice : public SkBaseDevice {
 public:
-    enum InitContents {
-        kClear_InitContents,
-        kUninit_InitContents
+    enum class InitContents {
+        kClear,
+        kUninit
     };
 
     BaseDevice(sk_sp<GrRecordingContext>, const SkImageInfo&, const SkSurfaceProps&);
@@ -78,12 +78,24 @@
                                                  ReadPixelsContext context) = 0;
 
 protected:
+    enum class DeviceFlags {
+        kNone      = 0,
+        kNeedClear = 1 << 0,  //!< Surface requires an initial clear
+        kIsOpaque  = 1 << 1,  //!< Hint from client that rendering to this device will be
+                              //   opaque even if the config supports alpha.
+    };
+    GR_DECL_BITFIELD_CLASS_OPS_FRIENDS(DeviceFlags);
+
+    static bool CheckAlphaTypeAndGetFlags(SkAlphaType, InitContents, DeviceFlags*);
+
     sk_sp<GrRecordingContext> fContext;
 
 private:
     using INHERITED = SkBaseDevice;
 };
 
+GR_MAKE_BITFIELD_CLASS_OPS(BaseDevice::DeviceFlags)
+
 } // namespace skgpu
 
 #endif // BaseDevice_DEFINED