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

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

Issue 1988923002: Remove GrRenderTarget from GrPipelineBuilder (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update to ToT Created 4 years, 6 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/GrDrawTarget.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 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 GrDrawTarget_DEFINED 8 #ifndef GrDrawTarget_DEFINED
9 #define GrDrawTarget_DEFINED 9 #define GrDrawTarget_DEFINED
10 10
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 * Draws path into the stencil buffer. The fill must be either even/odd or 110 * Draws path into the stencil buffer. The fill must be either even/odd or
111 * winding (not inverse or hairline). It will respect the HW antialias flag 111 * winding (not inverse or hairline). It will respect the HW antialias flag
112 * on the GrPipelineBuilder (if possible in the 3D API). Note, we will neve r have an inverse 112 * on the GrPipelineBuilder (if possible in the 3D API). Note, we will neve r have an inverse
113 * fill with stencil path 113 * fill with stencil path
114 */ 114 */
115 void stencilPath(const GrPipelineBuilder&, GrDrawContext*, 115 void stencilPath(const GrPipelineBuilder&, GrDrawContext*,
116 const GrClip&, const SkMatrix& viewMatrix, 116 const GrClip&, const SkMatrix& viewMatrix,
117 const GrPath*, GrPathRendering::FillType); 117 const GrPath*, GrPathRendering::FillType);
118 118
119 /** 119 /**
120 * Clear the passed in render target. Ignores the GrPipelineBuilder and clip . Clears the whole 120 * Clear the passed in drawContext. Ignores the GrPipelineBuilder and clip. Clears the whole
121 * thing if rect is nullptr, otherwise just the rect. If canIgnoreRect is se t then the entire 121 * thing if rect is nullptr, otherwise just the rect. If canIgnoreRect is se t then the entire
122 * render target can be optionally cleared. 122 * drawContext can be optionally cleared.
123 */ 123 */
124 void clear(const SkIRect* rect, 124 void clear(const SkIRect* rect,
125 GrColor color, 125 GrColor color,
126 bool canIgnoreRect, 126 bool canIgnoreRect,
127 GrDrawContext*); 127 GrDrawContext*);
128 128
129 /** Discards the contents render target. */ 129 /** Discards the contents render target. */
130 void discard(GrRenderTarget*); 130 void discard(GrRenderTarget*);
131 131
132 /** 132 /**
133 * Copies a pixel rectangle from one surface to another. This call may final ize 133 * Copies a pixel rectangle from one surface to another. This call may final ize
134 * reserved vertex/index data (as though a draw call was made). The src pixe ls 134 * reserved vertex/index data (as though a draw call was made). The src pixe ls
135 * copied are specified by srcRect. They are copied to a rect of the same 135 * copied are specified by srcRect. They are copied to a rect of the same
136 * size in dst with top left at dstPoint. If the src rect is clipped by the 136 * size in dst with top left at dstPoint. If the src rect is clipped by the
137 * src bounds then pixel values in the dst rect corresponding to area clipp ed 137 * src bounds then pixel values in the dst rect corresponding to area clipp ed
138 * by the src rect are not overwritten. This method is not guaranteed to suc ceed 138 * by the src rect are not overwritten. This method is not guaranteed to suc ceed
139 * depending on the type of surface, configs, etc, and the backend-specific 139 * depending on the type of surface, configs, etc, and the backend-specific
140 * limitations. 140 * limitations.
141 */ 141 */
142 bool copySurface(GrSurface* dst, 142 bool copySurface(GrSurface* dst,
143 GrSurface* src, 143 GrSurface* src,
144 const SkIRect& srcRect, 144 const SkIRect& srcRect,
145 const SkIPoint& dstPoint); 145 const SkIPoint& dstPoint);
146 146
147 /** Provides access to internal functions to GrClipMaskManager without frien ding all of
148 GrDrawTarget to CMM. */
149 class CMMAccess {
150 public:
151 CMMAccess(GrDrawTarget* drawTarget) : fDrawTarget(drawTarget) {}
152 private:
153 void clearStencilClip(const SkIRect& rect, bool insideClip, GrRenderTarg et* rt) const {
154 fDrawTarget->clearStencilClip(rect, insideClip, rt);
155 }
156
157 GrContext* context() const { return fDrawTarget->fContext; }
158 GrResourceProvider* resourceProvider() const { return fDrawTarget->fReso urceProvider; }
159 GrDrawTarget* fDrawTarget;
160 friend class GrClipMaskManager;
161 };
162
163 const CMMAccess cmmAccess() { return CMMAccess(this); }
164
165 GrAuditTrail* getAuditTrail() const { return fAuditTrail; }
166
167 private: 147 private:
168 friend class GrDrawingManager; // for resetFlag & TopoSortTraits 148 friend class GrDrawingManager; // for resetFlag & TopoSortTraits
169 friend class GrDrawContextPriv; // for clearStencilClip 149 friend class GrDrawContextPriv; // for clearStencilClip
170 150
171 enum Flags { 151 enum Flags {
172 kClosed_Flag = 0x01, //!< This drawTarget can't accept any more bat ches 152 kClosed_Flag = 0x01, //!< This drawTarget can't accept any more bat ches
173 153
174 kWasOutput_Flag = 0x02, //!< Flag for topological sorting 154 kWasOutput_Flag = 0x02, //!< Flag for topological sorting
175 kTempMark_Flag = 0x04, //!< Flag for topological sorting 155 kTempMark_Flag = 0x04, //!< Flag for topological sorting
176 }; 156 };
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 } 191 }
212 }; 192 };
213 193
214 void recordBatch(GrBatch*); 194 void recordBatch(GrBatch*);
215 void forwardCombine(); 195 void forwardCombine();
216 196
217 // Makes a copy of the dst if it is necessary for the draw. Returns false if a copy is required 197 // Makes a copy of the dst if it is necessary for the draw. Returns false if a copy is required
218 // but couldn't be made. Otherwise, returns true. This method needs to be p rotected because it 198 // but couldn't be made. Otherwise, returns true. This method needs to be p rotected because it
219 // needs to be accessed by GLPrograms to setup a correct drawstate 199 // needs to be accessed by GLPrograms to setup a correct drawstate
220 bool setupDstReadIfNecessary(const GrPipelineBuilder&, 200 bool setupDstReadIfNecessary(const GrPipelineBuilder&,
221 const GrClip&, 201 GrRenderTarget*,
222 const GrPipelineOptimizations& optimizations, 202 const GrClip&,
223 GrXferProcessor::DstTexture*, 203 const GrPipelineOptimizations& optimizations,
224 const SkRect& batchBounds); 204 GrXferProcessor::DstTexture*,
205 const SkRect& batchBounds);
225 206
226 void addDependency(GrDrawTarget* dependedOn); 207 void addDependency(GrDrawTarget* dependedOn);
227 208
228 // Used only by CMM. 209 // Used only by drawContextPriv.
229 void clearStencilClip(const SkIRect&, bool insideClip, GrRenderTarget*); 210 void clearStencilClip(const SkIRect&, bool insideClip, GrRenderTarget*);
230 211
231 SkSTArray<256, SkAutoTUnref<GrBatch>, true> fBatches; 212 SkSTArray<256, SkAutoTUnref<GrBatch>, true> fBatches;
232 // The context is only in service of the clip mask manager, remove once CMM doesn't need this. 213 // The context is only in service of the clip mask manager, remove once CMM doesn't need this.
233 GrContext* fContext; 214 GrContext* fContext;
234 GrGpu* fGpu; 215 GrGpu* fGpu;
235 GrResourceProvider* fResourceProvider; 216 GrResourceProvider* fResourceProvider;
236 GrAuditTrail* fAuditTrail; 217 GrAuditTrail* fAuditTrail;
237 218
238 SkDEBUGCODE(int fDebugID;) 219 SkDEBUGCODE(int fDebugID;)
239 uint32_t fFlags; 220 uint32_t fFlags;
240 221
241 // 'this' drawTarget relies on the output of the drawTargets in 'fDependenci es' 222 // 'this' drawTarget relies on the output of the drawTargets in 'fDependenci es'
242 SkTDArray<GrDrawTarget*> fDependencies; 223 SkTDArray<GrDrawTarget*> fDependencies;
243 GrRenderTarget* fRenderTarget; 224 GrRenderTarget* fRenderTarget;
244 225
245 bool fClipBatchToBounds; 226 bool fClipBatchToBounds;
246 bool fDrawBatchBounds; 227 bool fDrawBatchBounds;
247 int fMaxBatchLookback; 228 int fMaxBatchLookback;
248 int fMaxBatchLookahead; 229 int fMaxBatchLookahead;
249 230
250 typedef SkRefCnt INHERITED; 231 typedef SkRefCnt INHERITED;
251 }; 232 };
252 233
253 #endif 234 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrDrawContext.cpp ('k') | src/gpu/GrDrawTarget.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698