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