Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(295)

Side by Side Diff: include/private/GrSurfaceProxy.h

Issue 2301523003: Have GrSurfaceProxys and GrGpuResources draw from the same pool of unique ids (Closed)
Patch Set: update to ToT Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « include/gpu/GrGpuResource.h ('k') | include/private/GrTextureProxy.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « include/gpu/GrGpuResource.h ('k') | include/private/GrTextureProxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698