Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 /* | |
| 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 GrSurfaceProxy_DEFINED | |
| 9 #define GrSurfaceProxy_DEFINED | |
| 10 | |
| 11 #include "GrGpuResource.h" | |
| 12 | |
| 13 class GrTextureProxy; | |
| 14 class GrRenderTargetProxy; | |
| 15 | |
| 16 class GrSurfaceProxy : public GrIORef<GrSurfaceProxy> { | |
| 17 public: | |
| 18 enum BackingFit { | |
|
bsalomon
2016/05/02 17:45:40
Wondering if it would make sense to elevate the Lo
robertphillips
2016/05/02 19:22:54
Done.
| |
| 19 kExact_BackingFit, | |
| 20 kApprox_BackingFit | |
| 21 }; | |
| 22 | |
| 23 const GrSurfaceDesc& desc() const { return fDesc; } | |
| 24 | |
| 25 GrSurfaceOrigin origin() const { | |
| 26 SkASSERT(kTopLeft_GrSurfaceOrigin == fDesc.fOrigin || | |
| 27 kBottomLeft_GrSurfaceOrigin == fDesc.fOrigin); | |
| 28 return fDesc.fOrigin; | |
| 29 } | |
| 30 int width() const { return fDesc.fWidth; } | |
| 31 int height() const { return fDesc.fWidth; } | |
| 32 GrPixelConfig config() const { return fDesc.fConfig; } | |
| 33 | |
| 34 uint32_t uniqueID() const { return fUniqueID; } | |
| 35 | |
| 36 /** | |
| 37 * @return the texture proxy associated with the surface proxy, may be NULL. | |
| 38 */ | |
| 39 virtual GrTextureProxy* asTextureProxy() { return nullptr; } | |
| 40 virtual const GrTextureProxy* asTextureProxy() const { return nullptr; } | |
| 41 | |
| 42 /** | |
| 43 * @return the render target proxy associated with the surface proxy, may be NULL. | |
| 44 */ | |
| 45 virtual GrRenderTargetProxy* asRenderTargetProxy() { return nullptr; } | |
| 46 virtual const GrRenderTargetProxy* asRenderTargetProxy() const { return null ptr; } | |
| 47 | |
| 48 protected: | |
| 49 GrSurfaceProxy(const GrSurfaceDesc& desc, BackingFit fit, SkBudgeted budgete d) | |
| 50 : fDesc(desc) | |
| 51 , fFit(fit) | |
| 52 , fBudgeted(budgeted) | |
| 53 , fUniqueID(CreateUniqueID()) { | |
| 54 } | |
| 55 | |
| 56 virtual ~GrSurfaceProxy() {} | |
| 57 | |
| 58 // For wrapped resources, 'fDesc' will always be filled in from the wrapped resource. | |
| 59 const GrSurfaceDesc fDesc; | |
| 60 const BackingFit fFit; // always exact for wrapped resources | |
| 61 const SkBudgeted fBudgeted; // set from the backing resource for wrapped resources | |
| 62 const uint32_t fUniqueID; | |
| 63 | |
| 64 private: | |
| 65 static uint32_t CreateUniqueID(); | |
| 66 | |
| 67 // See comment in GrGpuResource.h. | |
| 68 void notifyAllCntsAreZero(CntType) const {} | |
| 69 bool notifyRefCountIsZero() const { return false; } | |
| 70 | |
| 71 typedef GrIORef<GrSurfaceProxy> INHERITED; | |
| 72 | |
| 73 // to access notifyAllCntsAreZero and notifyRefCntIsZero. | |
| 74 friend class GrIORef<GrSurfaceProxy>; | |
| 75 }; | |
| 76 | |
| 77 #endif | |
| OLD | NEW |