blob: 84836c0f29454fecf58cba76173c2c6d0c664a55 [file] [log] [blame]
Allan MacKinnon4359d522018-06-19 13:57:04 -07001/*
2 * Copyright 2016 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_Compute_DEFINED
9#define SkSurface_Compute_DEFINED
10
11//
12// for now make sure it's defined
13//
14
15#if !defined(SK_SUPPORT_GPU_COMPUTE)
16#define SK_SUPPORT_GPU_COMPUTE 1
17#endif
18
19//
20//
21//
22
23#if SK_SUPPORT_GPU_COMPUTE
24
25//
26//
27//
28
29#include "SkSurface_Base.h"
30#include "GrContext.h"
31#include "SkRefCnt.h"
32
33// Yuqian: It doesn't seem right to me for SkSurface_Compute to depend on SkWindow.
34// Maybe we should move MakeComputeBackedSurface(from SkWindow) to SkWindow.cpp.
35// #include "SkWindow.h"
36
37//
38//
39//
40
41#include "SkContext_Compute.h"
42
43//
44//
45//
46
47//
48//
49//
50
51class SkSurface_Compute : public SkSurface_Base
52{
53 public:
54
55 SkSurface_Compute(sk_sp<SkContext_Compute> compute,
56 int const width, int const height);
57
58 ~SkSurface_Compute();
59
60 //
61 //
62 //
63
64 SkCanvas* onNewCanvas() override;
65 sk_sp<SkSurface> onNewSurface(const SkImageInfo&) override;
66 sk_sp<SkImage> onNewImageSnapshot() override;
67 void onCopyOnWrite(ContentChangeMode) override;
68
69 //
70 //
71 //
72
73 // static sk_sp<SkSurface> MakeComputeBackedSurface(SkWindow * const window,
74 // const SkWindow::AttachmentInfo & attachmentInfo,
75 // GrGLInterface const * const grInterface,
76 // GrContext * const grContext,
77 // sk_sp<SkContext_Compute> compute);
78 // //
79 //
80 //
81
82 private:
83
84 typedef SkSurface_Base INHERITED;
85
86 //
87 //
88 //
89
90 sk_sp<SkBaseDevice> device;
91
92 //
93 //
94 //
95
96 sk_sp<SkContext_Compute> compute;
97
98 //
99 //
100 //
101};
102
103//
104//
105//
106
107#endif
108
109//
110//
111//
112
113#endif