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 |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 // This timestamp is always older than the current timestamp | 284 // This timestamp is always older than the current timestamp |
285 static const ResetTimestamp kExpiredTimestamp = 0; | 285 static const ResetTimestamp kExpiredTimestamp = 0; |
286 // Returns a timestamp based on the number of times the context was reset. | 286 // Returns a timestamp based on the number of times the context was reset. |
287 // This timestamp can be used to lazily detect when cached 3D context state | 287 // This timestamp can be used to lazily detect when cached 3D context state |
288 // is dirty. | 288 // is dirty. |
289 ResetTimestamp getResetTimestamp() const { | 289 ResetTimestamp getResetTimestamp() const { |
290 return fResetTimestamp; | 290 return fResetTimestamp; |
291 } | 291 } |
292 | 292 |
293 /** | 293 /** |
294 * Can the provided configuration act as a color render target? | |
295 */ | |
296 bool isConfigRenderable(GrPixelConfig config) const { | |
297 SkASSERT(kGrPixelConfigCnt > config); | |
298 return fConfigRenderSupport[config]; | |
299 } | |
300 | |
301 /** | |
302 * These methods are called by the clip manager's setupClipping function | 294 * These methods are called by the clip manager's setupClipping function |
303 * which (called as part of GrGpu's implementation of onDraw and | 295 * which (called as part of GrGpu's implementation of onDraw and |
304 * onStencilPath member functions.) The GrGpu subclass should flush the | 296 * onStencilPath member functions.) The GrGpu subclass should flush the |
305 * stencil state to the 3D API in its implementation of flushGraphicsState. | 297 * stencil state to the 3D API in its implementation of flushGraphicsState. |
306 */ | 298 */ |
307 void enableScissor(const SkIRect& rect) { | 299 void enableScissor(const SkIRect& rect) { |
308 fScissorState.fEnabled = true; | 300 fScissorState.fEnabled = true; |
309 fScissorState.fRect = rect; | 301 fScissorState.fRect = rect; |
310 } | 302 } |
311 void disableScissor() { fScissorState.fEnabled = false; } | 303 void disableScissor() { fScissorState.fEnabled = false; } |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 | 386 |
395 // The state of the scissor is controlled by the clip manager | 387 // The state of the scissor is controlled by the clip manager |
396 struct ScissorState { | 388 struct ScissorState { |
397 bool fEnabled; | 389 bool fEnabled; |
398 SkIRect fRect; | 390 SkIRect fRect; |
399 } fScissorState; | 391 } fScissorState; |
400 | 392 |
401 // The final stencil settings to use as determined by the clip manager. | 393 // The final stencil settings to use as determined by the clip manager. |
402 GrStencilSettings fStencilSettings; | 394 GrStencilSettings fStencilSettings; |
403 | 395 |
404 // Derived classes need access to this so they can fill it out in their | |
405 // constructors | |
406 bool fConfigRenderSupport[kGrPixelConfigCnt]; | |
407 | |
408 // Helpers for setting up geometry state | 396 // Helpers for setting up geometry state |
409 void finalizeReservedVertices(); | 397 void finalizeReservedVertices(); |
410 void finalizeReservedIndices(); | 398 void finalizeReservedIndices(); |
411 | 399 |
412 private: | 400 private: |
413 // GrDrawTarget overrides | 401 // GrDrawTarget overrides |
414 virtual bool onReserveVertexSpace(size_t vertexSize, int vertexCount, void**
vertices) SK_OVERRIDE; | 402 virtual bool onReserveVertexSpace(size_t vertexSize, int vertexCount, void**
vertices) SK_OVERRIDE; |
415 virtual bool onReserveIndexSpace(int indexCount, void** indices) SK_OVERRIDE
; | 403 virtual bool onReserveIndexSpace(int indexCount, void** indices) SK_OVERRIDE
; |
416 virtual void releaseReservedVertexSpace() SK_OVERRIDE; | 404 virtual void releaseReservedVertexSpace() SK_OVERRIDE; |
417 virtual void releaseReservedIndexSpace() SK_OVERRIDE; | 405 virtual void releaseReservedIndexSpace() SK_OVERRIDE; |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
528 // these are mutable so they can be created on-demand | 516 // these are mutable so they can be created on-demand |
529 mutable GrIndexBuffer* fQuadInd
exBuffer; | 517 mutable GrIndexBuffer* fQuadInd
exBuffer; |
530 // Used to abandon/release all resources created by this GrGpu. TODO: Move t
his | 518 // Used to abandon/release all resources created by this GrGpu. TODO: Move t
his |
531 // functionality to GrResourceCache. | 519 // functionality to GrResourceCache. |
532 ResourceList fResourc
eList; | 520 ResourceList fResourc
eList; |
533 | 521 |
534 typedef GrDrawTarget INHERITED; | 522 typedef GrDrawTarget INHERITED; |
535 }; | 523 }; |
536 | 524 |
537 #endif | 525 #endif |
OLD | NEW |