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 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
584 GrTextureProvider* fTextureProvider; | 582 GrTextureProvider* fTextureProvider; |
585 }; | 583 }; |
586 | 584 |
587 GrBatchFontCache* fBatchFontCache; | 585 GrBatchFontCache* fBatchFontCache; |
588 SkAutoTDelete<GrLayerCache> fLayerCache; | 586 SkAutoTDelete<GrLayerCache> fLayerCache; |
589 SkAutoTDelete<GrTextBlobCache> fTextBlobCache; | 587 SkAutoTDelete<GrTextBlobCache> fTextBlobCache; |
590 | 588 |
591 GrPathRendererChain* fPathRendererChain; | 589 GrPathRendererChain* fPathRendererChain; |
592 GrSoftwarePathRenderer* fSoftwarePathRenderer; | 590 GrSoftwarePathRenderer* fSoftwarePathRenderer; |
593 | 591 |
594 GrVertexBufferAllocPool* fDrawBufferVBAllocPool; | |
595 GrIndexBufferAllocPool* fDrawBufferIBAllocPool; | |
596 GrDrawTarget* fDrawBuffer; | 592 GrDrawTarget* fDrawBuffer; |
597 | 593 |
598 // Set by OverbudgetCB() to request that GrContext flush before exiting a dr
aw. | 594 // Set by OverbudgetCB() to request that GrContext flush before exiting a dr
aw. |
599 bool fFlushToReduceCacheSize; | 595 bool fFlushToReduceCacheSize; |
600 GrAARectRenderer* fAARectRenderer; | 596 GrAARectRenderer* fAARectRenderer; |
601 GrOvalRenderer* fOvalRenderer; | 597 GrOvalRenderer* fOvalRenderer; |
602 | 598 |
603 bool fDidTestPMConversions; | 599 bool fDidTestPMConversions; |
604 int fPMToUPMConversion; | 600 int fPMToUPMConversion; |
605 int fUPMToPMConversion; | 601 int fUPMToPMConversion; |
606 | 602 |
607 struct CleanUpData { | 603 struct CleanUpData { |
608 PFCleanUpFunc fFunc; | 604 PFCleanUpFunc fFunc; |
609 void* fInfo; | 605 void* fInfo; |
610 }; | 606 }; |
611 | 607 |
612 SkTDArray<CleanUpData> fCleanUpData; | 608 SkTDArray<CleanUpData> fCleanUpData; |
613 | 609 |
614 int fMaxTextureSizeOverride; | 610 int fMaxTextureSizeOverride; |
615 | 611 |
616 const Options fOptions; | 612 const Options fOptions; |
617 | 613 |
618 GrContext(const Options&); // init must be called after the constructor. | 614 GrContext(const Options&); // init must be called after the constructor. |
619 bool init(GrBackend, GrBackendContext); | 615 bool init(GrBackend, GrBackendContext); |
620 void initMockContext(); | 616 void initMockContext(); |
621 void initCommon(); | 617 void initCommon(); |
622 | 618 |
623 void setupDrawBuffer(); | |
624 | |
625 class AutoCheckFlush; | 619 class AutoCheckFlush; |
626 // Sets the paint and returns the target to draw into. | 620 // Sets the paint and returns the target to draw into. |
627 GrDrawTarget* prepareToDraw(GrPipelineBuilder*, | 621 GrDrawTarget* prepareToDraw(GrPipelineBuilder*, |
628 GrRenderTarget* rt, | 622 GrRenderTarget* rt, |
629 const GrClip&, | 623 const GrClip&, |
630 const GrPaint* paint, | 624 const GrPaint* paint, |
631 const AutoCheckFlush*); | 625 const AutoCheckFlush*); |
632 | 626 |
633 // A simpler version of the above which just returns the draw target. Clip
is *NOT* set | 627 // A simpler version of the above which just returns the draw target. Clip
is *NOT* set |
634 GrDrawTarget* prepareToDraw(); | 628 GrDrawTarget* prepareToDraw(); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
675 */ | 669 */ |
676 static void TextBlobCacheOverBudgetCB(void* data); | 670 static void TextBlobCacheOverBudgetCB(void* data); |
677 | 671 |
678 // TODO see note on createTextContext | 672 // TODO see note on createTextContext |
679 friend class SkGpuDevice; | 673 friend class SkGpuDevice; |
680 | 674 |
681 typedef SkRefCnt INHERITED; | 675 typedef SkRefCnt INHERITED; |
682 }; | 676 }; |
683 | 677 |
684 #endif | 678 #endif |
OLD | NEW |