Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(300)

Side by Side Diff: include/gpu/GrContext.h

Issue 1158433006: Store context options on caps. (Closed) Base URL: https://skia.googlesource.com/skia.git@onecaps
Patch Set: remove case statement accidentally checked in Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « include/gpu/GrCaps.h ('k') | include/gpu/GrContextOptions.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 struct GrContextOptions;
23 class GrDrawTarget; 24 class GrDrawTarget;
24 class GrFragmentProcessor; 25 class GrFragmentProcessor;
25 class GrGpu; 26 class GrGpu;
26 class GrGpuTraceMarker; 27 class GrGpuTraceMarker;
27 class GrIndexBuffer; 28 class GrIndexBuffer;
28 class GrLayerCache; 29 class GrLayerCache;
29 class GrOvalRenderer; 30 class GrOvalRenderer;
30 class GrPath; 31 class GrPath;
31 class GrPathRenderer; 32 class GrPathRenderer;
32 class GrPipelineBuilder; 33 class GrPipelineBuilder;
33 class GrResourceEntry; 34 class GrResourceEntry;
34 class GrResourceCache; 35 class GrResourceCache;
35 class GrResourceProvider; 36 class GrResourceProvider;
36 class GrTestTarget; 37 class GrTestTarget;
37 class GrTextBlobCache; 38 class GrTextBlobCache;
38 class GrTextContext; 39 class GrTextContext;
39 class GrTextureParams; 40 class GrTextureParams;
40 class GrVertexBuffer; 41 class GrVertexBuffer;
41 class GrStrokeInfo; 42 class GrStrokeInfo;
42 class GrSoftwarePathRenderer; 43 class GrSoftwarePathRenderer;
43 class SkGpuDevice; 44 class SkGpuDevice;
44 45
45 class SK_API GrContext : public SkRefCnt { 46 class SK_API GrContext : public SkRefCnt {
46 public: 47 public:
47 SK_DECLARE_INST_COUNT(GrContext) 48 SK_DECLARE_INST_COUNT(GrContext)
48 49
49 struct Options {
50 Options() : fDrawPathToCompressedTexture(false), fSuppressPrints(false) { }
51
52 // EXPERIMENTAL
53 // May be removed in the future, or may become standard depending
54 // on the outcomes of a variety of internal tests.
55 bool fDrawPathToCompressedTexture;
56 bool fSuppressPrints;
57 };
58
59 /** 50 /**
60 * Creates a GrContext for a backend context. 51 * Creates a GrContext for a backend context.
61 */ 52 */
62 static GrContext* Create(GrBackend, GrBackendContext, const Options* opts = NULL); 53 static GrContext* Create(GrBackend, GrBackendContext, const GrContextOptions & options);
54 static GrContext* Create(GrBackend, GrBackendContext);
63 55
64 /** 56 /**
65 * Only defined in test apps. 57 * Only defined in test apps.
66 */ 58 */
67 static GrContext* CreateMockContext(); 59 static GrContext* CreateMockContext();
68 60
69 virtual ~GrContext(); 61 virtual ~GrContext();
70 62
71 /** 63 /**
72 * The GrContext normally assumes that no outsider is setting state 64 * The GrContext normally assumes that no outsider is setting state
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 GrGpu* getGpu() { return fGpu; } 515 GrGpu* getGpu() { return fGpu; }
524 const GrGpu* getGpu() const { return fGpu; } 516 const GrGpu* getGpu() const { return fGpu; }
525 GrBatchFontCache* getBatchFontCache() { return fBatchFontCache; } 517 GrBatchFontCache* getBatchFontCache() { return fBatchFontCache; }
526 GrLayerCache* getLayerCache() { return fLayerCache.get(); } 518 GrLayerCache* getLayerCache() { return fLayerCache.get(); }
527 GrTextBlobCache* getTextBlobCache() { return fTextBlobCache; } 519 GrTextBlobCache* getTextBlobCache() { return fTextBlobCache; }
528 GrDrawTarget* getTextTarget(); 520 GrDrawTarget* getTextTarget();
529 GrAARectRenderer* getAARectRenderer() { return fAARectRenderer; } 521 GrAARectRenderer* getAARectRenderer() { return fAARectRenderer; }
530 GrResourceProvider* resourceProvider() { return fResourceProvider; } 522 GrResourceProvider* resourceProvider() { return fResourceProvider; }
531 const GrResourceProvider* resourceProvider() const { return fResourceProvide r; } 523 const GrResourceProvider* resourceProvider() const { return fResourceProvide r; }
532 GrResourceCache* getResourceCache() { return fResourceCache; } 524 GrResourceCache* getResourceCache() { return fResourceCache; }
533 bool suppressPrints() const { return fOptions.fSuppressPrints; }
534 525
535 // Called by tests that draw directly to the context via GrDrawTarget 526 // Called by tests that draw directly to the context via GrDrawTarget
536 void getTestTarget(GrTestTarget*); 527 void getTestTarget(GrTestTarget*);
537 528
538 void addGpuTraceMarker(const GrGpuTraceMarker* marker); 529 void addGpuTraceMarker(const GrGpuTraceMarker* marker);
539 void removeGpuTraceMarker(const GrGpuTraceMarker* marker); 530 void removeGpuTraceMarker(const GrGpuTraceMarker* marker);
540 531
541 GrPathRenderer* getPathRenderer( 532 GrPathRenderer* getPathRenderer(
542 const GrDrawTarget* target, 533 const GrDrawTarget* target,
543 const GrPipelineBuilder*, 534 const GrPipelineBuilder*,
544 const SkMatrix& viewMatrix, 535 const SkMatrix& viewMatrix,
545 const SkPath& path, 536 const SkPath& path,
546 const GrStrokeInfo& stroke, 537 const GrStrokeInfo& stroke,
547 bool allowSW, 538 bool allowSW,
548 GrPathRendererChain::DrawType drawType = GrPathRendererChain ::kColor_DrawType, 539 GrPathRendererChain::DrawType drawType = GrPathRendererChain ::kColor_DrawType,
549 GrPathRendererChain::StencilSupport* stencilSupport = NULL); 540 GrPathRendererChain::StencilSupport* stencilSupport = NULL);
550 541
551 /**
552 * This returns a copy of the the GrContext::Options that was passed to the
553 * constructor of this class.
554 */
555 const Options& getOptions() const { return fOptions; }
556
557 /** Prints cache stats to the string if GR_CACHE_STATS == 1. */ 542 /** Prints cache stats to the string if GR_CACHE_STATS == 1. */
558 void dumpCacheStats(SkString*) const; 543 void dumpCacheStats(SkString*) const;
559 void printCacheStats() const; 544 void printCacheStats() const;
560 545
561 /** Prints GPU stats to the string if GR_GPU_STATS == 1. */ 546 /** Prints GPU stats to the string if GR_GPU_STATS == 1. */
562 void dumpGpuStats(SkString*) const; 547 void dumpGpuStats(SkString*) const;
563 void printGpuStats() const; 548 void printGpuStats() const;
564 549
565 private: 550 private:
566 GrGpu* fGpu; 551 GrGpu* fGpu;
(...skipping 25 matching lines...) Expand all
592 577
593 struct CleanUpData { 578 struct CleanUpData {
594 PFCleanUpFunc fFunc; 579 PFCleanUpFunc fFunc;
595 void* fInfo; 580 void* fInfo;
596 }; 581 };
597 582
598 SkTDArray<CleanUpData> fCleanUpData; 583 SkTDArray<CleanUpData> fCleanUpData;
599 584
600 int fMaxTextureSizeOverride; 585 int fMaxTextureSizeOverride;
601 586
602 const Options fOptions;
603 const uint32_t fUniqueID; 587 const uint32_t fUniqueID;
604 588
605 GrContext(const Options&); // init must be called after the constructor. 589 GrContext(); // init must be called after the constructor.
606 bool init(GrBackend, GrBackendContext); 590 bool init(GrBackend, GrBackendContext, const GrContextOptions& options);
607 void initMockContext(); 591 void initMockContext();
608 void initCommon(); 592 void initCommon();
609 593
610 class AutoCheckFlush; 594 class AutoCheckFlush;
611 // Sets the paint and returns the target to draw into. 595 // Sets the paint and returns the target to draw into.
612 GrDrawTarget* prepareToDraw(GrPipelineBuilder*, 596 GrDrawTarget* prepareToDraw(GrPipelineBuilder*,
613 GrRenderTarget* rt, 597 GrRenderTarget* rt,
614 const GrClip&, 598 const GrClip&,
615 const GrPaint* paint, 599 const GrPaint* paint,
616 const AutoCheckFlush*); 600 const AutoCheckFlush*);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
660 */ 644 */
661 static void TextBlobCacheOverBudgetCB(void* data); 645 static void TextBlobCacheOverBudgetCB(void* data);
662 646
663 // TODO see note on createTextContext 647 // TODO see note on createTextContext
664 friend class SkGpuDevice; 648 friend class SkGpuDevice;
665 649
666 typedef SkRefCnt INHERITED; 650 typedef SkRefCnt INHERITED;
667 }; 651 };
668 652
669 #endif 653 #endif
OLDNEW
« no previous file with comments | « include/gpu/GrCaps.h ('k') | include/gpu/GrContextOptions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698