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

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

Issue 1151603005: Revert of Store context options on caps. (Closed) Base URL: https://skia.googlesource.com/skia.git@onecaps
Patch Set: 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;
24 class GrDrawTarget; 23 class GrDrawTarget;
25 class GrFragmentProcessor; 24 class GrFragmentProcessor;
26 class GrGpu; 25 class GrGpu;
27 class GrGpuTraceMarker; 26 class GrGpuTraceMarker;
28 class GrIndexBuffer; 27 class GrIndexBuffer;
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 GrStrokeInfo; 41 class GrStrokeInfo;
43 class GrSoftwarePathRenderer; 42 class GrSoftwarePathRenderer;
44 class SkGpuDevice; 43 class SkGpuDevice;
45 44
46 class SK_API GrContext : public SkRefCnt { 45 class SK_API GrContext : public SkRefCnt {
47 public: 46 public:
48 SK_DECLARE_INST_COUNT(GrContext) 47 SK_DECLARE_INST_COUNT(GrContext)
49 48
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
50 /** 59 /**
51 * Creates a GrContext for a backend context. 60 * Creates a GrContext for a backend context.
52 */ 61 */
53 static GrContext* Create(GrBackend, GrBackendContext, const GrContextOptions & options); 62 static GrContext* Create(GrBackend, GrBackendContext, const Options* opts = NULL);
54 static GrContext* Create(GrBackend, GrBackendContext);
55 63
56 /** 64 /**
57 * Only defined in test apps. 65 * Only defined in test apps.
58 */ 66 */
59 static GrContext* CreateMockContext(); 67 static GrContext* CreateMockContext();
60 68
61 virtual ~GrContext(); 69 virtual ~GrContext();
62 70
63 /** 71 /**
64 * The GrContext normally assumes that no outsider is setting state 72 * The GrContext normally assumes that no outsider is setting state
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 GrGpu* getGpu() { return fGpu; } 523 GrGpu* getGpu() { return fGpu; }
516 const GrGpu* getGpu() const { return fGpu; } 524 const GrGpu* getGpu() const { return fGpu; }
517 GrBatchFontCache* getBatchFontCache() { return fBatchFontCache; } 525 GrBatchFontCache* getBatchFontCache() { return fBatchFontCache; }
518 GrLayerCache* getLayerCache() { return fLayerCache.get(); } 526 GrLayerCache* getLayerCache() { return fLayerCache.get(); }
519 GrTextBlobCache* getTextBlobCache() { return fTextBlobCache; } 527 GrTextBlobCache* getTextBlobCache() { return fTextBlobCache; }
520 GrDrawTarget* getTextTarget(); 528 GrDrawTarget* getTextTarget();
521 GrAARectRenderer* getAARectRenderer() { return fAARectRenderer; } 529 GrAARectRenderer* getAARectRenderer() { return fAARectRenderer; }
522 GrResourceProvider* resourceProvider() { return fResourceProvider; } 530 GrResourceProvider* resourceProvider() { return fResourceProvider; }
523 const GrResourceProvider* resourceProvider() const { return fResourceProvide r; } 531 const GrResourceProvider* resourceProvider() const { return fResourceProvide r; }
524 GrResourceCache* getResourceCache() { return fResourceCache; } 532 GrResourceCache* getResourceCache() { return fResourceCache; }
533 bool suppressPrints() const { return fOptions.fSuppressPrints; }
525 534
526 // Called by tests that draw directly to the context via GrDrawTarget 535 // Called by tests that draw directly to the context via GrDrawTarget
527 void getTestTarget(GrTestTarget*); 536 void getTestTarget(GrTestTarget*);
528 537
529 void addGpuTraceMarker(const GrGpuTraceMarker* marker); 538 void addGpuTraceMarker(const GrGpuTraceMarker* marker);
530 void removeGpuTraceMarker(const GrGpuTraceMarker* marker); 539 void removeGpuTraceMarker(const GrGpuTraceMarker* marker);
531 540
532 GrPathRenderer* getPathRenderer( 541 GrPathRenderer* getPathRenderer(
533 const GrDrawTarget* target, 542 const GrDrawTarget* target,
534 const GrPipelineBuilder*, 543 const GrPipelineBuilder*,
535 const SkMatrix& viewMatrix, 544 const SkMatrix& viewMatrix,
536 const SkPath& path, 545 const SkPath& path,
537 const GrStrokeInfo& stroke, 546 const GrStrokeInfo& stroke,
538 bool allowSW, 547 bool allowSW,
539 GrPathRendererChain::DrawType drawType = GrPathRendererChain ::kColor_DrawType, 548 GrPathRendererChain::DrawType drawType = GrPathRendererChain ::kColor_DrawType,
540 GrPathRendererChain::StencilSupport* stencilSupport = NULL); 549 GrPathRendererChain::StencilSupport* stencilSupport = NULL);
541 550
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
542 /** Prints cache stats to the string if GR_CACHE_STATS == 1. */ 557 /** Prints cache stats to the string if GR_CACHE_STATS == 1. */
543 void dumpCacheStats(SkString*) const; 558 void dumpCacheStats(SkString*) const;
544 void printCacheStats() const; 559 void printCacheStats() const;
545 560
546 /** Prints GPU stats to the string if GR_GPU_STATS == 1. */ 561 /** Prints GPU stats to the string if GR_GPU_STATS == 1. */
547 void dumpGpuStats(SkString*) const; 562 void dumpGpuStats(SkString*) const;
548 void printGpuStats() const; 563 void printGpuStats() const;
549 564
550 private: 565 private:
551 GrGpu* fGpu; 566 GrGpu* fGpu;
(...skipping 25 matching lines...) Expand all
577 592
578 struct CleanUpData { 593 struct CleanUpData {
579 PFCleanUpFunc fFunc; 594 PFCleanUpFunc fFunc;
580 void* fInfo; 595 void* fInfo;
581 }; 596 };
582 597
583 SkTDArray<CleanUpData> fCleanUpData; 598 SkTDArray<CleanUpData> fCleanUpData;
584 599
585 int fMaxTextureSizeOverride; 600 int fMaxTextureSizeOverride;
586 601
602 const Options fOptions;
587 const uint32_t fUniqueID; 603 const uint32_t fUniqueID;
588 604
589 GrContext(); // init must be called after the constructor. 605 GrContext(const Options&); // init must be called after the constructor.
590 bool init(GrBackend, GrBackendContext, const GrContextOptions& options); 606 bool init(GrBackend, GrBackendContext);
591 void initMockContext(); 607 void initMockContext();
592 void initCommon(); 608 void initCommon();
593 609
594 class AutoCheckFlush; 610 class AutoCheckFlush;
595 // Sets the paint and returns the target to draw into. 611 // Sets the paint and returns the target to draw into.
596 GrDrawTarget* prepareToDraw(GrPipelineBuilder*, 612 GrDrawTarget* prepareToDraw(GrPipelineBuilder*,
597 GrRenderTarget* rt, 613 GrRenderTarget* rt,
598 const GrClip&, 614 const GrClip&,
599 const GrPaint* paint, 615 const GrPaint* paint,
600 const AutoCheckFlush*); 616 const AutoCheckFlush*);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
644 */ 660 */
645 static void TextBlobCacheOverBudgetCB(void* data); 661 static void TextBlobCacheOverBudgetCB(void* data);
646 662
647 // TODO see note on createTextContext 663 // TODO see note on createTextContext
648 friend class SkGpuDevice; 664 friend class SkGpuDevice;
649 665
650 typedef SkRefCnt INHERITED; 666 typedef SkRefCnt INHERITED;
651 }; 667 };
652 668
653 #endif 669 #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