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

Side by Side Diff: src/gpu/GrDrawingManager.h

Issue 1572653002: Reland of Make a single GrSingleOwner in GrContext (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 11 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 | « src/gpu/GrDrawContext.cpp ('k') | src/gpu/GrDrawingManager.cpp » ('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 2015 Google Inc. 2 * Copyright 2015 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 GrDrawingManager_DEFINED 8 #ifndef GrDrawingManager_DEFINED
9 #define GrDrawingManager_DEFINED 9 #define GrDrawingManager_DEFINED
10 10
11 #include "GrDrawTarget.h" 11 #include "GrDrawTarget.h"
12 #include "GrBatchFlushState.h" 12 #include "GrBatchFlushState.h"
13 #include "GrPathRendererChain.h" 13 #include "GrPathRendererChain.h"
14 #include "GrPathRenderer.h" 14 #include "GrPathRenderer.h"
15 #include "SkTDArray.h" 15 #include "SkTDArray.h"
16 16
17 class GrContext; 17 class GrContext;
18 class GrDrawContext; 18 class GrDrawContext;
19 class GrSingleOWner;
19 class GrSoftwarePathRenderer; 20 class GrSoftwarePathRenderer;
20 class GrTextContext; 21 class GrTextContext;
21 22
22 // Currently the DrawingManager creates a separate GrTextContext for each 23 // Currently the DrawingManager creates a separate GrTextContext for each
23 // combination of text drawing options (pixel geometry x DFT use) 24 // combination of text drawing options (pixel geometry x DFT use)
24 // and hands the appropriate one back given the DrawContext's request. 25 // and hands the appropriate one back given the DrawContext's request.
25 // 26 //
26 // It allocates a new GrDrawContext for each GrRenderTarget 27 // It allocates a new GrDrawContext for each GrRenderTarget
27 // but all of them still land in the same GrDrawTarget! 28 // but all of them still land in the same GrDrawTarget!
28 // 29 //
(...skipping 17 matching lines...) Expand all
46 GrContext* getContext() { return fContext; } 47 GrContext* getContext() { return fContext; }
47 48
48 GrPathRenderer* getPathRenderer(const GrPathRenderer::CanDrawPathArgs& args, 49 GrPathRenderer* getPathRenderer(const GrPathRenderer::CanDrawPathArgs& args,
49 bool allowSW, 50 bool allowSW,
50 GrPathRendererChain::DrawType drawType, 51 GrPathRendererChain::DrawType drawType,
51 GrPathRenderer::StencilSupport* stencilSuppo rt = NULL); 52 GrPathRenderer::StencilSupport* stencilSuppo rt = NULL);
52 53
53 static bool ProgramUnitTest(GrContext* context, int maxStages); 54 static bool ProgramUnitTest(GrContext* context, int maxStages);
54 55
55 private: 56 private:
56 GrDrawingManager(GrContext* context, const GrDrawTarget::Options& optionsFor DrawTargets) 57 GrDrawingManager(GrContext* context, const GrDrawTarget::Options& optionsFor DrawTargets,
58 GrSingleOwner* singleOwner)
57 : fContext(context) 59 : fContext(context)
58 , fOptionsForDrawTargets(optionsForDrawTargets) 60 , fOptionsForDrawTargets(optionsForDrawTargets)
61 , fSingleOwner(singleOwner)
59 , fAbandoned(false) 62 , fAbandoned(false)
60 , fNVPRTextContext(nullptr) 63 , fNVPRTextContext(nullptr)
61 , fPathRendererChain(nullptr) 64 , fPathRendererChain(nullptr)
62 , fSoftwarePathRenderer(nullptr) 65 , fSoftwarePathRenderer(nullptr)
63 , fFlushState(context->getGpu(), context->resourceProvider()) 66 , fFlushState(context->getGpu(), context->resourceProvider())
64 , fFlushing(false) { 67 , fFlushing(false) {
65 sk_bzero(fTextContexts, sizeof(fTextContexts)); 68 sk_bzero(fTextContexts, sizeof(fTextContexts));
66 } 69 }
67 70
68 void abandon(); 71 void abandon();
69 void cleanup(); 72 void cleanup();
70 void reset(); 73 void reset();
71 void flush(); 74 void flush();
72 75
73 friend class GrContext; // for access to: ctor, abandon, reset & flush 76 friend class GrContext; // for access to: ctor, abandon, reset & flush
74 77
75 static const int kNumPixelGeometries = 5; // The different pixel geometries 78 static const int kNumPixelGeometries = 5; // The different pixel geometries
76 static const int kNumDFTOptions = 2; // DFT or no DFT 79 static const int kNumDFTOptions = 2; // DFT or no DFT
77 80
78 GrContext* fContext; 81 GrContext* fContext;
79 GrDrawTarget::Options fOptionsForDrawTargets; 82 GrDrawTarget::Options fOptionsForDrawTargets;
80 83
84 // In debug builds we guard against improper thread handling
85 GrSingleOwner* fSingleOwner;
86
81 bool fAbandoned; 87 bool fAbandoned;
82 SkTDArray<GrDrawTarget*> fDrawTargets; 88 SkTDArray<GrDrawTarget*> fDrawTargets;
83 89
84 GrTextContext* fNVPRTextContext; 90 GrTextContext* fNVPRTextContext;
85 GrTextContext* fTextContexts[kNumPixelGeometries][kNumDFTOption s]; 91 GrTextContext* fTextContexts[kNumPixelGeometries][kNumDFTOption s];
86 92
87 GrPathRendererChain* fPathRendererChain; 93 GrPathRendererChain* fPathRendererChain;
88 GrSoftwarePathRenderer* fSoftwarePathRenderer; 94 GrSoftwarePathRenderer* fSoftwarePathRenderer;
89 95
90 GrBatchFlushState fFlushState; 96 GrBatchFlushState fFlushState;
91 bool fFlushing; 97 bool fFlushing;
92 }; 98 };
93 99
94 #endif 100 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrDrawContext.cpp ('k') | src/gpu/GrDrawingManager.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698