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 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 static void ElevateDrawPreference(GrGpu::DrawPreference* preference, | 404 static void ElevateDrawPreference(GrGpu::DrawPreference* preference, |
405 GrGpu::DrawPreference elevation) { | 405 GrGpu::DrawPreference elevation) { |
406 GR_STATIC_ASSERT(GrGpu::kCallerPrefersDraw_DrawPreference > GrGpu::kNoDr
aw_DrawPreference); | 406 GR_STATIC_ASSERT(GrGpu::kCallerPrefersDraw_DrawPreference > GrGpu::kNoDr
aw_DrawPreference); |
407 GR_STATIC_ASSERT(GrGpu::kGpuPrefersDraw_DrawPreference > | 407 GR_STATIC_ASSERT(GrGpu::kGpuPrefersDraw_DrawPreference > |
408 GrGpu::kCallerPrefersDraw_DrawPreference); | 408 GrGpu::kCallerPrefersDraw_DrawPreference); |
409 GR_STATIC_ASSERT(GrGpu::kRequireDraw_DrawPreference > | 409 GR_STATIC_ASSERT(GrGpu::kRequireDraw_DrawPreference > |
410 GrGpu::kGpuPrefersDraw_DrawPreference); | 410 GrGpu::kGpuPrefersDraw_DrawPreference); |
411 *preference = SkTMax(*preference, elevation); | 411 *preference = SkTMax(*preference, elevation); |
412 } | 412 } |
413 | 413 |
| 414 void handleDirtyContext() { |
| 415 if (fResetBits) { |
| 416 this->resetContext(); |
| 417 } |
| 418 } |
| 419 |
414 Stats fStats; | 420 Stats fStats; |
415 SkAutoTDelete<GrPathRendering> fPathRendering; | 421 SkAutoTDelete<GrPathRendering> fPathRendering; |
416 // Subclass must initialize this in its constructor. | 422 // Subclass must initialize this in its constructor. |
417 SkAutoTUnref<const GrCaps> fCaps; | 423 SkAutoTUnref<const GrCaps> fCaps; |
418 | 424 |
419 private: | 425 private: |
420 // called when the 3D context state is unknown. Subclass should emit any | 426 // called when the 3D context state is unknown. Subclass should emit any |
421 // assumed 3D context state and dirty any state cache. | 427 // assumed 3D context state and dirty any state cache. |
422 virtual void onResetContext(uint32_t resetBits) = 0; | 428 virtual void onResetContext(uint32_t resetBits) = 0; |
423 | 429 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
479 GrSurface* src, | 485 GrSurface* src, |
480 const SkIRect& srcRect, | 486 const SkIRect& srcRect, |
481 const SkIPoint& dstPoint) = 0; | 487 const SkIPoint& dstPoint) = 0; |
482 | 488 |
483 void resetContext() { | 489 void resetContext() { |
484 this->onResetContext(fResetBits); | 490 this->onResetContext(fResetBits); |
485 fResetBits = 0; | 491 fResetBits = 0; |
486 ++fResetTimestamp; | 492 ++fResetTimestamp; |
487 } | 493 } |
488 | 494 |
489 void handleDirtyContext() { | |
490 if (fResetBits) { | |
491 this->resetContext(); | |
492 } | |
493 } | |
494 | |
495 ResetTimestamp fResetTi
mestamp; | 495 ResetTimestamp fResetTi
mestamp; |
496 uint32_t fResetBi
ts; | 496 uint32_t fResetBi
ts; |
497 // The context owns us, not vice-versa, so this ptr is not ref'ed by Gpu. | 497 // The context owns us, not vice-versa, so this ptr is not ref'ed by Gpu. |
498 GrContext* fContext
; | 498 GrContext* fContext
; |
499 | 499 |
500 friend class GrPathRendering; | 500 friend class GrPathRendering; |
501 typedef SkRefCnt INHERITED; | 501 typedef SkRefCnt INHERITED; |
502 }; | 502 }; |
503 | 503 |
504 #endif | 504 #endif |
OLD | NEW |