OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2010 Google Inc. | 2 * Copyright 2010 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 GrContext_DEFINED | 8 #ifndef GrContext_DEFINED |
9 #define GrContext_DEFINED | 9 #define GrContext_DEFINED |
10 | 10 |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 | 122 |
123 /** | 123 /** |
124 * Creates a new entry, based on the specified key and texture and returns i
t. The caller owns a | 124 * Creates a new entry, based on the specified key and texture and returns i
t. The caller owns a |
125 * ref on the returned texture which must be balanced by a call to unref. | 125 * ref on the returned texture which must be balanced by a call to unref. |
126 * | 126 * |
127 * @param params The texture params used to draw a texture may help deter
mine | 127 * @param params The texture params used to draw a texture may help deter
mine |
128 * the cache entry used. (e.g. different versions may exist | 128 * the cache entry used. (e.g. different versions may exist |
129 * for different wrap modes on GPUs with limited NPOT | 129 * for different wrap modes on GPUs with limited NPOT |
130 * texture support). NULL implies clamp wrap modes. | 130 * texture support). NULL implies clamp wrap modes. |
131 * @param desc Description of the texture properties. | 131 * @param desc Description of the texture properties. |
132 * @param cacheID Cache-specific properties (e.g., texture gen ID) | 132 * @param cacheID Cache-specific properties (e.g., texture gen ID) |
133 * @param srcData Pointer to the pixel values. | 133 * @param srcData Pointer to the pixel values. |
134 * @param rowBytes The number of bytes between rows of the texture. Zero | 134 * @param rowBytes The number of bytes between rows of the texture. Zero |
135 * implies tightly packed rows. | 135 * implies tightly packed rows. |
136 * @param cacheKey (optional) If non-NULL, we'll write the cache key we use
d to cacheKey. | 136 * @param cacheKey (optional) If non-NULL, we'll write the cache key we use
d to cacheKey. |
137 */ | 137 */ |
138 GrTexture* createTexture(const GrTextureParams* params, | 138 GrTexture* createTexture(const GrTextureParams* params, |
139 const GrTextureDesc& desc, | 139 const GrTextureDesc& desc, |
140 const GrCacheID& cacheID, | 140 const GrCacheID& cacheID, |
141 void* srcData, | 141 void* srcData, |
142 size_t rowBytes, | 142 size_t rowBytes, |
143 GrResourceKey* cacheKey = NULL); | 143 GrResourceKey* cacheKey = NULL); |
144 | 144 |
145 /** | 145 /** |
146 * Search for an entry based on key and dimensions. If found, ref it and ret
urn it. The return | 146 * Search for an entry based on key and dimensions. If found, ref it and ret
urn it. The return |
147 * value will be NULL if not found. The caller must balance with a call to u
nref. | 147 * value will be NULL if not found. The caller must balance with a call to u
nref. |
148 * | 148 * |
149 * @param desc Description of the texture properties. | 149 * @param desc Description of the texture properties. |
150 * @param cacheID Cache-specific properties (e.g., texture gen ID) | 150 * @param cacheID Cache-specific properties (e.g., texture gen ID) |
151 * @param params The texture params used to draw a texture may help deter
mine | 151 * @param params The texture params used to draw a texture may help deter
mine |
152 * the cache entry used. (e.g. different versions may exist | 152 * the cache entry used. (e.g. different versions may exist |
153 * for different wrap modes on GPUs with limited NPOT | 153 * for different wrap modes on GPUs with limited NPOT |
154 * texture support). NULL implies clamp wrap modes. | 154 * texture support). NULL implies clamp wrap modes. |
155 */ | 155 */ |
156 GrTexture* findAndRefTexture(const GrTextureDesc& desc, | 156 GrTexture* findAndRefTexture(const GrTextureDesc& desc, |
157 const GrCacheID& cacheID, | 157 const GrCacheID& cacheID, |
158 const GrTextureParams* params); | 158 const GrTextureParams* params); |
159 /** | 159 /** |
160 * Determines whether a texture is in the cache. If the texture is found it | 160 * Determines whether a texture is in the cache. If the texture is found it |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 void setMaxTextureSizeOverride(int maxTextureSizeOverride); | 276 void setMaxTextureSizeOverride(int maxTextureSizeOverride); |
277 | 277 |
278 /////////////////////////////////////////////////////////////////////////// | 278 /////////////////////////////////////////////////////////////////////////// |
279 // Render targets | 279 // Render targets |
280 | 280 |
281 /** | 281 /** |
282 * Sets the render target. | 282 * Sets the render target. |
283 * @param target the render target to set. | 283 * @param target the render target to set. |
284 */ | 284 */ |
285 void setRenderTarget(GrRenderTarget* target) { | 285 void setRenderTarget(GrRenderTarget* target) { |
286 fRenderTarget.reset(SkSafeRef(target)); | 286 // SkDebugf("GrContext::setRenderTarget\n"); |
| 287 fRenderTarget1.reset(SkSafeRef(target)); |
287 } | 288 } |
288 | 289 |
289 /** | 290 /** |
290 * Gets the current render target. | 291 * Gets the current render target. |
291 * @return the currently bound render target. | 292 * @return the currently bound render target. |
292 */ | 293 */ |
293 const GrRenderTarget* getRenderTarget() const { return fRenderTarget.get();
} | 294 const GrRenderTarget* getRenderTarget() const { return fRenderTarget1.get();
} |
294 GrRenderTarget* getRenderTarget() { return fRenderTarget.get(); } | 295 GrRenderTarget* getRenderTarget() { return fRenderTarget1.get(); } |
295 | 296 |
296 GrAARectRenderer* getAARectRenderer() { return fAARectRenderer; } | 297 GrAARectRenderer* getAARectRenderer() { return fAARectRenderer; } |
297 | 298 |
298 /** | 299 /** |
299 * Can the provided configuration act as a color render target? | 300 * Can the provided configuration act as a color render target? |
300 */ | 301 */ |
301 bool isConfigRenderable(GrPixelConfig config, bool withMSAA) const; | 302 bool isConfigRenderable(GrPixelConfig config, bool withMSAA) const; |
302 | 303 |
303 /** | 304 /** |
304 * Return the max width or height of a render target supported by the | 305 * Return the max width or height of a render target supported by the |
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
896 private: | 897 private: |
897 // Used to indicate whether a draw should be performed immediately or queued
in fDrawBuffer. | 898 // Used to indicate whether a draw should be performed immediately or queued
in fDrawBuffer. |
898 enum BufferedDraw { | 899 enum BufferedDraw { |
899 kYes_BufferedDraw, | 900 kYes_BufferedDraw, |
900 kNo_BufferedDraw, | 901 kNo_BufferedDraw, |
901 }; | 902 }; |
902 BufferedDraw fLastDrawWasBuffered; | 903 BufferedDraw fLastDrawWasBuffered; |
903 | 904 |
904 GrGpu* fGpu; | 905 GrGpu* fGpu; |
905 SkMatrix fViewMatrix; | 906 SkMatrix fViewMatrix; |
906 SkAutoTUnref<GrRenderTarget> fRenderTarget; | 907 SkAutoTUnref<GrRenderTarget> fRenderTarget1; |
907 const GrClipData* fClip; // TODO: make this ref counted | 908 const GrClipData* fClip; // TODO: make this ref counted |
908 GrDrawState* fDrawState; | 909 GrDrawState* fDrawState; |
909 | 910 |
910 GrResourceCache* fTextureCache; | 911 GrResourceCache* fTextureCache; |
911 GrFontCache* fFontCache; | 912 GrFontCache* fFontCache; |
912 SkAutoTDelete<GrLayerCache> fLayerCache; | 913 SkAutoTDelete<GrLayerCache> fLayerCache; |
913 | 914 |
914 GrPathRendererChain* fPathRendererChain; | 915 GrPathRendererChain* fPathRendererChain; |
915 GrSoftwarePathRenderer* fSoftwarePathRenderer; | 916 GrSoftwarePathRenderer* fSoftwarePathRenderer; |
916 | 917 |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1078 } | 1079 } |
1079 | 1080 |
1080 GrTexture* texture() { return fTexture; } | 1081 GrTexture* texture() { return fTexture; } |
1081 | 1082 |
1082 private: | 1083 private: |
1083 GrContext* fContext; | 1084 GrContext* fContext; |
1084 GrTexture* fTexture; | 1085 GrTexture* fTexture; |
1085 }; | 1086 }; |
1086 | 1087 |
1087 #endif | 1088 #endif |
OLD | NEW |