| 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 |
| 11 #include "GrClip.h" | 11 #include "GrClip.h" |
| 12 #include "GrColor.h" | 12 #include "GrColor.h" |
| 13 #include "GrPaint.h" | 13 #include "GrPaint.h" |
| 14 #include "GrPathRendererChain.h" | 14 #include "GrPathRendererChain.h" |
| 15 #include "GrRenderTarget.h" | 15 #include "GrRenderTarget.h" |
| 16 #include "GrTextureProvider.h" | 16 #include "GrTextureProvider.h" |
| 17 #include "SkMatrix.h" | 17 #include "SkMatrix.h" |
| 18 #include "SkPathEffect.h" | 18 #include "SkPathEffect.h" |
| 19 #include "SkTypes.h" | 19 #include "SkTypes.h" |
| 20 | 20 |
| 21 class GrAARectRenderer; | 21 class GrAARectRenderer; |
| 22 class GrBatchFontCache; | 22 class GrBatchFontCache; |
| 23 class GrCaps; |
| 23 struct GrContextOptions; | 24 struct GrContextOptions; |
| 24 class GrDrawContext; | 25 class GrDrawContext; |
| 25 class GrDrawTarget; | 26 class GrDrawTarget; |
| 26 class GrFragmentProcessor; | 27 class GrFragmentProcessor; |
| 27 class GrGpu; | 28 class GrGpu; |
| 28 class GrGpuTraceMarker; | 29 class GrGpuTraceMarker; |
| 29 class GrIndexBuffer; | 30 class GrIndexBuffer; |
| 30 class GrLayerCache; | 31 class GrLayerCache; |
| 31 class GrOvalRenderer; | 32 class GrOvalRenderer; |
| 32 class GrPath; | 33 class GrPath; |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 */ | 149 */ |
| 149 void freeGpuResources(); | 150 void freeGpuResources(); |
| 150 | 151 |
| 151 /** | 152 /** |
| 152 * Purge all the unlocked resources from the cache. | 153 * Purge all the unlocked resources from the cache. |
| 153 * This entry point is mainly meant for timing texture uploads | 154 * This entry point is mainly meant for timing texture uploads |
| 154 * and is not defined in normal builds of Skia. | 155 * and is not defined in normal builds of Skia. |
| 155 */ | 156 */ |
| 156 void purgeAllUnlockedResources(); | 157 void purgeAllUnlockedResources(); |
| 157 | 158 |
| 158 ////////////////////////////////////////////////////////////////////////// | 159 /** Access the context capabilities */ |
| 159 /// Texture and Render Target Queries | 160 const GrCaps* caps() const { return fCaps; } |
| 160 | |
| 161 /** | |
| 162 * Are shader derivatives supported? | |
| 163 */ | |
| 164 bool shaderDerivativeSupport() const; | |
| 165 | |
| 166 /** | |
| 167 * Can the provided configuration act as a texture? | |
| 168 */ | |
| 169 bool isConfigTexturable(GrPixelConfig) const; | |
| 170 | |
| 171 /** | |
| 172 * Can non-power-of-two textures be used with tile modes other than clamp? | |
| 173 */ | |
| 174 bool npotTextureTileSupport() const; | |
| 175 | |
| 176 /** | |
| 177 * Return the max width or height of a texture supported by the current GPU
. | |
| 178 */ | |
| 179 int getMaxTextureSize() const; | |
| 180 | |
| 181 /** | |
| 182 * Can the provided configuration act as a color render target? | |
| 183 */ | |
| 184 bool isConfigRenderable(GrPixelConfig config, bool withMSAA) const; | |
| 185 | |
| 186 /** | |
| 187 * Return the max width or height of a render target supported by the | |
| 188 * current GPU. | |
| 189 */ | |
| 190 int getMaxRenderTargetSize() const; | |
| 191 | |
| 192 /** | |
| 193 * Returns the max sample count for a render target. It will be 0 if MSAA | |
| 194 * is not supported. | |
| 195 */ | |
| 196 int getMaxSampleCount() const; | |
| 197 | 161 |
| 198 /** | 162 /** |
| 199 * Returns the recommended sample count for a render target when using this | 163 * Returns the recommended sample count for a render target when using this |
| 200 * context. | 164 * context. |
| 201 * | 165 * |
| 202 * @param config the configuration of the render target. | 166 * @param config the configuration of the render target. |
| 203 * @param dpi the display density in dots per inch. | 167 * @param dpi the display density in dots per inch. |
| 204 * | 168 * |
| 205 * @return sample count that should be perform well and have good enough | 169 * @return sample count that should be perform well and have good enough |
| 206 * rendering quality for the display. Alternatively returns 0 if | 170 * rendering quality for the display. Alternatively returns 0 if |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 /** Prints cache stats to the string if GR_CACHE_STATS == 1. */ | 349 /** Prints cache stats to the string if GR_CACHE_STATS == 1. */ |
| 386 void dumpCacheStats(SkString*) const; | 350 void dumpCacheStats(SkString*) const; |
| 387 void printCacheStats() const; | 351 void printCacheStats() const; |
| 388 | 352 |
| 389 /** Prints GPU stats to the string if GR_GPU_STATS == 1. */ | 353 /** Prints GPU stats to the string if GR_GPU_STATS == 1. */ |
| 390 void dumpGpuStats(SkString*) const; | 354 void dumpGpuStats(SkString*) const; |
| 391 void printGpuStats() const; | 355 void printGpuStats() const; |
| 392 | 356 |
| 393 private: | 357 private: |
| 394 GrGpu* fGpu; | 358 GrGpu* fGpu; |
| 359 const GrCaps* fCaps; |
| 395 GrResourceCache* fResourceCache; | 360 GrResourceCache* fResourceCache; |
| 396 // this union exists because the inheritance of GrTextureProvider->GrResourc
eProvider | 361 // this union exists because the inheritance of GrTextureProvider->GrResourc
eProvider |
| 397 // is in a private header. | 362 // is in a private header. |
| 398 union { | 363 union { |
| 399 GrResourceProvider* fResourceProvider; | 364 GrResourceProvider* fResourceProvider; |
| 400 GrTextureProvider* fTextureProvider; | 365 GrTextureProvider* fTextureProvider; |
| 401 }; | 366 }; |
| 402 | 367 |
| 403 GrBatchFontCache* fBatchFontCache; | 368 GrBatchFontCache* fBatchFontCache; |
| 404 SkAutoTDelete<GrLayerCache> fLayerCache; | 369 SkAutoTDelete<GrLayerCache> fLayerCache; |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 496 */ | 461 */ |
| 497 static void TextBlobCacheOverBudgetCB(void* data); | 462 static void TextBlobCacheOverBudgetCB(void* data); |
| 498 | 463 |
| 499 // TODO see note on createTextContext | 464 // TODO see note on createTextContext |
| 500 friend class SkGpuDevice; | 465 friend class SkGpuDevice; |
| 501 | 466 |
| 502 typedef SkRefCnt INHERITED; | 467 typedef SkRefCnt INHERITED; |
| 503 }; | 468 }; |
| 504 | 469 |
| 505 #endif | 470 #endif |
| OLD | NEW |