| 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 24 matching lines...) Expand all Loading... |
| 35 class GrResourceProvider; | 35 class GrResourceProvider; |
| 36 class GrTestTarget; | 36 class GrTestTarget; |
| 37 class GrTextBlobCache; | 37 class GrTextBlobCache; |
| 38 class GrTextContext; | 38 class GrTextContext; |
| 39 class GrTextureParams; | 39 class GrTextureParams; |
| 40 class GrVertexBuffer; | 40 class GrVertexBuffer; |
| 41 class GrStrokeInfo; | 41 class GrStrokeInfo; |
| 42 class GrSoftwarePathRenderer; | 42 class GrSoftwarePathRenderer; |
| 43 class SkGpuDevice; | 43 class SkGpuDevice; |
| 44 | 44 |
| 45 // Takes a pointer to a GrContext, and will suppress prints if required |
| 46 #define GrContextSuppressf(context, format, ...) \ |
| 47 if (!context->suppressPrints()) { \ |
| 48 SkDebugf(format, ##__VA_ARGS__); \ |
| 49 } |
| 50 |
| 45 class SK_API GrContext : public SkRefCnt { | 51 class SK_API GrContext : public SkRefCnt { |
| 46 public: | 52 public: |
| 47 SK_DECLARE_INST_COUNT(GrContext) | 53 SK_DECLARE_INST_COUNT(GrContext) |
| 48 | 54 |
| 49 struct Options { | 55 struct Options { |
| 50 Options() : fDrawPathToCompressedTexture(false) { } | 56 Options() : fDrawPathToCompressedTexture(false), fSuppressPrints(false)
{ } |
| 51 | 57 |
| 52 // EXPERIMENTAL | 58 // EXPERIMENTAL |
| 53 // May be removed in the future, or may become standard depending | 59 // May be removed in the future, or may become standard depending |
| 54 // on the outcomes of a variety of internal tests. | 60 // on the outcomes of a variety of internal tests. |
| 55 bool fDrawPathToCompressedTexture; | 61 bool fDrawPathToCompressedTexture; |
| 62 bool fSuppressPrints; |
| 56 }; | 63 }; |
| 57 | 64 |
| 58 /** | 65 /** |
| 59 * Creates a GrContext for a backend context. | 66 * Creates a GrContext for a backend context. |
| 60 */ | 67 */ |
| 61 static GrContext* Create(GrBackend, GrBackendContext, const Options* opts =
NULL); | 68 static GrContext* Create(GrBackend, GrBackendContext, const Options* opts =
NULL); |
| 62 | 69 |
| 63 /** | 70 /** |
| 64 * Only defined in test apps. | 71 * Only defined in test apps. |
| 65 */ | 72 */ |
| (...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 522 GrGpu* getGpu() { return fGpu; } | 529 GrGpu* getGpu() { return fGpu; } |
| 523 const GrGpu* getGpu() const { return fGpu; } | 530 const GrGpu* getGpu() const { return fGpu; } |
| 524 GrBatchFontCache* getBatchFontCache() { return fBatchFontCache; } | 531 GrBatchFontCache* getBatchFontCache() { return fBatchFontCache; } |
| 525 GrLayerCache* getLayerCache() { return fLayerCache.get(); } | 532 GrLayerCache* getLayerCache() { return fLayerCache.get(); } |
| 526 GrTextBlobCache* getTextBlobCache() { return fTextBlobCache; } | 533 GrTextBlobCache* getTextBlobCache() { return fTextBlobCache; } |
| 527 GrDrawTarget* getTextTarget(); | 534 GrDrawTarget* getTextTarget(); |
| 528 GrAARectRenderer* getAARectRenderer() { return fAARectRenderer; } | 535 GrAARectRenderer* getAARectRenderer() { return fAARectRenderer; } |
| 529 GrResourceProvider* resourceProvider() { return fResourceProvider; } | 536 GrResourceProvider* resourceProvider() { return fResourceProvider; } |
| 530 const GrResourceProvider* resourceProvider() const { return fResourceProvide
r; } | 537 const GrResourceProvider* resourceProvider() const { return fResourceProvide
r; } |
| 531 GrResourceCache* getResourceCache() { return fResourceCache; } | 538 GrResourceCache* getResourceCache() { return fResourceCache; } |
| 539 bool suppressPrints() const { return fOptions.fSuppressPrints; } |
| 532 | 540 |
| 533 // Called by tests that draw directly to the context via GrDrawTarget | 541 // Called by tests that draw directly to the context via GrDrawTarget |
| 534 void getTestTarget(GrTestTarget*); | 542 void getTestTarget(GrTestTarget*); |
| 535 | 543 |
| 536 void addGpuTraceMarker(const GrGpuTraceMarker* marker); | 544 void addGpuTraceMarker(const GrGpuTraceMarker* marker); |
| 537 void removeGpuTraceMarker(const GrGpuTraceMarker* marker); | 545 void removeGpuTraceMarker(const GrGpuTraceMarker* marker); |
| 538 | 546 |
| 539 GrPathRenderer* getPathRenderer( | 547 GrPathRenderer* getPathRenderer( |
| 540 const GrDrawTarget* target, | 548 const GrDrawTarget* target, |
| 541 const GrPipelineBuilder*, | 549 const GrPipelineBuilder*, |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 658 */ | 666 */ |
| 659 static void TextBlobCacheOverBudgetCB(void* data); | 667 static void TextBlobCacheOverBudgetCB(void* data); |
| 660 | 668 |
| 661 // TODO see note on createTextContext | 669 // TODO see note on createTextContext |
| 662 friend class SkGpuDevice; | 670 friend class SkGpuDevice; |
| 663 | 671 |
| 664 typedef SkRefCnt INHERITED; | 672 typedef SkRefCnt INHERITED; |
| 665 }; | 673 }; |
| 666 | 674 |
| 667 #endif | 675 #endif |
| OLD | NEW |