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 "SkLayerInfo.h" | 8 #include "SkLayerInfo.h" |
9 #include "SkRecordDraw.h" | 9 #include "SkRecordDraw.h" |
10 #include "SkPatchUtils.h" | 10 #include "SkPatchUtils.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 return bitmap; | 79 return bitmap; |
80 } | 80 } |
81 | 81 |
82 // NoOps draw nothing. | 82 // NoOps draw nothing. |
83 template <> void Draw::draw(const NoOp&) {} | 83 template <> void Draw::draw(const NoOp&) {} |
84 | 84 |
85 #define DRAW(T, call) template <> void Draw::draw(const T& r) { fCanvas->call; } | 85 #define DRAW(T, call) template <> void Draw::draw(const T& r) { fCanvas->call; } |
86 DRAW(Restore, restore()); | 86 DRAW(Restore, restore()); |
87 DRAW(Save, save()); | 87 DRAW(Save, save()); |
88 DRAW(SaveLayer, saveLayer(r.bounds, r.paint, r.flags)); | 88 DRAW(SaveLayer, saveLayer(r.bounds, r.paint, r.flags)); |
89 DRAW(PopCull, popCull()); | |
90 DRAW(PushCull, pushCull(r.rect)); | |
91 DRAW(Clear, clear(r.color)); | 89 DRAW(Clear, clear(r.color)); |
92 DRAW(SetMatrix, setMatrix(SkMatrix::Concat(fInitialCTM, r.matrix))); | 90 DRAW(SetMatrix, setMatrix(SkMatrix::Concat(fInitialCTM, r.matrix))); |
93 | 91 |
94 DRAW(ClipPath, clipPath(r.path, r.opAA.op, r.opAA.aa)); | 92 DRAW(ClipPath, clipPath(r.path, r.opAA.op, r.opAA.aa)); |
95 DRAW(ClipRRect, clipRRect(r.rrect, r.opAA.op, r.opAA.aa)); | 93 DRAW(ClipRRect, clipRRect(r.rrect, r.opAA.op, r.opAA.aa)); |
96 DRAW(ClipRect, clipRect(r.rect, r.opAA.op, r.opAA.aa)); | 94 DRAW(ClipRect, clipRect(r.rect, r.opAA.op, r.opAA.aa)); |
97 DRAW(ClipRegion, clipRegion(r.region, r.op)); | 95 DRAW(ClipRegion, clipRegion(r.region, r.op)); |
98 | 96 |
99 DRAW(BeginCommentGroup, beginCommentGroup(r.description)); | 97 DRAW(BeginCommentGroup, beginCommentGroup(r.description)); |
100 DRAW(AddComment, addComment(r.key, r.value)); | 98 DRAW(AddComment, addComment(r.key, r.value)); |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 // from the bounds of the ops in the same Save block. | 282 // from the bounds of the ops in the same Save block. |
285 void trackBounds(const Save&) { this->pushSaveBlock(NULL); } | 283 void trackBounds(const Save&) { this->pushSaveBlock(NULL); } |
286 void trackBounds(const SaveLayer& op) { this->pushSaveBlock(op.paint); } | 284 void trackBounds(const SaveLayer& op) { this->pushSaveBlock(op.paint); } |
287 void trackBounds(const Restore&) { fBounds[fCurrentOp] = this->popSaveBlock(
); } | 285 void trackBounds(const Restore&) { fBounds[fCurrentOp] = this->popSaveBlock(
); } |
288 | 286 |
289 void trackBounds(const SetMatrix&) { this->pushControl(); } | 287 void trackBounds(const SetMatrix&) { this->pushControl(); } |
290 void trackBounds(const ClipRect&) { this->pushControl(); } | 288 void trackBounds(const ClipRect&) { this->pushControl(); } |
291 void trackBounds(const ClipRRect&) { this->pushControl(); } | 289 void trackBounds(const ClipRRect&) { this->pushControl(); } |
292 void trackBounds(const ClipPath&) { this->pushControl(); } | 290 void trackBounds(const ClipPath&) { this->pushControl(); } |
293 void trackBounds(const ClipRegion&) { this->pushControl(); } | 291 void trackBounds(const ClipRegion&) { this->pushControl(); } |
294 void trackBounds(const PushCull&) { this->pushControl(); } | |
295 void trackBounds(const PopCull&) { this->pushControl(); } | |
296 void trackBounds(const BeginCommentGroup&) { this->pushControl(); } | 292 void trackBounds(const BeginCommentGroup&) { this->pushControl(); } |
297 void trackBounds(const AddComment&) { this->pushControl(); } | 293 void trackBounds(const AddComment&) { this->pushControl(); } |
298 void trackBounds(const EndCommentGroup&) { this->pushControl(); } | 294 void trackBounds(const EndCommentGroup&) { this->pushControl(); } |
299 void trackBounds(const DrawData&) { this->pushControl(); } | 295 void trackBounds(const DrawData&) { this->pushControl(); } |
300 | 296 |
301 // For all other ops, we can calculate and store the bounds directly now. | 297 // For all other ops, we can calculate and store the bounds directly now. |
302 template <typename T> void trackBounds(const T& op) { | 298 template <typename T> void trackBounds(const T& op) { |
303 fBounds[fCurrentOp] = this->bounds(op); | 299 fBounds[fCurrentOp] = this->bounds(op); |
304 this->updateSaveBounds(fBounds[fCurrentOp]); | 300 this->updateSaveBounds(fBounds[fCurrentOp]); |
305 } | 301 } |
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
795 SkRecords::CollectLayers visitor(cullRect, record, pictList, data); | 791 SkRecords::CollectLayers visitor(cullRect, record, pictList, data); |
796 | 792 |
797 for (unsigned curOp = 0; curOp < record.count(); curOp++) { | 793 for (unsigned curOp = 0; curOp < record.count(); curOp++) { |
798 visitor.setCurrentOp(curOp); | 794 visitor.setCurrentOp(curOp); |
799 record.visit<void>(curOp, visitor); | 795 record.visit<void>(curOp, visitor); |
800 } | 796 } |
801 | 797 |
802 visitor.cleanUp(bbh); | 798 visitor.cleanUp(bbh); |
803 } | 799 } |
804 | 800 |
OLD | NEW |