| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 #ifndef SKDRAWCOMMAND_H_ | 9 #ifndef SKDRAWCOMMAND_H_ |
| 10 #define SKDRAWCOMMAND_H_ | 10 #define SKDRAWCOMMAND_H_ |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 void setVisible(bool toggle) { | 35 void setVisible(bool toggle) { |
| 36 fVisible = toggle; | 36 fVisible = toggle; |
| 37 } | 37 } |
| 38 | 38 |
| 39 const SkTDArray<SkString*>* Info() const { return &fInfo; } | 39 const SkTDArray<SkString*>* Info() const { return &fInfo; } |
| 40 virtual void execute(SkCanvas*) const = 0; | 40 virtual void execute(SkCanvas*) const = 0; |
| 41 virtual void vizExecute(SkCanvas*) const {} | 41 virtual void vizExecute(SkCanvas*) const {} |
| 42 | 42 |
| 43 virtual void setUserMatrix(const SkMatrix&) {} | 43 virtual void setUserMatrix(const SkMatrix&) {} |
| 44 | 44 |
| 45 /** Does nothing by default, but used by save() and restore()-type | |
| 46 subclasses to track unresolved save() calls. */ | |
| 47 virtual void trackSaveState(int* state) {} | |
| 48 | |
| 49 // The next "active" system is only used by save, saveLayer, and restore. | 45 // The next "active" system is only used by save, saveLayer, and restore. |
| 50 // It is used to determine which saveLayers are currently active (at a | 46 // It is used to determine which saveLayers are currently active (at a |
| 51 // given point in the rendering). | 47 // given point in the rendering). |
| 52 // saves just return a kPushLayer action but don't track active state | 48 // saves just return a kPushLayer action but don't track active state |
| 53 // restores just return a kPopLayer action | 49 // restores just return a kPopLayer action |
| 54 // saveLayers return kPushLayer but also track the active state | 50 // saveLayers return kPushLayer but also track the active state |
| 55 enum Action { | 51 enum Action { |
| 56 kNone_Action, | 52 kNone_Action, |
| 57 kPopLayer_Action, | 53 kPopLayer_Action, |
| 58 kPushLayer_Action, | 54 kPushLayer_Action, |
| (...skipping 14 matching lines...) Expand all Loading... |
| 73 private: | 69 private: |
| 74 DrawType fDrawType; | 70 DrawType fDrawType; |
| 75 size_t fOffset; | 71 size_t fOffset; |
| 76 bool fVisible; | 72 bool fVisible; |
| 77 }; | 73 }; |
| 78 | 74 |
| 79 class SkRestoreCommand : public SkDrawCommand { | 75 class SkRestoreCommand : public SkDrawCommand { |
| 80 public: | 76 public: |
| 81 SkRestoreCommand(); | 77 SkRestoreCommand(); |
| 82 void execute(SkCanvas* canvas) const SK_OVERRIDE; | 78 void execute(SkCanvas* canvas) const SK_OVERRIDE; |
| 83 void trackSaveState(int* state) SK_OVERRIDE; | |
| 84 Action action() const SK_OVERRIDE { return kPopLayer_Action; } | 79 Action action() const SK_OVERRIDE { return kPopLayer_Action; } |
| 85 | 80 |
| 86 private: | 81 private: |
| 87 typedef SkDrawCommand INHERITED; | 82 typedef SkDrawCommand INHERITED; |
| 88 }; | 83 }; |
| 89 | 84 |
| 90 class SkClearCommand : public SkDrawCommand { | 85 class SkClearCommand : public SkDrawCommand { |
| 91 public: | 86 public: |
| 92 SkClearCommand(SkColor color); | 87 SkClearCommand(SkColor color); |
| 93 void execute(SkCanvas* canvas) const SK_OVERRIDE; | 88 void execute(SkCanvas* canvas) const SK_OVERRIDE; |
| (...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 504 private: | 499 private: |
| 505 SkScalar fDegrees; | 500 SkScalar fDegrees; |
| 506 | 501 |
| 507 typedef SkDrawCommand INHERITED; | 502 typedef SkDrawCommand INHERITED; |
| 508 }; | 503 }; |
| 509 | 504 |
| 510 class SkSaveCommand : public SkDrawCommand { | 505 class SkSaveCommand : public SkDrawCommand { |
| 511 public: | 506 public: |
| 512 SkSaveCommand(); | 507 SkSaveCommand(); |
| 513 void execute(SkCanvas* canvas) const SK_OVERRIDE; | 508 void execute(SkCanvas* canvas) const SK_OVERRIDE; |
| 514 void trackSaveState(int* state) SK_OVERRIDE; | |
| 515 Action action() const SK_OVERRIDE { return kPushLayer_Action; } | 509 Action action() const SK_OVERRIDE { return kPushLayer_Action; } |
| 516 private: | 510 private: |
| 517 typedef SkDrawCommand INHERITED; | 511 typedef SkDrawCommand INHERITED; |
| 518 }; | 512 }; |
| 519 | 513 |
| 520 class SkSaveLayerCommand : public SkDrawCommand { | 514 class SkSaveLayerCommand : public SkDrawCommand { |
| 521 public: | 515 public: |
| 522 SkSaveLayerCommand(const SkRect* bounds, const SkPaint* paint, | 516 SkSaveLayerCommand(const SkRect* bounds, const SkPaint* paint, |
| 523 SkCanvas::SaveFlags flags); | 517 SkCanvas::SaveFlags flags); |
| 524 void execute(SkCanvas* canvas) const SK_OVERRIDE; | 518 void execute(SkCanvas* canvas) const SK_OVERRIDE; |
| 525 void vizExecute(SkCanvas* canvas) const SK_OVERRIDE; | 519 void vizExecute(SkCanvas* canvas) const SK_OVERRIDE; |
| 526 void trackSaveState(int* state) SK_OVERRIDE; | |
| 527 Action action() const SK_OVERRIDE{ return kPushLayer_Action; } | 520 Action action() const SK_OVERRIDE{ return kPushLayer_Action; } |
| 528 void setActive(bool active) SK_OVERRIDE { fActive = active; } | 521 void setActive(bool active) SK_OVERRIDE { fActive = active; } |
| 529 bool active() const SK_OVERRIDE { return fActive; } | 522 bool active() const SK_OVERRIDE { return fActive; } |
| 530 | 523 |
| 531 const SkPaint* paint() const { return fPaintPtr; } | 524 const SkPaint* paint() const { return fPaintPtr; } |
| 532 | 525 |
| 533 private: | 526 private: |
| 534 SkRect fBounds; | 527 SkRect fBounds; |
| 535 SkPaint fPaint; | 528 SkPaint fPaint; |
| 536 SkPaint* fPaintPtr; | 529 SkPaint* fPaintPtr; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 588 SkScalar y() const { return fDy; } | 581 SkScalar y() const { return fDy; } |
| 589 | 582 |
| 590 private: | 583 private: |
| 591 SkScalar fDx; | 584 SkScalar fDx; |
| 592 SkScalar fDy; | 585 SkScalar fDy; |
| 593 | 586 |
| 594 typedef SkDrawCommand INHERITED; | 587 typedef SkDrawCommand INHERITED; |
| 595 }; | 588 }; |
| 596 | 589 |
| 597 #endif | 590 #endif |
| OLD | NEW |