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

Side by Side Diff: src/utils/SkNWayCanvas.cpp

Issue 194713008: De-virtualize SkCanvas save/restore. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Rebased Created 6 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « src/utils/SkLuaCanvas.cpp ('k') | src/utils/SkNoSaveLayerCanvas.h » ('j') | 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 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 #include "SkNWayCanvas.h" 8 #include "SkNWayCanvas.h"
9 9
10 SkNWayCanvas::SkNWayCanvas(int width, int height) 10 SkNWayCanvas::SkNWayCanvas(int width, int height)
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 return false; 50 return false;
51 } 51 }
52 SkCanvas* operator->() { return fCanvas; } 52 SkCanvas* operator->() { return fCanvas; }
53 53
54 private: 54 private:
55 const SkTDArray<SkCanvas*>& fList; 55 const SkTDArray<SkCanvas*>& fList;
56 int fIndex; 56 int fIndex;
57 SkCanvas* fCanvas; 57 SkCanvas* fCanvas;
58 }; 58 };
59 59
60 int SkNWayCanvas::save(SaveFlags flags) { 60 void SkNWayCanvas::willSave(SaveFlags flags) {
61 Iter iter(fList); 61 Iter iter(fList);
62 while (iter.next()) { 62 while (iter.next()) {
63 iter->save(flags); 63 iter->save(flags);
64 } 64 }
65 return this->INHERITED::save(flags); 65
66 this->INHERITED::willSave(flags);
66 } 67 }
67 68
68 int SkNWayCanvas::saveLayer(const SkRect* bounds, const SkPaint* paint, 69 SkCanvas::SaveLayerStrategy SkNWayCanvas::willSaveLayer(const SkRect* bounds, co nst SkPaint* paint,
69 SaveFlags flags) { 70 SaveFlags flags) {
70 Iter iter(fList); 71 Iter iter(fList);
71 while (iter.next()) { 72 while (iter.next()) {
72 iter->saveLayer(bounds, paint, flags); 73 iter->saveLayer(bounds, paint, flags);
73 } 74 }
74 return this->INHERITED::saveLayer(bounds, paint, flags); 75
76 this->INHERITED::willSaveLayer(bounds, paint, flags);
77 // No need for a layer.
78 return kNoLayer_SaveLayerStrategy;
75 } 79 }
76 80
77 void SkNWayCanvas::restore() { 81 void SkNWayCanvas::willRestore() {
78 Iter iter(fList); 82 Iter iter(fList);
79 while (iter.next()) { 83 while (iter.next()) {
80 iter->restore(); 84 iter->restore();
81 } 85 }
82 this->INHERITED::restore(); 86 this->INHERITED::willRestore();
83 } 87 }
84 88
85 bool SkNWayCanvas::translate(SkScalar dx, SkScalar dy) { 89 bool SkNWayCanvas::translate(SkScalar dx, SkScalar dy) {
86 Iter iter(fList); 90 Iter iter(fList);
87 while (iter.next()) { 91 while (iter.next()) {
88 iter->translate(dx, dy); 92 iter->translate(dx, dy);
89 } 93 }
90 return this->INHERITED::translate(dx, dy); 94 return this->INHERITED::translate(dx, dy);
91 } 95 }
92 96
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 iter->addComment(kywd, value); 354 iter->addComment(kywd, value);
351 } 355 }
352 } 356 }
353 357
354 void SkNWayCanvas::endCommentGroup() { 358 void SkNWayCanvas::endCommentGroup() {
355 Iter iter(fList); 359 Iter iter(fList);
356 while (iter.next()) { 360 while (iter.next()) {
357 iter->endCommentGroup(); 361 iter->endCommentGroup();
358 } 362 }
359 } 363 }
OLDNEW
« no previous file with comments | « src/utils/SkLuaCanvas.cpp ('k') | src/utils/SkNoSaveLayerCanvas.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698