Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Side by Side Diff: src/core/SkLiteDL.cpp

Issue 2315283002: SkLiteDL: drawAsLayer() (Closed)
Patch Set: tweaks Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/core/SkLiteDL.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 }
OLDNEW
« no previous file with comments | « src/core/SkLiteDL.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698