144 %{ /* NOCONTEXT */ |
144 %{ /* NOCONTEXT */ |
145 REGISTER OBJ newRect; |
145 REGISTER OBJ newRect; |
146 OBJ t; |
146 OBJ t; |
147 int spc; |
147 int spc; |
148 |
148 |
149 if (__CanDoQuickNew(OHDR_SIZE + 4*sizeof(OBJ))) { /* OBJECT ALLOCATION */ |
149 if (__CanDoQuickNew(OHDR_SIZE + 4*sizeof(OBJ))) { /* OBJECT ALLOCATION */ |
150 if (self == Rectangle) { |
150 if (self == Rectangle) { |
151 /* |
151 /* |
152 * short cut - rectangles are created so often ... |
152 * short cut - rectangles are created so often ... |
153 */ |
153 */ |
154 __qCheckedAlignedNew(newRect, OHDR_SIZE + 4*sizeof(OBJ)); |
154 __qCheckedAlignedNew(newRect, OHDR_SIZE + 4*sizeof(OBJ)); |
155 |
155 |
156 __InstPtr(newRect)->o_class = Rectangle; |
156 __InstPtr(newRect)->o_class = Rectangle; |
157 __InstPtr(newRect)->i_instvars[0] = left; |
157 __qSTORE(newRect, Rectangle); |
158 __InstPtr(newRect)->i_instvars[1] = top; |
158 |
159 __InstPtr(newRect)->i_instvars[2] = w; |
159 __InstPtr(newRect)->i_instvars[0] = left; |
160 __InstPtr(newRect)->i_instvars[3] = h; |
160 __InstPtr(newRect)->i_instvars[1] = top; |
161 |
161 __InstPtr(newRect)->i_instvars[2] = w; |
162 if (! (__bothSmallInteger(left, top) && |
162 __InstPtr(newRect)->i_instvars[3] = h; |
163 __bothSmallInteger(w, h))) { |
163 |
164 spc = __qSpace(newRect); |
164 if (! (__bothSmallInteger(left, top) && |
165 __STORE_SPC(newRect, left, spc); |
165 __bothSmallInteger(w, h))) { |
166 __STORE_SPC(newRect, top, spc); |
166 spc = __qSpace(newRect); |
167 __STORE_SPC(newRect, w, spc); |
167 __STORE_SPC(newRect, left, spc); |
168 __STORE_SPC(newRect, h, spc); |
168 __STORE_SPC(newRect, top, spc); |
169 } |
169 __STORE_SPC(newRect, w, spc); |
170 |
170 __STORE_SPC(newRect, h, spc); |
171 RETURN ( newRect ); |
171 } |
172 } |
172 |
|
173 RETURN ( newRect ); |
|
174 } |
173 } |
175 } |
174 %}. |
176 %}. |
175 ^ (self basicNew) left:left top:top width:w height:h |
177 ^ (self basicNew) left:left top:top width:w height:h |
176 ! |
178 ! |
177 |
179 |
206 %{ /* NOCONTEXT */ |
208 %{ /* NOCONTEXT */ |
207 REGISTER OBJ newRect; |
209 REGISTER OBJ newRect; |
208 OBJ t; |
210 OBJ t; |
209 int spc; |
211 int spc; |
210 |
212 |
211 if (__CanDoQuickNew(OHDR_SIZE + 4*sizeof(OBJ))) { /* OBJECT ALLOCATION */ |
213 if (__CanDoQuickNew(OHDR_SIZE + 4*sizeof(OBJ))) { /* OBJECT ALLOCATION */ |
212 /* |
214 /* |
213 * short cut - rectangles are created so often ... |
215 * short cut - rectangles are created so often ... |
214 */ |
216 */ |
215 if (self == Rectangle) { |
217 if (self == Rectangle) { |
216 if (__isPoint(origin) && __isPoint(extent)) { |
218 if (__isPoint(origin) && __isPoint(extent)) { |
217 __qCheckedAlignedNew(newRect, OHDR_SIZE + 4*sizeof(OBJ)); |
219 __qCheckedAlignedNew(newRect, OHDR_SIZE + 4*sizeof(OBJ)); |
218 __InstPtr(newRect)->o_class = Rectangle; |
220 __InstPtr(newRect)->o_class = Rectangle; |
219 spc = __qSpace(newRect); |
221 __qSTORE(newRect, Rectangle); |
220 |
222 spc = __qSpace(newRect); |
221 t = __PointInstPtr(origin)->p_x; |
223 |
222 __InstPtr(newRect)->i_instvars[0] = t; |
224 t = __PointInstPtr(origin)->p_x; |
223 __STORE_SPC(newRect, t, spc); |
225 __InstPtr(newRect)->i_instvars[0] = t; |
224 |
226 __STORE_SPC(newRect, t, spc); |
225 t = __PointInstPtr(origin)->p_y; |
227 |
226 __InstPtr(newRect)->i_instvars[1] = t; |
228 t = __PointInstPtr(origin)->p_y; |
227 __STORE_SPC(newRect, t, spc); |
229 __InstPtr(newRect)->i_instvars[1] = t; |
228 |
230 __STORE_SPC(newRect, t, spc); |
229 t = __PointInstPtr(extent)->p_x; |
231 |
230 __InstPtr(newRect)->i_instvars[2] = t; |
232 t = __PointInstPtr(extent)->p_x; |
231 __STORE_SPC(newRect, t, spc); |
233 __InstPtr(newRect)->i_instvars[2] = t; |
232 |
234 __STORE_SPC(newRect, t, spc); |
233 t = __PointInstPtr(extent)->p_y; |
235 |
234 __InstPtr(newRect)->i_instvars[3] = t; |
236 t = __PointInstPtr(extent)->p_y; |
235 __STORE_SPC(newRect, t, spc); |
237 __InstPtr(newRect)->i_instvars[3] = t; |
236 RETURN ( newRect ); |
238 __STORE_SPC(newRect, t, spc); |
237 } |
239 RETURN ( newRect ); |
238 } |
240 } |
|
241 } |
239 } |
242 } |
240 %}. |
243 %}. |
241 ^ (self basicNew) origin:origin extent:extent |
244 ^ (self basicNew) origin:origin extent:extent |
242 ! |
245 ! |
243 |
246 |