| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #ifndef GrSurfaceProxy_DEFINED | 8 #ifndef GrSurfaceProxy_DEFINED |
| 9 #define GrSurfaceProxy_DEFINED | 9 #define GrSurfaceProxy_DEFINED |
| 10 | 10 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 virtual GrTextureProxy* asTextureProxy() { return nullptr; } | 34 virtual GrTextureProxy* asTextureProxy() { return nullptr; } |
| 35 virtual const GrTextureProxy* asTextureProxy() const { return nullptr; } | 35 virtual const GrTextureProxy* asTextureProxy() const { return nullptr; } |
| 36 | 36 |
| 37 /** | 37 /** |
| 38 * @return the render target proxy associated with the surface proxy, may be
NULL. | 38 * @return the render target proxy associated with the surface proxy, may be
NULL. |
| 39 */ | 39 */ |
| 40 virtual GrRenderTargetProxy* asRenderTargetProxy() { return nullptr; } | 40 virtual GrRenderTargetProxy* asRenderTargetProxy() { return nullptr; } |
| 41 virtual const GrRenderTargetProxy* asRenderTargetProxy() const { return null
ptr; } | 41 virtual const GrRenderTargetProxy* asRenderTargetProxy() const { return null
ptr; } |
| 42 | 42 |
| 43 protected: | 43 protected: |
| 44 // Deferred version |
| 44 GrSurfaceProxy(const GrSurfaceDesc& desc, SkBackingFit fit, SkBudgeted budge
ted) | 45 GrSurfaceProxy(const GrSurfaceDesc& desc, SkBackingFit fit, SkBudgeted budge
ted) |
| 45 : fDesc(desc) | 46 : fDesc(desc) |
| 46 , fFit(fit) | 47 , fFit(fit) |
| 47 , fBudgeted(budgeted) | 48 , fBudgeted(budgeted) |
| 48 , fUniqueID(CreateUniqueID()) { | 49 , fUniqueID(GrGpuResource::CreateUniqueID()) { |
| 50 } |
| 51 |
| 52 // Wrapped version |
| 53 GrSurfaceProxy(const GrSurfaceDesc& desc, SkBackingFit fit, |
| 54 SkBudgeted budgeted, uint32_t uniqueID) |
| 55 : fDesc(desc) |
| 56 , fFit(fit) |
| 57 , fBudgeted(budgeted) |
| 58 , fUniqueID(uniqueID) { |
| 49 } | 59 } |
| 50 | 60 |
| 51 virtual ~GrSurfaceProxy() {} | 61 virtual ~GrSurfaceProxy() {} |
| 52 | 62 |
| 53 // For wrapped resources, 'fDesc' will always be filled in from the wrapped
resource. | 63 // For wrapped resources, 'fDesc' will always be filled in from the wrapped
resource. |
| 54 const GrSurfaceDesc fDesc; | 64 const GrSurfaceDesc fDesc; |
| 55 const SkBackingFit fFit; // always exact for wrapped resources | 65 const SkBackingFit fFit; // always exact for wrapped resources |
| 56 const SkBudgeted fBudgeted; // set from the backing resource for wrapped
resources | 66 const SkBudgeted fBudgeted; // set from the backing resource for wrapped
resources |
| 57 const uint32_t fUniqueID; | 67 const uint32_t fUniqueID; // set from the backing resource for wrapped
resources |
| 58 | 68 |
| 59 private: | 69 private: |
| 60 static uint32_t CreateUniqueID(); | |
| 61 | 70 |
| 62 // See comment in GrGpuResource.h. | 71 // See comment in GrGpuResource.h. |
| 63 void notifyAllCntsAreZero(CntType) const { delete this; } | 72 void notifyAllCntsAreZero(CntType) const { delete this; } |
| 64 bool notifyRefCountIsZero() const { return true; } | 73 bool notifyRefCountIsZero() const { return true; } |
| 65 | 74 |
| 66 typedef GrIORef<GrSurfaceProxy> INHERITED; | 75 typedef GrIORef<GrSurfaceProxy> INHERITED; |
| 67 | 76 |
| 68 // to access notifyAllCntsAreZero and notifyRefCntIsZero. | 77 // to access notifyAllCntsAreZero and notifyRefCntIsZero. |
| 69 friend class GrIORef<GrSurfaceProxy>; | 78 friend class GrIORef<GrSurfaceProxy>; |
| 70 }; | 79 }; |
| 71 | 80 |
| 72 #endif | 81 #endif |
| OLD | NEW |