| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 | 8 |
| 9 #ifndef GrGLRenderTarget_DEFINED | 9 #ifndef GrGLRenderTarget_DEFINED |
| 10 #define GrGLRenderTarget_DEFINED | 10 #define GrGLRenderTarget_DEFINED |
| 11 | 11 |
| 12 #include "GrGLIRect.h" | 12 #include "GrGLIRect.h" |
| 13 #include "GrRenderTarget.h" | 13 #include "GrRenderTarget.h" |
| 14 #include "SkScalar.h" | 14 #include "SkScalar.h" |
| 15 | 15 |
| 16 class GrGpuGL; | 16 class GrGLGpu; |
| 17 | 17 |
| 18 class GrGLRenderTarget : public GrRenderTarget { | 18 class GrGLRenderTarget : public GrRenderTarget { |
| 19 public: | 19 public: |
| 20 // set fTexFBOID to this value to indicate that it is multisampled but | 20 // set fTexFBOID to this value to indicate that it is multisampled but |
| 21 // Gr doesn't know how to resolve it. | 21 // Gr doesn't know how to resolve it. |
| 22 enum { kUnresolvableFBOID = 0 }; | 22 enum { kUnresolvableFBOID = 0 }; |
| 23 | 23 |
| 24 struct IDDesc { | 24 struct IDDesc { |
| 25 GrGLuint fRTFBOID; | 25 GrGLuint fRTFBOID; |
| 26 GrGLuint fTexFBOID; | 26 GrGLuint fTexFBOID; |
| 27 GrGLuint fMSColorRenderbufferID; | 27 GrGLuint fMSColorRenderbufferID; |
| 28 bool fIsWrapped; | 28 bool fIsWrapped; |
| 29 }; | 29 }; |
| 30 | 30 |
| 31 GrGLRenderTarget(GrGpuGL*, const GrSurfaceDesc&, const IDDesc&); | 31 GrGLRenderTarget(GrGLGpu*, const GrSurfaceDesc&, const IDDesc&); |
| 32 | 32 |
| 33 void setViewport(const GrGLIRect& rect) { fViewport = rect; } | 33 void setViewport(const GrGLIRect& rect) { fViewport = rect; } |
| 34 const GrGLIRect& getViewport() const { return fViewport; } | 34 const GrGLIRect& getViewport() const { return fViewport; } |
| 35 | 35 |
| 36 // The following two functions return the same ID when a | 36 // The following two functions return the same ID when a |
| 37 // texture/render target is multisampled, and different IDs when | 37 // texture/render target is multisampled, and different IDs when |
| 38 // it is. | 38 // it is. |
| 39 // FBO ID used to render into | 39 // FBO ID used to render into |
| 40 GrGLuint renderFBOID() const { return fRTFBOID; } | 40 GrGLuint renderFBOID() const { return fRTFBOID; } |
| 41 // FBO ID that has texture ID attached. | 41 // FBO ID that has texture ID attached. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 54 } else { | 54 } else { |
| 55 return kCanResolve_ResolveType; | 55 return kCanResolve_ResolveType; |
| 56 } | 56 } |
| 57 } | 57 } |
| 58 | 58 |
| 59 protected: | 59 protected: |
| 60 // The public constructor registers this object with the cache. However, onl
y the most derived | 60 // The public constructor registers this object with the cache. However, onl
y the most derived |
| 61 // class should register with the cache. This constructor does not do the re
gistration and | 61 // class should register with the cache. This constructor does not do the re
gistration and |
| 62 // rather moves that burden onto the derived class. | 62 // rather moves that burden onto the derived class. |
| 63 enum Derived { kDerived }; | 63 enum Derived { kDerived }; |
| 64 GrGLRenderTarget(GrGpuGL*, const GrSurfaceDesc&, const IDDesc&, Derived); | 64 GrGLRenderTarget(GrGLGpu*, const GrSurfaceDesc&, const IDDesc&, Derived); |
| 65 | 65 |
| 66 void init(const GrSurfaceDesc&, const IDDesc&); | 66 void init(const GrSurfaceDesc&, const IDDesc&); |
| 67 | 67 |
| 68 virtual void onAbandon() SK_OVERRIDE; | 68 virtual void onAbandon() SK_OVERRIDE; |
| 69 virtual void onRelease() SK_OVERRIDE; | 69 virtual void onRelease() SK_OVERRIDE; |
| 70 | 70 |
| 71 // In protected because subclass GrGLTextureRenderTarget calls this version. | 71 // In protected because subclass GrGLTextureRenderTarget calls this version. |
| 72 virtual size_t onGpuMemorySize() const SK_OVERRIDE; | 72 virtual size_t onGpuMemorySize() const SK_OVERRIDE; |
| 73 | 73 |
| 74 private: | 74 private: |
| (...skipping 12 matching lines...) Expand all Loading... |
| 87 | 87 |
| 88 // onGpuMemorySize() needs to know what how many color values are owned per
pixel. However, | 88 // onGpuMemorySize() needs to know what how many color values are owned per
pixel. However, |
| 89 // abandon and release zero out the IDs and the cache needs to know the size
even after those | 89 // abandon and release zero out the IDs and the cache needs to know the size
even after those |
| 90 // actions. | 90 // actions. |
| 91 uint8_t fColorValuesPerPixel; | 91 uint8_t fColorValuesPerPixel; |
| 92 | 92 |
| 93 typedef GrRenderTarget INHERITED; | 93 typedef GrRenderTarget INHERITED; |
| 94 }; | 94 }; |
| 95 | 95 |
| 96 #endif | 96 #endif |
| OLD | NEW |