blob: 992e3197709eab1aed6221c2885c5afbd5822ff1 [file] [log] [blame]
Robert Phillips84a81202016-11-04 11:59:10 -04001/*
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 GrTextureRenderTargetProxy_DEFINED
9#define GrTextureRenderTargetProxy_DEFINED
10
11#include "GrRenderTargetProxy.h"
12#include "GrTextureProxy.h"
13
14#ifdef SK_BUILD_FOR_WIN
15// Windows gives warnings about inheriting asTextureProxy/asRenderTargetProxy via dominance.
16#pragma warning(push)
17#pragma warning(disable: 4250)
18#endif
19
20// This class delays the acquisition of RenderTargets that are also textures until
21// they are actually required
22// Beware: the uniqueID of the TextureRenderTargetProxy will usually be different than
23// the uniqueID of the RenderTarget/Texture it represents!
24class GrTextureRenderTargetProxy : public GrTextureProxy, public GrRenderTargetProxy {
Robert Phillips84a81202016-11-04 11:59:10 -040025private:
Robert Phillips37430132016-11-09 06:50:43 -050026 friend class GrSurfaceProxy; // for ctors
27
Robert Phillips84a81202016-11-04 11:59:10 -040028 // Deferred version
Robert Phillipsc787e492017-02-28 11:26:32 -050029 GrTextureRenderTargetProxy(const GrCaps&, const GrSurfaceDesc&,
30 SkBackingFit, SkBudgeted, uint32_t flags);
Robert Phillips84a81202016-11-04 11:59:10 -040031
32 // Wrapped version
Robert Phillips37430132016-11-09 06:50:43 -050033 GrTextureRenderTargetProxy(sk_sp<GrSurface>);
Robert Phillips84a81202016-11-04 11:59:10 -040034
Brian Salomonbb5711a2017-05-17 13:49:59 -040035 GrSurface* instantiate(GrResourceProvider*) override;
36
37 size_t onUninstantiatedGpuMemorySize() const override;
Robert Phillips84a81202016-11-04 11:59:10 -040038};
39
40#ifdef SK_BUILD_FOR_WIN
41#pragma warning(pop)
42#endif
43
44#endif