1 /*
2  * Copyright 2014 Google Inc.
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 SkSurface_Gpu_DEFINED
9 #define SkSurface_Gpu_DEFINED
10 
11 #include "SkSurface_Base.h"
12 
13 #if SK_SUPPORT_GPU
14 
15 class SkGpuDevice;
16 
17 class SkSurface_Gpu : public SkSurface_Base {
18 public:
19     SK_DECLARE_INST_COUNT(SkSurface_Gpu)
20 
21     SkSurface_Gpu(SkGpuDevice*);
22     virtual ~SkSurface_Gpu();
23 
24     SkCanvas* onNewCanvas() override;
25     SkSurface* onNewSurface(const SkImageInfo&) override;
26     SkImage* onNewImageSnapshot(Budgeted) override;
27     void onDraw(SkCanvas*, SkScalar x, SkScalar y, const SkPaint*) override;
28     void onCopyOnWrite(ContentChangeMode) override;
29     void onDiscard() override;
30 
getDevice()31     SkGpuDevice* getDevice() { return fDevice; }
32 
33 private:
34     SkGpuDevice* fDevice;
35 
36     typedef SkSurface_Base INHERITED;
37 };
38 
39 #endif // SK_SUPPORT_GPU
40 
41 #endif // SkSurface_Gpu_DEFINED
42