| 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 "SkRecordDraw.h" | 8 #include "SkRecordDraw.h" |
| 9 | 9 |
| 10 namespace { | 10 namespace { |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 SKIP(ClipRect); | 76 SKIP(ClipRect); |
| 77 SKIP(ClipRegion); | 77 SKIP(ClipRegion); |
| 78 #undef SKIP | 78 #undef SKIP |
| 79 | 79 |
| 80 // NoOps can always be skipped and draw nothing. | 80 // NoOps can always be skipped and draw nothing. |
| 81 template <> bool Draw::skip(const SkRecords::NoOp&) { return true; } | 81 template <> bool Draw::skip(const SkRecords::NoOp&) { return true; } |
| 82 template <> void Draw::draw(const SkRecords::NoOp&) {} | 82 template <> void Draw::draw(const SkRecords::NoOp&) {} |
| 83 | 83 |
| 84 #define DRAW(T, call) template <> void Draw::draw(const SkRecords::T& r) { fCanv
as->call; } | 84 #define DRAW(T, call) template <> void Draw::draw(const SkRecords::T& r) { fCanv
as->call; } |
| 85 DRAW(Restore, restore()); | 85 DRAW(Restore, restore()); |
| 86 #ifdef SK_SUPPORT_LEGACY_SAVEFLAGS |
| 86 DRAW(Save, save(r.flags)); | 87 DRAW(Save, save(r.flags)); |
| 87 DRAW(SaveLayer, saveLayer(r.bounds, r.paint, r.flags)); | 88 DRAW(SaveLayer, saveLayer(r.bounds, r.paint, r.flags)); |
| 89 #else |
| 90 DRAW(Save, save()); |
| 91 DRAW(SaveLayer, saveLayer(r.bounds, r.paint)); |
| 92 #endif |
| 88 DRAW(PopCull, popCull()); | 93 DRAW(PopCull, popCull()); |
| 89 DRAW(PushCull, pushCull(r.rect)); | 94 DRAW(PushCull, pushCull(r.rect)); |
| 90 DRAW(Clear, clear(r.color)); | 95 DRAW(Clear, clear(r.color)); |
| 91 DRAW(Concat, concat(r.matrix)); | 96 DRAW(Concat, concat(r.matrix)); |
| 92 DRAW(SetMatrix, setMatrix(r.matrix)); | 97 DRAW(SetMatrix, setMatrix(r.matrix)); |
| 93 | 98 |
| 94 DRAW(ClipPath, clipPath(r.path, r.op, r.doAA)); | 99 DRAW(ClipPath, clipPath(r.path, r.op, r.doAA)); |
| 95 DRAW(ClipRRect, clipRRect(r.rrect, r.op, r.doAA)); | 100 DRAW(ClipRRect, clipRRect(r.rrect, r.op, r.doAA)); |
| 96 DRAW(ClipRect, clipRect(r.rect, r.op, r.doAA)); | 101 DRAW(ClipRect, clipRect(r.rect, r.op, r.doAA)); |
| 97 DRAW(ClipRegion, clipRegion(r.region, r.op)); | 102 DRAW(ClipRegion, clipRegion(r.region, r.op)); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 DRAW(BoundedDrawPosTextH); | 141 DRAW(BoundedDrawPosTextH); |
| 137 #undef DRAW | 142 #undef DRAW |
| 138 | 143 |
| 139 } // namespace | 144 } // namespace |
| 140 | 145 |
| 141 void SkRecordDraw(const SkRecord& record, SkCanvas* canvas) { | 146 void SkRecordDraw(const SkRecord& record, SkCanvas* canvas) { |
| 142 for (Draw draw(canvas); draw.index() < record.count(); draw.next()) { | 147 for (Draw draw(canvas); draw.index() < record.count(); draw.next()) { |
| 143 record.visit(draw.index(), draw); | 148 record.visit(draw.index(), draw); |
| 144 } | 149 } |
| 145 } | 150 } |
| OLD | NEW |