OLD | NEW |
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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 this->INHERITED::willSaveLayer(bounds, paint, flags); | 99 this->INHERITED::willSaveLayer(bounds, paint, flags); |
100 // No need for a layer. | 100 // No need for a layer. |
101 return kNoLayer_SaveLayerStrategy; | 101 return kNoLayer_SaveLayerStrategy; |
102 } | 102 } |
103 | 103 |
104 void SkLuaCanvas::willRestore() { | 104 void SkLuaCanvas::willRestore() { |
105 AUTO_LUA("restore"); | 105 AUTO_LUA("restore"); |
106 this->INHERITED::willRestore(); | 106 this->INHERITED::willRestore(); |
107 } | 107 } |
108 | 108 |
109 void SkLuaCanvas::didTranslate(SkScalar dx, SkScalar dy) { | 109 void SkLuaCanvas::didConcat(const SkMatrix& matrix) { |
110 AUTO_LUA("translate"); | 110 switch (matrix.getType()) { |
111 lua.pushScalar(dx, "dx"); | 111 case SkMatrix::kTranslate_Mask: { |
112 lua.pushScalar(dy, "dy"); | 112 AUTO_LUA("translate"); |
113 this->INHERITED::didTranslate(dx, dy); | 113 lua.pushScalar(matrix.getTranslateX(), "dx"); |
114 } | 114 lua.pushScalar(matrix.getTranslateY(), "dy"); |
| 115 break; |
| 116 } |
| 117 case SkMatrix::kScale_Mask: { |
| 118 AUTO_LUA("scale"); |
| 119 lua.pushScalar(matrix.getScaleX(), "sx"); |
| 120 lua.pushScalar(matrix.getScaleY(), "sy"); |
| 121 break; |
| 122 } |
| 123 default: { |
| 124 AUTO_LUA("concat"); |
| 125 lua.pushMatrix(matrix); |
| 126 break; |
| 127 } |
| 128 } |
115 | 129 |
116 void SkLuaCanvas::didScale(SkScalar sx, SkScalar sy) { | |
117 AUTO_LUA("scale"); | |
118 lua.pushScalar(sx, "sx"); | |
119 lua.pushScalar(sy, "sy"); | |
120 this->INHERITED::didScale(sx, sy); | |
121 } | |
122 | |
123 void SkLuaCanvas::didRotate(SkScalar degrees) { | |
124 AUTO_LUA("rotate"); | |
125 lua.pushScalar(degrees, "degrees"); | |
126 this->INHERITED::didRotate(degrees); | |
127 } | |
128 | |
129 void SkLuaCanvas::didSkew(SkScalar kx, SkScalar ky) { | |
130 AUTO_LUA("skew"); | |
131 lua.pushScalar(kx, "kx"); | |
132 lua.pushScalar(ky, "ky"); | |
133 this->INHERITED::didSkew(kx, ky); | |
134 } | |
135 | |
136 void SkLuaCanvas::didConcat(const SkMatrix& matrix) { | |
137 AUTO_LUA("concat"); | |
138 this->INHERITED::didConcat(matrix); | 130 this->INHERITED::didConcat(matrix); |
139 } | 131 } |
140 | 132 |
141 void SkLuaCanvas::didSetMatrix(const SkMatrix& matrix) { | 133 void SkLuaCanvas::didSetMatrix(const SkMatrix& matrix) { |
142 this->INHERITED::didSetMatrix(matrix); | 134 this->INHERITED::didSetMatrix(matrix); |
143 } | 135 } |
144 | 136 |
145 void SkLuaCanvas::onClipRect(const SkRect& r, SkRegion::Op op, ClipEdgeStyle edg
eStyle) { | 137 void SkLuaCanvas::onClipRect(const SkRect& r, SkRegion::Op op, ClipEdgeStyle edg
eStyle) { |
146 AUTO_LUA("clipRect"); | 138 AUTO_LUA("clipRect"); |
147 lua.pushRect(r, "rect"); | 139 lua.pushRect(r, "rect"); |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 const SkColor colors[], SkXfermode* xmode, | 279 const SkColor colors[], SkXfermode* xmode, |
288 const uint16_t indices[], int indexCount, | 280 const uint16_t indices[], int indexCount, |
289 const SkPaint& paint) { | 281 const SkPaint& paint) { |
290 AUTO_LUA("drawVertices"); | 282 AUTO_LUA("drawVertices"); |
291 lua.pushPaint(paint, "paint"); | 283 lua.pushPaint(paint, "paint"); |
292 } | 284 } |
293 | 285 |
294 void SkLuaCanvas::drawData(const void* data, size_t length) { | 286 void SkLuaCanvas::drawData(const void* data, size_t length) { |
295 AUTO_LUA("drawData"); | 287 AUTO_LUA("drawData"); |
296 } | 288 } |
OLD | NEW |