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

Side by Side Diff: src/utils/SkLuaCanvas.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/SkDumpCanvas.cpp ('k') | src/utils/SkNWayCanvas.cpp » ('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 * Copyright 2013 Google Inc. 2 * Copyright 2013 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 "SkLuaCanvas.h" 8 #include "SkLuaCanvas.h"
9 #include "SkLua.h" 9 #include "SkLua.h"
10 10
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 /////////////////////////////////////////////////////////////////////////////// 74 ///////////////////////////////////////////////////////////////////////////////
75 75
76 SkLuaCanvas::SkLuaCanvas(int width, int height, lua_State* L, const char func[]) 76 SkLuaCanvas::SkLuaCanvas(int width, int height, lua_State* L, const char func[])
77 : INHERITED(width, height) 77 : INHERITED(width, height)
78 , fL(L) 78 , fL(L)
79 , fFunc(func) { 79 , fFunc(func) {
80 } 80 }
81 81
82 SkLuaCanvas::~SkLuaCanvas() {} 82 SkLuaCanvas::~SkLuaCanvas() {}
83 83
84 int SkLuaCanvas::save(SaveFlags flags) { 84 void SkLuaCanvas::willSave(SaveFlags flags) {
85 AUTO_LUA("save"); 85 AUTO_LUA("save");
86 return this->INHERITED::save(flags); 86 this->INHERITED::willSave(flags);
87 } 87 }
88 88
89 int SkLuaCanvas::saveLayer(const SkRect* bounds, const SkPaint* paint, 89 SkCanvas::SaveLayerStrategy SkLuaCanvas::willSaveLayer(const SkRect* bounds, con st SkPaint* paint,
90 SaveFlags flags) { 90 SaveFlags flags) {
91 AUTO_LUA("saveLayer"); 91 AUTO_LUA("saveLayer");
92 if (bounds) { 92 if (bounds) {
93 lua.pushRect(*bounds, "bounds"); 93 lua.pushRect(*bounds, "bounds");
94 } 94 }
95 if (paint) { 95 if (paint) {
96 lua.pushPaint(*paint, "paint"); 96 lua.pushPaint(*paint, "paint");
97 } 97 }
98 return this->INHERITED::save(flags); 98
99 this->INHERITED::willSaveLayer(bounds, paint, flags);
100 // No need for a layer.
101 return kNoLayer_SaveLayerStrategy;
99 } 102 }
100 103
101 void SkLuaCanvas::restore() { 104 void SkLuaCanvas::willRestore() {
102 AUTO_LUA("restore"); 105 AUTO_LUA("restore");
103 this->INHERITED::restore(); 106 this->INHERITED::willRestore();
104 } 107 }
105 108
106 bool SkLuaCanvas::translate(SkScalar dx, SkScalar dy) { 109 bool SkLuaCanvas::translate(SkScalar dx, SkScalar dy) {
107 AUTO_LUA("translate"); 110 AUTO_LUA("translate");
108 lua.pushScalar(dx, "dx"); 111 lua.pushScalar(dx, "dx");
109 lua.pushScalar(dy, "dy"); 112 lua.pushScalar(dy, "dy");
110 return this->INHERITED::translate(dx, dy); 113 return this->INHERITED::translate(dx, dy);
111 } 114 }
112 115
113 bool SkLuaCanvas::scale(SkScalar sx, SkScalar sy) { 116 bool SkLuaCanvas::scale(SkScalar sx, SkScalar sy) {
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 const SkColor colors[], SkXfermode* xmode, 286 const SkColor colors[], SkXfermode* xmode,
284 const uint16_t indices[], int indexCount, 287 const uint16_t indices[], int indexCount,
285 const SkPaint& paint) { 288 const SkPaint& paint) {
286 AUTO_LUA("drawVertices"); 289 AUTO_LUA("drawVertices");
287 lua.pushPaint(paint, "paint"); 290 lua.pushPaint(paint, "paint");
288 } 291 }
289 292
290 void SkLuaCanvas::drawData(const void* data, size_t length) { 293 void SkLuaCanvas::drawData(const void* data, size_t length) {
291 AUTO_LUA("drawData"); 294 AUTO_LUA("drawData");
292 } 295 }
OLDNEW
« no previous file with comments | « src/utils/SkDumpCanvas.cpp ('k') | src/utils/SkNWayCanvas.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698