| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 GrGpu_DEFINED | 8 #ifndef GrGpu_DEFINED |
| 9 #define GrGpu_DEFINED | 9 #define GrGpu_DEFINED |
| 10 | 10 |
| 11 #include "GrDrawTarget.h" | 11 #include "GrDrawTarget.h" |
| 12 #include "GrClipMaskManager.h" | |
| 13 #include "GrPathRendering.h" | 12 #include "GrPathRendering.h" |
| 14 #include "SkPath.h" | 13 #include "SkPath.h" |
| 15 | 14 |
| 16 class GrContext; | 15 class GrContext; |
| 17 class GrIndexBufferAllocPool; | 16 class GrIndexBufferAllocPool; |
| 18 class GrPath; | 17 class GrPath; |
| 19 class GrPathRange; | 18 class GrPathRange; |
| 20 class GrPathRenderer; | 19 class GrPathRenderer; |
| 21 class GrPathRendererChain; | 20 class GrPathRendererChain; |
| 22 class GrStencilBuffer; | 21 class GrStencilBuffer; |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 | 290 |
| 292 // This timestamp is always older than the current timestamp | 291 // This timestamp is always older than the current timestamp |
| 293 static const ResetTimestamp kExpiredTimestamp = 0; | 292 static const ResetTimestamp kExpiredTimestamp = 0; |
| 294 // Returns a timestamp based on the number of times the context was reset. | 293 // Returns a timestamp based on the number of times the context was reset. |
| 295 // This timestamp can be used to lazily detect when cached 3D context state | 294 // This timestamp can be used to lazily detect when cached 3D context state |
| 296 // is dirty. | 295 // is dirty. |
| 297 ResetTimestamp getResetTimestamp() const { | 296 ResetTimestamp getResetTimestamp() const { |
| 298 return fResetTimestamp; | 297 return fResetTimestamp; |
| 299 } | 298 } |
| 300 | 299 |
| 301 enum PrivateDrawStateStateBits { | |
| 302 kFirstBit = (GrDrawState::kLastPublicStateBit << 1), | |
| 303 | |
| 304 kModifyStencilClip_StateBit = kFirstBit, // allows draws to modify | |
| 305 // stencil bits used for | |
| 306 // clipping. | |
| 307 }; | |
| 308 | |
| 309 void getPathStencilSettingsForFillType(SkPath::FillType fill, GrStencilSetti
ngs* outStencilSettings); | |
| 310 | |
| 311 enum DrawType { | 300 enum DrawType { |
| 312 kDrawPoints_DrawType, | 301 kDrawPoints_DrawType, |
| 313 kDrawLines_DrawType, | 302 kDrawLines_DrawType, |
| 314 kDrawTriangles_DrawType, | 303 kDrawTriangles_DrawType, |
| 315 kStencilPath_DrawType, | 304 kStencilPath_DrawType, |
| 316 kDrawPath_DrawType, | 305 kDrawPath_DrawType, |
| 317 kDrawPaths_DrawType, | 306 kDrawPaths_DrawType, |
| 318 }; | 307 }; |
| 319 | 308 |
| 320 static bool IsPathRenderingDrawType(DrawType type) { | 309 static bool IsPathRenderingDrawType(DrawType type) { |
| (...skipping 30 matching lines...) Expand all Loading... |
| 351 // stencil funcs supported by GPUs. | 340 // stencil funcs supported by GPUs. |
| 352 static GrStencilFunc ConvertStencilFunc(bool stencilInClip, | 341 static GrStencilFunc ConvertStencilFunc(bool stencilInClip, |
| 353 GrStencilFunc func); | 342 GrStencilFunc func); |
| 354 static void ConvertStencilFuncAndMask(GrStencilFunc func, | 343 static void ConvertStencilFuncAndMask(GrStencilFunc func, |
| 355 bool clipInStencil, | 344 bool clipInStencil, |
| 356 unsigned int clipBit, | 345 unsigned int clipBit, |
| 357 unsigned int userBits, | 346 unsigned int userBits, |
| 358 unsigned int* ref, | 347 unsigned int* ref, |
| 359 unsigned int* mask); | 348 unsigned int* mask); |
| 360 | 349 |
| 361 GrClipMaskManager fClipMaskManager; | |
| 362 | |
| 363 GrContext::GPUStats fGPUStats; | 350 GrContext::GPUStats fGPUStats; |
| 364 | 351 |
| 365 struct GeometryPoolState { | 352 struct GeometryPoolState { |
| 366 const GrVertexBuffer* fPoolVertexBuffer; | 353 const GrVertexBuffer* fPoolVertexBuffer; |
| 367 int fPoolStartVertex; | 354 int fPoolStartVertex; |
| 368 | 355 |
| 369 const GrIndexBuffer* fPoolIndexBuffer; | 356 const GrIndexBuffer* fPoolIndexBuffer; |
| 370 int fPoolStartIndex; | 357 int fPoolStartIndex; |
| 371 }; | 358 }; |
| 372 const GeometryPoolState& getGeomPoolState() { | 359 const GeometryPoolState& getGeomPoolState() { |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 503 // counts number of uses of vertex/index pool in the geometry stack | 490 // counts number of uses of vertex/index pool in the geometry stack |
| 504 int fVertexP
oolUseCnt; | 491 int fVertexP
oolUseCnt; |
| 505 int fIndexPo
olUseCnt; | 492 int fIndexPo
olUseCnt; |
| 506 // these are mutable so they can be created on-demand | 493 // these are mutable so they can be created on-demand |
| 507 mutable GrIndexBuffer* fQuadInd
exBuffer; | 494 mutable GrIndexBuffer* fQuadInd
exBuffer; |
| 508 | 495 |
| 509 typedef GrClipTarget INHERITED; | 496 typedef GrClipTarget INHERITED; |
| 510 }; | 497 }; |
| 511 | 498 |
| 512 #endif | 499 #endif |
| OLD | NEW |