| 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 GrGpuGL; |
| 17 class GrGLTexture; | 17 class GrGLTexture; |
| 18 class GrGLTexID; | 18 class GrGLTexID; |
| 19 | 19 |
| 20 class GrGLRenderTarget : public GrRenderTarget { | 20 class GrGLRenderTarget : public GrRenderTarget { |
| 21 | 21 |
| 22 public: | 22 public: |
| 23 // set fTexFBOID to this value to indicate that it is multisampled but | 23 // set fTexFBOID to this value to indicate that it is multisampled but |
| 24 // Gr doesn't know how to resolve it. | 24 // Gr doesn't know how to resolve it. |
| 25 enum { kUnresolvableFBOID = 0 }; | 25 enum { kUnresolvableFBOID = 0 }; |
| 26 | 26 |
| 27 struct Desc { | 27 struct IDDesc { |
| 28 GrGLuint fRTFBOID; | 28 GrGLuint fRTFBOID; |
| 29 GrGLuint fTexFBOID; | 29 GrGLuint fTexFBOID; |
| 30 GrGLuint fMSColorRenderbufferID; | 30 GrGLuint fMSColorRenderbufferID; |
| 31 bool fIsWrapped; | 31 bool fIsWrapped; |
| 32 GrPixelConfig fConfig; | |
| 33 int fSampleCnt; | |
| 34 GrSurfaceOrigin fOrigin; | |
| 35 bool fCheckAllocation; | |
| 36 }; | 32 }; |
| 37 | 33 |
| 38 // creates a GrGLRenderTarget associated with a texture | 34 // creates a GrGLRenderTarget associated with a texture |
| 39 GrGLRenderTarget(GrGpuGL* gpu, | 35 GrGLRenderTarget(GrGpuGL*, const IDDesc&, const GrGLIRect& viewport, |
| 40 const Desc& desc, | 36 GrGLTexID*, GrGLTexture*); |
| 41 const GrGLIRect& viewport, | |
| 42 GrGLTexID* texID, | |
| 43 GrGLTexture* texture); | |
| 44 | 37 |
| 45 // creates an independent GrGLRenderTarget | 38 // creates an independent GrGLRenderTarget |
| 46 GrGLRenderTarget(GrGpuGL* gpu, | 39 GrGLRenderTarget(GrGpuGL*, const GrSurfaceDesc&, const IDDesc&, const GrGLIR
ect& viewport); |
| 47 const Desc& desc, | |
| 48 const GrGLIRect& viewport); | |
| 49 | 40 |
| 50 virtual ~GrGLRenderTarget() { this->release(); } | 41 virtual ~GrGLRenderTarget() { this->release(); } |
| 51 | 42 |
| 52 void setViewport(const GrGLIRect& rect) { fViewport = rect; } | 43 void setViewport(const GrGLIRect& rect) { fViewport = rect; } |
| 53 const GrGLIRect& getViewport() const { return fViewport; } | 44 const GrGLIRect& getViewport() const { return fViewport; } |
| 54 | 45 |
| 55 // The following two functions return the same ID when a | 46 // The following two functions return the same ID when a |
| 56 // texture/render target is multisampled, and different IDs when | 47 // texture/render target is multisampled, and different IDs when |
| 57 // it is. | 48 // it is. |
| 58 // FBO ID used to render into | 49 // FBO ID used to render into |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 GrGLuint fMSColorRenderbufferID; | 83 GrGLuint fMSColorRenderbufferID; |
| 93 | 84 |
| 94 // when we switch to this render target we want to set the viewport to | 85 // when we switch to this render target we want to set the viewport to |
| 95 // only render to to content area (as opposed to the whole allocation) and | 86 // only render to to content area (as opposed to the whole allocation) and |
| 96 // we want the rendering to be at top left (GL has origin in bottom left) | 87 // we want the rendering to be at top left (GL has origin in bottom left) |
| 97 GrGLIRect fViewport; | 88 GrGLIRect fViewport; |
| 98 | 89 |
| 99 // non-NULL if this RT was created by Gr with an associated GrGLTexture. | 90 // non-NULL if this RT was created by Gr with an associated GrGLTexture. |
| 100 SkAutoTUnref<GrGLTexID> fTexIDObj; | 91 SkAutoTUnref<GrGLTexID> fTexIDObj; |
| 101 | 92 |
| 102 void init(const Desc& desc, const GrGLIRect& viewport, GrGLTexID* texID); | 93 void init(const GrSurfaceDesc&, const IDDesc&, const GrGLIRect& viewport, Gr
GLTexID*); |
| 103 | 94 |
| 104 typedef GrRenderTarget INHERITED; | 95 typedef GrRenderTarget INHERITED; |
| 105 }; | 96 }; |
| 106 | 97 |
| 107 #endif | 98 #endif |
| OLD | NEW |