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