blob: cc8b87dc41d3f427b7c0ab6da53285d2a6b6207b [file] [log] [blame]
robertphillips7b9e8a42014-12-11 08:20:31 -08001/*
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
15class SkGpuDevice;
16
17class SkSurface_Gpu : public SkSurface_Base {
18public:
robertphillips24e91282016-04-29 06:46:36 -070019 SkSurface_Gpu(sk_sp<SkGpuDevice>);
Brian Salomond3b65972017-03-22 12:05:03 -040020 ~SkSurface_Gpu() override;
robertphillips7b9e8a42014-12-11 08:20:31 -080021
joshualitt81793412015-07-08 12:54:04 -070022 GrBackendObject onGetTextureHandle(BackendHandleAccess) override;
23 bool onGetRenderTargetHandle(GrBackendObject*, BackendHandleAccess) override;
mtklein36352bf2015-03-25 18:17:31 -070024 SkCanvas* onNewCanvas() override;
reede8f30622016-03-23 18:59:25 -070025 sk_sp<SkSurface> onNewSurface(const SkImageInfo&) override;
Robert Phillipsac6b1fa2017-03-20 08:38:50 -040026 sk_sp<SkImage> onNewImageSnapshot() override;
mtklein36352bf2015-03-25 18:17:31 -070027 void onCopyOnWrite(ContentChangeMode) override;
28 void onDiscard() override;
ericrkf7b8b8a2016-02-24 14:49:51 -080029 void onPrepareForExternalIO() override;
robertphillips7b9e8a42014-12-11 08:20:31 -080030
robertphillips24e91282016-04-29 06:46:36 -070031 SkGpuDevice* getDevice() { return fDevice.get(); }
robertphillips7b9e8a42014-12-11 08:20:31 -080032
brianosman0e22eb82016-08-30 07:07:59 -070033 static bool Valid(const SkImageInfo&);
34 static bool Valid(GrContext*, GrPixelConfig, SkColorSpace*);
35
robertphillips7b9e8a42014-12-11 08:20:31 -080036private:
robertphillips24e91282016-04-29 06:46:36 -070037 sk_sp<SkGpuDevice> fDevice;
robertphillips7b9e8a42014-12-11 08:20:31 -080038
39 typedef SkSurface_Base INHERITED;
40};
41
42#endif // SK_SUPPORT_GPU
43
44#endif // SkSurface_Gpu_DEFINED