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 11 matching lines...) Expand all Loading... |
22 kBottomLeft_GrSurfaceOrigin == fDesc.fOrigin); | 22 kBottomLeft_GrSurfaceOrigin == fDesc.fOrigin); |
23 return fDesc.fOrigin; | 23 return fDesc.fOrigin; |
24 } | 24 } |
25 int width() const { return fDesc.fWidth; } | 25 int width() const { return fDesc.fWidth; } |
26 int height() const { return fDesc.fWidth; } | 26 int height() const { return fDesc.fWidth; } |
27 GrPixelConfig config() const { return fDesc.fConfig; } | 27 GrPixelConfig config() const { return fDesc.fConfig; } |
28 | 28 |
29 uint32_t uniqueID() const { return fUniqueID; } | 29 uint32_t uniqueID() const { return fUniqueID; } |
30 | 30 |
31 /** | 31 /** |
| 32 * Helper that gets the width and height of the surface as a bounding rectan
gle. |
| 33 */ |
| 34 SkRect getBoundsRect() const { return SkRect::MakeIWH(this->width(), this->h
eight()); } |
| 35 |
| 36 /** |
32 * @return the texture proxy associated with the surface proxy, may be NULL. | 37 * @return the texture proxy associated with the surface proxy, may be NULL. |
33 */ | 38 */ |
34 virtual GrTextureProxy* asTextureProxy() { return nullptr; } | 39 virtual GrTextureProxy* asTextureProxy() { return nullptr; } |
35 virtual const GrTextureProxy* asTextureProxy() const { return nullptr; } | 40 virtual const GrTextureProxy* asTextureProxy() const { return nullptr; } |
36 | 41 |
37 /** | 42 /** |
38 * @return the render target proxy associated with the surface proxy, may be
NULL. | 43 * @return the render target proxy associated with the surface proxy, may be
NULL. |
39 */ | 44 */ |
40 virtual GrRenderTargetProxy* asRenderTargetProxy() { return nullptr; } | 45 virtual GrRenderTargetProxy* asRenderTargetProxy() { return nullptr; } |
41 virtual const GrRenderTargetProxy* asRenderTargetProxy() const { return null
ptr; } | 46 virtual const GrRenderTargetProxy* asRenderTargetProxy() const { return null
ptr; } |
42 | 47 |
| 48 /** |
| 49 * Does the resource count against the resource budget? |
| 50 */ |
| 51 SkBudgeted isBudgeted() const { return fBudgeted; } |
| 52 |
43 protected: | 53 protected: |
44 GrSurfaceProxy(const GrSurfaceDesc& desc, SkBackingFit fit, SkBudgeted budge
ted) | 54 GrSurfaceProxy(const GrSurfaceDesc& desc, SkBackingFit fit, SkBudgeted budge
ted) |
45 : fDesc(desc) | 55 : fDesc(desc) |
46 , fFit(fit) | 56 , fFit(fit) |
47 , fBudgeted(budgeted) | 57 , fBudgeted(budgeted) |
48 , fUniqueID(CreateUniqueID()) { | 58 , fUniqueID(CreateUniqueID()) { |
49 } | 59 } |
50 | 60 |
51 virtual ~GrSurfaceProxy() {} | 61 virtual ~GrSurfaceProxy() {} |
52 | 62 |
(...skipping 10 matching lines...) Expand all Loading... |
63 void notifyAllCntsAreZero(CntType) const { delete this; } | 73 void notifyAllCntsAreZero(CntType) const { delete this; } |
64 bool notifyRefCountIsZero() const { return true; } | 74 bool notifyRefCountIsZero() const { return true; } |
65 | 75 |
66 typedef GrIORef<GrSurfaceProxy> INHERITED; | 76 typedef GrIORef<GrSurfaceProxy> INHERITED; |
67 | 77 |
68 // to access notifyAllCntsAreZero and notifyRefCntIsZero. | 78 // to access notifyAllCntsAreZero and notifyRefCntIsZero. |
69 friend class GrIORef<GrSurfaceProxy>; | 79 friend class GrIORef<GrSurfaceProxy>; |
70 }; | 80 }; |
71 | 81 |
72 #endif | 82 #endif |
OLD | NEW |