Greg Daniel | a83de58 | 2019-10-22 09:33:25 -0400 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2019 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 GrSurfaceProxyView_DEFINED |
| 9 | #define GrSurfaceProxyView_DEFINED |
| 10 | |
| 11 | #include "include/core/SkRefCnt.h" |
| 12 | #include "include/gpu/GrTypes.h" |
| 13 | #include "src/gpu/GrSurfaceProxy.h" |
| 14 | #include "src/gpu/GrSwizzle.h" |
| 15 | |
| 16 | class GrSurfaceProxyView { |
| 17 | public: |
| 18 | GrSurfaceProxyView(sk_sp<GrSurfaceProxy> proxy, GrSurfaceOrigin origin, GrSwizzle swizzle) |
| 19 | : fProxy(proxy), fOrigin(origin), fSwizzle(swizzle) {} |
| 20 | |
| 21 | GrSurfaceProxyView(GrSurfaceProxyView&& view) |
| 22 | : fProxy(std::move(view.fProxy)), fOrigin(view.fOrigin), fSwizzle(view.fSwizzle) {} |
| 23 | |
| 24 | GrSurfaceProxy* asSurfaceProxy() const { return fProxy.get(); } |
| 25 | GrTextureProxy* asTextureProxy() const { return fProxy->asTextureProxy(); } |
| 26 | GrRenderTargetProxy* asRenderTargetProxy() const { return fProxy->asRenderTargetProxy(); } |
| 27 | |
| 28 | GrSurfaceOrigin origin() const { return fOrigin; } |
| 29 | const GrSwizzle& swizzle() const { return fSwizzle; } |
| 30 | |
| 31 | private: |
| 32 | sk_sp<GrSurfaceProxy> fProxy; |
| 33 | GrSurfaceOrigin fOrigin; |
| 34 | GrSwizzle fSwizzle; |
| 35 | }; |
| 36 | |
| 37 | #endif |
| 38 | |