1 /* 2 * Copyright 2021 Google LLC 3 * 4 * Use of this source code is governed by a BSD-style license that can be 5 * found in the LICENSE file. 6 */ 7 8 #ifndef skgpu_Surface_Graphite_DEFINED 9 #define skgpu_Surface_Graphite_DEFINED 10 11 #include "src/image/SkSurface_Base.h" 12 13 namespace skgpu { 14 15 class Context; 16 class Device; 17 class Recorder; 18 19 class Surface final : public SkSurface_Base { 20 public: 21 Surface(sk_sp<Device>); 22 ~Surface() override; 23 24 SkCanvas* onNewCanvas() override; 25 sk_sp<SkSurface> onNewSurface(const SkImageInfo&) override; 26 sk_sp<SkImage> onNewImageSnapshot(const SkIRect* subset) override; 27 void onWritePixels(const SkPixmap&, int x, int y) override; 28 bool onCopyOnWrite(ContentChangeMode) override; 29 bool onReadPixels(Context*, Recorder*, const SkPixmap& dst, int srcX, int srcY); 30 31 private: 32 sk_sp<Device> fDevice; 33 }; 34 35 } // namespace skgpu 36 37 #endif // skgpu_Surface_Graphite_DEFINED 38