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

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

Issue 203203004: Consolidate SkCanvas matrix virtuals. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Funnel everything through concat() 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
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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
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()) {
robertphillips 2014/03/25 15:44:36 same here
f(malita) 2014/03/25 15:58:08 Done.
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");
robertphillips 2014/03/25 15:44:36 break goes before the } when you do this.
f(malita) 2014/03/25 15:58:08 Done.
115 } break;
116 case SkMatrix::kScale_Mask: {
117 AUTO_LUA("scale");
118 lua.pushScalar(matrix.getScaleX(), "sx");
119 lua.pushScalar(matrix.getScaleY(), "sy");
120 } break;
121 default: {
122 AUTO_LUA("concat");
123 lua.pushMatrix(matrix);
124 } break;
125 }
115 126
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); 127 this->INHERITED::didConcat(matrix);
139 } 128 }
140 129
141 void SkLuaCanvas::didSetMatrix(const SkMatrix& matrix) { 130 void SkLuaCanvas::didSetMatrix(const SkMatrix& matrix) {
142 this->INHERITED::didSetMatrix(matrix); 131 this->INHERITED::didSetMatrix(matrix);
143 } 132 }
144 133
145 void SkLuaCanvas::onClipRect(const SkRect& r, SkRegion::Op op, ClipEdgeStyle edg eStyle) { 134 void SkLuaCanvas::onClipRect(const SkRect& r, SkRegion::Op op, ClipEdgeStyle edg eStyle) {
146 AUTO_LUA("clipRect"); 135 AUTO_LUA("clipRect");
147 lua.pushRect(r, "rect"); 136 lua.pushRect(r, "rect");
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 const SkColor colors[], SkXfermode* xmode, 276 const SkColor colors[], SkXfermode* xmode,
288 const uint16_t indices[], int indexCount, 277 const uint16_t indices[], int indexCount,
289 const SkPaint& paint) { 278 const SkPaint& paint) {
290 AUTO_LUA("drawVertices"); 279 AUTO_LUA("drawVertices");
291 lua.pushPaint(paint, "paint"); 280 lua.pushPaint(paint, "paint");
292 } 281 }
293 282
294 void SkLuaCanvas::drawData(const void* data, size_t length) { 283 void SkLuaCanvas::drawData(const void* data, size_t length) {
295 AUTO_LUA("drawData"); 284 AUTO_LUA("drawData");
296 } 285 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698