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 GrDrawTarget; | 23 class GrDrawTarget; |
24 class GrFragmentProcessor; | 24 class GrFragmentProcessor; |
25 class GrGpu; | 25 class GrGpu; |
26 class GrGpuTraceMarker; | 26 class GrGpuTraceMarker; |
27 class GrIndexBuffer; | 27 class GrIndexBuffer; |
28 class GrIndexBufferAllocPool; | |
29 class GrLayerCache; | 28 class GrLayerCache; |
30 class GrOvalRenderer; | 29 class GrOvalRenderer; |
31 class GrPath; | 30 class GrPath; |
32 class GrPathRenderer; | 31 class GrPathRenderer; |
33 class GrPipelineBuilder; | 32 class GrPipelineBuilder; |
34 class GrResourceEntry; | 33 class GrResourceEntry; |
35 class GrResourceCache; | 34 class GrResourceCache; |
36 class GrResourceProvider; | 35 class GrResourceProvider; |
37 class GrTestTarget; | 36 class GrTestTarget; |
38 class GrTextBlobCache; | 37 class GrTextBlobCache; |
39 class GrTextContext; | 38 class GrTextContext; |
40 class GrTextureParams; | 39 class GrTextureParams; |
41 class GrVertexBuffer; | 40 class GrVertexBuffer; |
42 class GrVertexBufferAllocPool; | |
43 class GrStrokeInfo; | 41 class GrStrokeInfo; |
44 class GrSoftwarePathRenderer; | 42 class GrSoftwarePathRenderer; |
45 class SkGpuDevice; | 43 class SkGpuDevice; |
46 | 44 |
47 class SK_API GrContext : public SkRefCnt { | 45 class SK_API GrContext : public SkRefCnt { |
48 public: | 46 public: |
49 SK_DECLARE_INST_COUNT(GrContext) | 47 SK_DECLARE_INST_COUNT(GrContext) |
50 | 48 |
51 struct Options { | 49 struct Options { |
52 Options() : fDrawPathToCompressedTexture(false) { } | 50 Options() : fDrawPathToCompressedTexture(false) { } |
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
589 GrTextureProvider* fTextureProvider; | 587 GrTextureProvider* fTextureProvider; |
590 }; | 588 }; |
591 | 589 |
592 GrBatchFontCache* fBatchFontCache; | 590 GrBatchFontCache* fBatchFontCache; |
593 SkAutoTDelete<GrLayerCache> fLayerCache; | 591 SkAutoTDelete<GrLayerCache> fLayerCache; |
594 SkAutoTDelete<GrTextBlobCache> fTextBlobCache; | 592 SkAutoTDelete<GrTextBlobCache> fTextBlobCache; |
595 | 593 |
596 GrPathRendererChain* fPathRendererChain; | 594 GrPathRendererChain* fPathRendererChain; |
597 GrSoftwarePathRenderer* fSoftwarePathRenderer; | 595 GrSoftwarePathRenderer* fSoftwarePathRenderer; |
598 | 596 |
599 GrVertexBufferAllocPool* fDrawBufferVBAllocPool; | |
600 GrIndexBufferAllocPool* fDrawBufferIBAllocPool; | |
601 GrDrawTarget* fDrawBuffer; | 597 GrDrawTarget* fDrawBuffer; |
602 | 598 |
603 // Set by OverbudgetCB() to request that GrContext flush before exiting a dr
aw. | 599 // Set by OverbudgetCB() to request that GrContext flush before exiting a dr
aw. |
604 bool fFlushToReduceCacheSize; | 600 bool fFlushToReduceCacheSize; |
605 GrAARectRenderer* fAARectRenderer; | 601 GrAARectRenderer* fAARectRenderer; |
606 GrOvalRenderer* fOvalRenderer; | 602 GrOvalRenderer* fOvalRenderer; |
607 | 603 |
608 bool fDidTestPMConversions; | 604 bool fDidTestPMConversions; |
609 int fPMToUPMConversion; | 605 int fPMToUPMConversion; |
610 int fUPMToPMConversion; | 606 int fUPMToPMConversion; |
611 | 607 |
612 struct CleanUpData { | 608 struct CleanUpData { |
613 PFCleanUpFunc fFunc; | 609 PFCleanUpFunc fFunc; |
614 void* fInfo; | 610 void* fInfo; |
615 }; | 611 }; |
616 | 612 |
617 SkTDArray<CleanUpData> fCleanUpData; | 613 SkTDArray<CleanUpData> fCleanUpData; |
618 | 614 |
619 int fMaxTextureSizeOverride; | 615 int fMaxTextureSizeOverride; |
620 | 616 |
621 const Options fOptions; | 617 const Options fOptions; |
622 const uint32_t fUniqueID; | 618 const uint32_t fUniqueID; |
623 | 619 |
624 GrContext(const Options&); // init must be called after the constructor. | 620 GrContext(const Options&); // init must be called after the constructor. |
625 bool init(GrBackend, GrBackendContext); | 621 bool init(GrBackend, GrBackendContext); |
626 void initMockContext(); | 622 void initMockContext(); |
627 void initCommon(); | 623 void initCommon(); |
628 | 624 |
629 void setupDrawBuffer(); | |
630 | |
631 class AutoCheckFlush; | 625 class AutoCheckFlush; |
632 // Sets the paint and returns the target to draw into. | 626 // Sets the paint and returns the target to draw into. |
633 GrDrawTarget* prepareToDraw(GrPipelineBuilder*, | 627 GrDrawTarget* prepareToDraw(GrPipelineBuilder*, |
634 GrRenderTarget* rt, | 628 GrRenderTarget* rt, |
635 const GrClip&, | 629 const GrClip&, |
636 const GrPaint* paint, | 630 const GrPaint* paint, |
637 const AutoCheckFlush*); | 631 const AutoCheckFlush*); |
638 | 632 |
639 // A simpler version of the above which just returns the draw target. Clip
is *NOT* set | 633 // A simpler version of the above which just returns the draw target. Clip
is *NOT* set |
640 GrDrawTarget* prepareToDraw(); | 634 GrDrawTarget* prepareToDraw(); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
681 */ | 675 */ |
682 static void TextBlobCacheOverBudgetCB(void* data); | 676 static void TextBlobCacheOverBudgetCB(void* data); |
683 | 677 |
684 // TODO see note on createTextContext | 678 // TODO see note on createTextContext |
685 friend class SkGpuDevice; | 679 friend class SkGpuDevice; |
686 | 680 |
687 typedef SkRefCnt INHERITED; | 681 typedef SkRefCnt INHERITED; |
688 }; | 682 }; |
689 | 683 |
690 #endif | 684 #endif |
OLD | NEW |