OLD | NEW |
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 GrDrawContext_DEFINED | 8 #ifndef GrDrawContext_DEFINED |
9 #define GrDrawContext_DEFINED | 9 #define GrDrawContext_DEFINED |
10 | 10 |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 const SkRect& dst); | 251 const SkRect& dst); |
252 | 252 |
253 /** | 253 /** |
254 * Draws a batch | 254 * Draws a batch |
255 * | 255 * |
256 * @param paint describes how to color pixels. | 256 * @param paint describes how to color pixels. |
257 * @param batch the batch to draw | 257 * @param batch the batch to draw |
258 */ | 258 */ |
259 void drawBatch(const GrClip&, const GrPaint&, GrDrawBatch*); | 259 void drawBatch(const GrClip&, const GrPaint&, GrDrawBatch*); |
260 | 260 |
261 /** | |
262 * Draws a path batch. This needs to be separate from drawBatch because we i
nstall path stencil | |
263 * settings late. | |
264 * | |
265 * TODO: Figure out a better model that allows us to roll this method into d
rawBatch. | |
266 */ | |
267 void drawPathBatch(const GrPipelineBuilder&, GrDrawPathBatchBase*); | |
268 | |
269 int width() const { return fRenderTarget->width(); } | 261 int width() const { return fRenderTarget->width(); } |
270 int height() const { return fRenderTarget->height(); } | 262 int height() const { return fRenderTarget->height(); } |
271 int numColorSamples() const { return fRenderTarget->numColorSamples(); } | 263 int numColorSamples() const { return fRenderTarget->numColorSamples(); } |
272 bool isGammaCorrect() const { return fSurfaceProps.isGammaCorrect(); } | 264 bool isGammaCorrect() const { return fSurfaceProps.isGammaCorrect(); } |
273 | 265 |
274 GrRenderTarget* accessRenderTarget() { return fRenderTarget.get(); } | 266 GrRenderTarget* accessRenderTarget() { return fRenderTarget.get(); } |
275 | 267 |
276 sk_sp<GrRenderTarget> renderTarget() { return fRenderTarget; } | 268 sk_sp<GrRenderTarget> renderTarget() { return fRenderTarget; } |
277 | 269 |
278 sk_sp<GrTexture> asTexture() { return sk_ref_sp(fRenderTarget->asTexture());
} | 270 sk_sp<GrTexture> asTexture() { return sk_ref_sp(fRenderTarget->asTexture());
} |
279 | 271 |
280 // Provides access to functions that aren't part of the public API. | 272 // Provides access to functions that aren't part of the public API. |
281 GrDrawContextPriv drawContextPriv(); | 273 GrDrawContextPriv drawContextPriv(); |
282 const GrDrawContextPriv drawContextPriv() const; | 274 const GrDrawContextPriv drawContextPriv() const; |
283 | 275 |
284 protected: | 276 protected: |
285 GrDrawContext(GrContext*, GrDrawingManager*, sk_sp<GrRenderTarget>, | 277 GrDrawContext(GrContext*, GrDrawingManager*, sk_sp<GrRenderTarget>, |
286 const SkSurfaceProps* surfaceProps, GrAuditTrail*, GrSingleOwn
er*); | 278 const SkSurfaceProps* surfaceProps, GrAuditTrail*, GrSingleOwn
er*); |
287 | 279 |
288 GrDrawingManager* drawingManager() { return fDrawingManager; } | 280 GrDrawingManager* drawingManager() { return fDrawingManager; } |
289 GrAuditTrail* auditTrail() { return fAuditTrail; } | 281 GrAuditTrail* auditTrail() { return fAuditTrail; } |
290 const SkSurfaceProps& surfaceProps() const { return fSurfaceProps; } | 282 const SkSurfaceProps& surfaceProps() const { return fSurfaceProps; } |
291 | 283 |
292 SkDEBUGCODE(GrSingleOwner* singleOwner() { return fSingleOwner; }) | 284 SkDEBUGCODE(GrSingleOwner* singleOwner() { return fSingleOwner; }) |
293 SkDEBUGCODE(void validate() const;) | 285 SkDEBUGCODE(void validate() const;) |
294 | 286 |
295 private: | 287 private: |
296 friend class GrAtlasTextBlob; // for access to drawBatch | 288 friend class GrAtlasTextBlob; // for access to drawBatch |
| 289 friend class GrStencilAndCoverTextContext; // for access to drawBatch |
297 friend class GrDrawingManager; // for ctor | 290 friend class GrDrawingManager; // for ctor |
298 friend class GrDrawContextPriv; | 291 friend class GrDrawContextPriv; |
299 | 292 |
300 bool drawFilledDRRect(const GrClip& clip, | 293 bool drawFilledDRRect(const GrClip& clip, |
301 const GrPaint& paint, | 294 const GrPaint& paint, |
302 const SkMatrix& viewMatrix, | 295 const SkMatrix& viewMatrix, |
303 const SkRRect& origOuter, | 296 const SkRRect& origOuter, |
304 const SkRRect& origInner); | 297 const SkRRect& origInner); |
305 | 298 |
306 GrDrawBatch* getFillRectBatch(const GrPaint& paint, | 299 GrDrawBatch* getFillRectBatch(const GrPaint& paint, |
(...skipping 22 matching lines...) Expand all Loading... |
329 GrContext* fContext; | 322 GrContext* fContext; |
330 | 323 |
331 SkSurfaceProps fSurfaceProps; | 324 SkSurfaceProps fSurfaceProps; |
332 GrAuditTrail* fAuditTrail; | 325 GrAuditTrail* fAuditTrail; |
333 | 326 |
334 // In debug builds we guard against improper thread handling | 327 // In debug builds we guard against improper thread handling |
335 SkDEBUGCODE(mutable GrSingleOwner* fSingleOwner;) | 328 SkDEBUGCODE(mutable GrSingleOwner* fSingleOwner;) |
336 }; | 329 }; |
337 | 330 |
338 #endif | 331 #endif |
OLD | NEW |