OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 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 "SkCanvas.h" | 8 #include "SkCanvas.h" |
9 #include "SkData.h" | 9 #include "SkData.h" |
10 #include "SkDrawFilter.h" | 10 #include "SkDrawFilter.h" |
(...skipping 798 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
809 } | 809 } |
810 | 810 |
811 void SkLiteDL::reset(SkRect bounds) { | 811 void SkLiteDL::reset(SkRect bounds) { |
812 SkASSERT(this->unique()); | 812 SkASSERT(this->unique()); |
813 this->map(dtor_fns); | 813 this->map(dtor_fns); |
814 | 814 |
815 // Leave fBytes and fReserved alone. | 815 // Leave fBytes and fReserved alone. |
816 fUsed = 0; | 816 fUsed = 0; |
817 fBounds = bounds; | 817 fBounds = bounds; |
818 } | 818 } |
| 819 |
| 820 void SkLiteDL::drawAsLayer(SkCanvas* canvas, const SkMatrix* matrix, const SkPai
nt* paint) { |
| 821 auto fallback_plan = [&] { |
| 822 SkRect bounds = this->getBounds(); |
| 823 canvas->saveLayer(&bounds, paint); |
| 824 this->draw(canvas, matrix); |
| 825 canvas->restore(); |
| 826 }; |
| 827 |
| 828 // TODO: single-draw specializations |
| 829 |
| 830 return fallback_plan(); |
| 831 } |
OLD | NEW |