| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 #include "SkRecordOpts.h" | 8 #include "SkRecordOpts.h" |
| 9 | 9 |
| 10 #include "SkRecords.h" | 10 #include "SkRecords.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 bool changed() const { return fChanged; } | 51 bool changed() const { return fChanged; } |
| 52 | 52 |
| 53 private: | 53 private: |
| 54 static const unsigned kInactive = ~0; | 54 static const unsigned kInactive = ~0; |
| 55 unsigned fSave; | 55 unsigned fSave; |
| 56 bool fChanged; | 56 bool fChanged; |
| 57 }; | 57 }; |
| 58 | 58 |
| 59 // If the command doesn't draw anything, that doesn't reset the state back to in
active. | 59 // If the command doesn't draw anything, that doesn't reset the state back to in
active. |
| 60 // TODO(mtklein): do this with some sort of template-based trait mechanism inste
ad of macros | 60 // TODO(mtklein): do this with some sort of template-based trait mechanism inste
ad of macros |
| 61 #define IGNORE(T) template <> void SaveRestoreNooper::operator()(SkRecords::T*)
{} | 61 #define DOESNT_DRAW(T) template <> void SaveRestoreNooper::operator()(SkRecords:
:T*) {} |
| 62 IGNORE(NoOp) | 62 DOESNT_DRAW(NoOp) |
| 63 IGNORE(Concat) | 63 DOESNT_DRAW(Concat) |
| 64 IGNORE(SetMatrix) | 64 DOESNT_DRAW(SetMatrix) |
| 65 IGNORE(ClipRect) | 65 DOESNT_DRAW(ClipRect) |
| 66 IGNORE(ClipRRect) | 66 DOESNT_DRAW(ClipRRect) |
| 67 IGNORE(ClipPath) | 67 DOESNT_DRAW(ClipPath) |
| 68 IGNORE(ClipRegion) | 68 DOESNT_DRAW(ClipRegion) |
| 69 IGNORE(PairedPushCull) | 69 DOESNT_DRAW(PairedPushCull) |
| 70 IGNORE(PushCull) | 70 DOESNT_DRAW(PushCull) |
| 71 IGNORE(PopCull) | 71 DOESNT_DRAW(PopCull) |
| 72 #undef CLIP | 72 #undef DOESNT_DRAW |
| 73 | 73 |
| 74 template <> | 74 template <> |
| 75 void SaveRestoreNooper::operator()(SkRecords::Save* r) { | 75 void SaveRestoreNooper::operator()(SkRecords::Save* r) { |
| 76 fSave = SkCanvas::kMatrixClip_SaveFlag == r->flags ? this->index() : kInacti
ve; | 76 fSave = SkCanvas::kMatrixClip_SaveFlag == r->flags ? this->index() : kInacti
ve; |
| 77 } | 77 } |
| 78 | 78 |
| 79 template <> | 79 template <> |
| 80 void SaveRestoreNooper::operator()(SkRecords::Restore* r) { | 80 void SaveRestoreNooper::operator()(SkRecords::Restore* r) { |
| 81 if (fSave != kInactive) { | 81 if (fSave != kInactive) { |
| 82 // Remove everything between the save and restore, inclusive on both sid
es. | 82 // Remove everything between the save and restore, inclusive on both sid
es. |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 StrengthReducer reducer(record); | 237 StrengthReducer reducer(record); |
| 238 run_pass(reducer, record); | 238 run_pass(reducer, record); |
| 239 } | 239 } |
| 240 | 240 |
| 241 void SkRecordBoundDrawPosTextH(SkRecord* record) { | 241 void SkRecordBoundDrawPosTextH(SkRecord* record) { |
| 242 TextBounder bounder(record); | 242 TextBounder bounder(record); |
| 243 run_pass(bounder, record); | 243 run_pass(bounder, record); |
| 244 } | 244 } |
| 245 | 245 |
| 246 #undef REPLACE | 246 #undef REPLACE |
| OLD | NEW |