| 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 |
| 11 #include "GrColor.h" | 11 #include "GrColor.h" |
| 12 #include "GrRenderTarget.h" | 12 #include "GrRenderTarget.h" |
| 13 #include "SkRefCnt.h" | 13 #include "SkRefCnt.h" |
| 14 #include "SkRegion.h" | |
| 15 #include "SkSurfaceProps.h" | 14 #include "SkSurfaceProps.h" |
| 16 #include "../private/GrSingleOwner.h" | 15 #include "../private/GrSingleOwner.h" |
| 17 | 16 |
| 18 class GrAtlasTextContext; | 17 class GrAtlasTextContext; |
| 19 class GrAuditTrail; | 18 class GrAuditTrail; |
| 20 class GrClip; | 19 class GrClip; |
| 21 class GrContext; | 20 class GrContext; |
| 22 class GrDrawBatch; | 21 class GrDrawBatch; |
| 23 class GrDrawContextPriv; | |
| 24 class GrDrawPathBatchBase; | 22 class GrDrawPathBatchBase; |
| 25 class GrDrawingManager; | 23 class GrDrawingManager; |
| 26 class GrDrawTarget; | 24 class GrDrawTarget; |
| 27 class GrPaint; | 25 class GrPaint; |
| 28 class GrPathProcessor; | 26 class GrPathProcessor; |
| 29 class GrPipelineBuilder; | 27 class GrPipelineBuilder; |
| 30 class GrRenderTarget; | 28 class GrRenderTarget; |
| 31 class GrStrokeInfo; | 29 class GrStrokeInfo; |
| 32 class GrSurface; | 30 class GrSurface; |
| 33 class SkDrawFilter; | 31 class SkDrawFilter; |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 * TODO: Figure out a better model that allows us to roll this method into d
rawBatch. | 270 * TODO: Figure out a better model that allows us to roll this method into d
rawBatch. |
| 273 */ | 271 */ |
| 274 void drawPathBatch(const GrPipelineBuilder&, GrDrawPathBatchBase*); | 272 void drawPathBatch(const GrPipelineBuilder&, GrDrawPathBatchBase*); |
| 275 | 273 |
| 276 int width() const { return fRenderTarget->width(); } | 274 int width() const { return fRenderTarget->width(); } |
| 277 int height() const { return fRenderTarget->height(); } | 275 int height() const { return fRenderTarget->height(); } |
| 278 int numColorSamples() const { return fRenderTarget->numColorSamples(); } | 276 int numColorSamples() const { return fRenderTarget->numColorSamples(); } |
| 279 | 277 |
| 280 GrRenderTarget* accessRenderTarget() { return fRenderTarget; } | 278 GrRenderTarget* accessRenderTarget() { return fRenderTarget; } |
| 281 | 279 |
| 282 // Provides access to functions that aren't part of the public API. | 280 ////////////////////////////////////////////////////////////////////////////
/////////////////// |
| 283 GrDrawContextPriv drawContextPriv(); | 281 // Functions intended for internal use only. |
| 284 const GrDrawContextPriv drawContextPriv() const; | 282 void internal_drawBatch(const GrPipelineBuilder& pipelineBuilder, GrDrawBatc
h* batch); |
| 285 | 283 |
| 286 protected: | 284 protected: |
| 287 GrDrawContext(GrContext*, GrDrawingManager*, GrRenderTarget*, | 285 GrDrawContext(GrContext*, GrDrawingManager*, GrRenderTarget*, |
| 288 const SkSurfaceProps* surfaceProps, GrAuditTrail*, GrSingleOwn
er*); | 286 const SkSurfaceProps* surfaceProps, GrAuditTrail*, GrSingleOwn
er*); |
| 289 | 287 |
| 290 GrDrawingManager* drawingManager() { return fDrawingManager; } | 288 GrDrawingManager* drawingManager() { return fDrawingManager; } |
| 291 GrAuditTrail* auditTrail() { return fAuditTrail; } | 289 GrAuditTrail* auditTrail() { return fAuditTrail; } |
| 292 const SkSurfaceProps& surfaceProps() const { return fSurfaceProps; } | 290 const SkSurfaceProps& surfaceProps() const { return fSurfaceProps; } |
| 293 | 291 |
| 294 SkDEBUGCODE(GrSingleOwner* singleOwner() { return fSingleOwner; }) | 292 SkDEBUGCODE(GrSingleOwner* singleOwner() { return fSingleOwner; }) |
| 295 SkDEBUGCODE(void validate() const;) | 293 SkDEBUGCODE(void validate() const;) |
| 296 | 294 |
| 297 private: | 295 private: |
| 298 friend class GrAtlasTextBlob; // for access to drawBatch | 296 friend class GrAtlasTextBlob; // for access to drawBatch |
| 299 friend class GrDrawingManager; // for ctor | 297 friend class GrDrawingManager; // for ctor |
| 300 friend class GrDrawContextPriv; | |
| 301 | 298 |
| 302 bool drawFilledDRRect(const GrClip& clip, | 299 bool drawFilledDRRect(const GrClip& clip, |
| 303 const GrPaint& paint, | 300 const GrPaint& paint, |
| 304 const SkMatrix& viewMatrix, | 301 const SkMatrix& viewMatrix, |
| 305 const SkRRect& origOuter, | 302 const SkRRect& origOuter, |
| 306 const SkRRect& origInner); | 303 const SkRRect& origInner); |
| 307 | 304 |
| 308 GrDrawBatch* getFillRectBatch(const GrPaint& paint, | |
| 309 const SkMatrix& viewMatrix, | |
| 310 const SkRect& rect); | |
| 311 | |
| 312 void internalDrawPath(const GrClip& clip, | 305 void internalDrawPath(const GrClip& clip, |
| 313 const GrPaint& paint, | 306 const GrPaint& paint, |
| 314 const SkMatrix& viewMatrix, | 307 const SkMatrix& viewMatrix, |
| 315 const SkPath& path, | 308 const SkPath& path, |
| 316 const GrStrokeInfo& strokeInfo); | 309 const GrStrokeInfo& strokeInfo); |
| 317 | 310 |
| 318 // This entry point allows the GrTextContext-derived classes to add their ba
tches to | 311 // This entry point allows the GrTextContext-derived classes to add their ba
tches to |
| 319 // the drawTarget. | 312 // the drawTarget. |
| 320 void drawBatch(GrPipelineBuilder* pipelineBuilder, GrDrawBatch* batch); | 313 void drawBatch(GrPipelineBuilder* pipelineBuilder, GrDrawBatch* batch); |
| 321 | 314 |
| 322 GrDrawTarget* getDrawTarget(); | 315 GrDrawTarget* getDrawTarget(); |
| 323 | 316 |
| 324 GrDrawingManager* fDrawingManager; | 317 GrDrawingManager* fDrawingManager; |
| 325 GrRenderTarget* fRenderTarget; | 318 GrRenderTarget* fRenderTarget; |
| 326 | 319 |
| 327 // In MDB-mode the drawTarget can be closed by some other drawContext that h
as picked | 320 // In MDB-mode the drawTarget can be closed by some other drawContext that h
as picked |
| 328 // it up. For this reason, the drawTarget should only ever be accessed via '
getDrawTarget'. | 321 // it up. For this reason, the drawTarget should only ever be accessed via '
getDrawTarget'. |
| 329 GrDrawTarget* fDrawTarget; | 322 GrDrawTarget* fDrawTarget; |
| 330 SkAutoTDelete<GrAtlasTextContext> fAtlasTextContext; | 323 SkAutoTDelete<GrAtlasTextContext> fAtlasTextContext; |
| 331 GrContext* fContext; | 324 GrContext* fContext; |
| 332 | 325 |
| 333 SkSurfaceProps fSurfaceProps; | 326 SkSurfaceProps fSurfaceProps; |
| 334 GrAuditTrail* fAuditTrail; | 327 GrAuditTrail* fAuditTrail; |
| 335 | 328 |
| 336 // In debug builds we guard against improper thread handling | 329 // In debug builds we guard against improper thread handling |
| 337 SkDEBUGCODE(mutable GrSingleOwner* fSingleOwner;) | 330 SkDEBUGCODE(mutable GrSingleOwner* fSingleOwner;) |
| 338 }; | 331 }; |
| 339 | 332 |
| 340 #endif | 333 #endif |
| OLD | NEW |