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

Side by Side Diff: src/utils/SkProxyCanvas.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/SkNoSaveLayerCanvas.h ('k') | src/utils/debugger/SkDebugCanvas.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 "SkProxyCanvas.h" 8 #include "SkProxyCanvas.h"
9 9
10 SkProxyCanvas::SkProxyCanvas(SkCanvas* proxy) : fProxy(proxy) { 10 SkProxyCanvas::SkProxyCanvas(SkCanvas* proxy) : fProxy(proxy) {
11 SkSafeRef(fProxy); 11 SkSafeRef(fProxy);
12 } 12 }
13 13
14 SkProxyCanvas::~SkProxyCanvas() { 14 SkProxyCanvas::~SkProxyCanvas() {
15 SkSafeUnref(fProxy); 15 SkSafeUnref(fProxy);
16 } 16 }
17 17
18 void SkProxyCanvas::setProxy(SkCanvas* proxy) { 18 void SkProxyCanvas::setProxy(SkCanvas* proxy) {
19 SkRefCnt_SafeAssign(fProxy, proxy); 19 SkRefCnt_SafeAssign(fProxy, proxy);
20 } 20 }
21 21
22 ///////////////////////////////// Overrides /////////// 22 ///////////////////////////////// Overrides ///////////
23 23
24 int SkProxyCanvas::save(SaveFlags flags) { 24 void SkProxyCanvas::willSave(SaveFlags flags) {
25 return fProxy->save(flags); 25 fProxy->save(flags);
26 this->INHERITED::willSave(flags);
26 } 27 }
27 28
28 int SkProxyCanvas::saveLayer(const SkRect* bounds, const SkPaint* paint, 29 SkCanvas::SaveLayerStrategy SkProxyCanvas::willSaveLayer(const SkRect* bounds, c onst SkPaint* paint,
29 SaveFlags flags) { 30 SaveFlags flags) {
30 return fProxy->saveLayer(bounds, paint, flags); 31 fProxy->saveLayer(bounds, paint, flags);
32 this->INHERITED::willSaveLayer(bounds, paint, flags);
33 // No need for a layer.
34 return kNoLayer_SaveLayerStrategy;
31 } 35 }
32 36
33 void SkProxyCanvas::restore() { 37 void SkProxyCanvas::willRestore() {
34 fProxy->restore(); 38 fProxy->restore();
39 this->INHERITED::willRestore();
35 } 40 }
36 41
37 bool SkProxyCanvas::translate(SkScalar dx, SkScalar dy) { 42 bool SkProxyCanvas::translate(SkScalar dx, SkScalar dy) {
38 return fProxy->translate(dx, dy); 43 return fProxy->translate(dx, dy);
39 } 44 }
40 45
41 bool SkProxyCanvas::scale(SkScalar sx, SkScalar sy) { 46 bool SkProxyCanvas::scale(SkScalar sx, SkScalar sy) {
42 return fProxy->scale(sx, sy); 47 return fProxy->scale(sx, sy);
43 } 48 }
44 49
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 fProxy->endCommentGroup(); 181 fProxy->endCommentGroup();
177 } 182 }
178 183
179 SkBounder* SkProxyCanvas::setBounder(SkBounder* bounder) { 184 SkBounder* SkProxyCanvas::setBounder(SkBounder* bounder) {
180 return fProxy->setBounder(bounder); 185 return fProxy->setBounder(bounder);
181 } 186 }
182 187
183 SkDrawFilter* SkProxyCanvas::setDrawFilter(SkDrawFilter* filter) { 188 SkDrawFilter* SkProxyCanvas::setDrawFilter(SkDrawFilter* filter) {
184 return fProxy->setDrawFilter(filter); 189 return fProxy->setDrawFilter(filter);
185 } 190 }
OLDNEW
« no previous file with comments | « src/utils/SkNoSaveLayerCanvas.h ('k') | src/utils/debugger/SkDebugCanvas.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698