| 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 "SkRefCnt.h" | 12 #include "SkRefCnt.h" |
| 13 #include "SkSurfaceProps.h" | 13 #include "SkSurfaceProps.h" |
| 14 | 14 |
| 15 class GrBatch; |
| 15 class GrClip; | 16 class GrClip; |
| 16 class GrContext; | 17 class GrContext; |
| 18 class GrDraw; |
| 17 class GrDrawBatch; | 19 class GrDrawBatch; |
| 18 class GrDrawTarget; | 20 class GrDrawTarget; |
| 19 class GrPaint; | 21 class GrPaint; |
| 20 class GrPathProcessor; | 22 class GrPathProcessor; |
| 21 class GrPathRangeDraw; | 23 class GrPathRangeDraw; |
| 22 class GrPipelineBuilder; | 24 class GrPipelineBuilder; |
| 23 class GrRenderTarget; | 25 class GrRenderTarget; |
| 24 class GrStrokeInfo; | 26 class GrStrokeInfo; |
| 25 class GrSurface; | 27 class GrSurface; |
| 26 class GrTextContext; | 28 class GrTextContext; |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 | 254 |
| 253 | 255 |
| 254 /** | 256 /** |
| 255 * Draws a batch | 257 * Draws a batch |
| 256 * | 258 * |
| 257 * @param paint describes how to color pixels. | 259 * @param paint describes how to color pixels. |
| 258 * @param batch the batch to draw | 260 * @param batch the batch to draw |
| 259 */ | 261 */ |
| 260 void drawBatch(GrRenderTarget*, const GrClip&, const GrPaint&, GrDrawBatch*)
; | 262 void drawBatch(GrRenderTarget*, const GrClip&, const GrPaint&, GrDrawBatch*)
; |
| 261 | 263 |
| 264 // This entry point is currently only used for text contexts and the experim
ental GrDraw |
| 265 void drawBatch(const GrPipelineBuilder& pipelineBuilder, GrDrawBatch* batch)
; |
| 266 |
| 267 // returns the last batch, or a null pointer if none is available. This is
so internal clients |
| 268 // can fast path batching |
| 269 GrBatch* lastBatch(); |
| 270 |
| 262 private: | 271 private: |
| 263 friend class GrAtlasTextContext; // for access to drawBatch | |
| 264 friend class GrContext; // for ctor | 272 friend class GrContext; // for ctor |
| 265 | 273 |
| 266 GrDrawContext(GrContext*, GrDrawTarget*, const SkSurfaceProps&); | 274 GrDrawContext(GrContext*, GrDrawTarget*, const SkSurfaceProps&); |
| 267 | 275 |
| 268 GrTextContext* createTextContext(GrRenderTarget*, const SkSurfaceProps&); | 276 GrTextContext* createTextContext(GrRenderTarget*, const SkSurfaceProps&); |
| 269 | 277 |
| 270 // Checks if the context has been abandoned and if the rendertarget is owned
by this context | 278 // Checks if the context has been abandoned and if the rendertarget is owned
by this context |
| 271 bool prepareToDraw(GrRenderTarget* rt); | 279 bool prepareToDraw(GrRenderTarget* rt); |
| 272 | 280 |
| 273 void internalDrawPath(GrDrawTarget*, | 281 void internalDrawPath(GrDrawTarget*, |
| 274 GrPipelineBuilder*, | 282 GrPipelineBuilder*, |
| 275 const SkMatrix& viewMatrix, | 283 const SkMatrix& viewMatrix, |
| 276 GrColor, | 284 GrColor, |
| 277 bool useAA, | 285 bool useAA, |
| 278 const SkPath&, | 286 const SkPath&, |
| 279 const GrStrokeInfo&); | 287 const GrStrokeInfo&); |
| 280 | 288 |
| 281 // This entry point allows the GrTextContext-derived classes to add their ba
tches to | |
| 282 // the drawTarget. | |
| 283 void drawBatch(GrPipelineBuilder* pipelineBuilder, GrDrawBatch* batch); | |
| 284 | |
| 285 GrContext* fContext; // owning context -> no ref | 289 GrContext* fContext; // owning context -> no ref |
| 286 GrDrawTarget* fDrawTarget; | 290 GrDrawTarget* fDrawTarget; |
| 287 GrTextContext* fTextContext; // lazily created | 291 GrTextContext* fTextContext; // lazily created |
| 288 | 292 |
| 289 SkSurfaceProps fSurfaceProps; | 293 SkSurfaceProps fSurfaceProps; |
| 290 }; | 294 }; |
| 291 | 295 |
| 292 #endif | 296 #endif |
| OLD | NEW |