OLD | NEW |
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 "SkStackViewLayout.h" | 8 #include "SkStackViewLayout.h" |
9 | 9 |
10 SkStackViewLayout::SkStackViewLayout() | 10 SkStackViewLayout::SkStackViewLayout() |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 SkScalar flexAmount = 0; | 160 SkScalar flexAmount = 0; |
161 SkView::B2FIter iter(parent); | 161 SkView::B2FIter iter(parent); |
162 SkView* child; | 162 SkView* child; |
163 | 163 |
164 if (flexCount > 0 && parentLimit > childLimit) | 164 if (flexCount > 0 && parentLimit > childLimit) |
165 flexAmount = (parentLimit - childLimit) / flexCount; | 165 flexAmount = (parentLimit - childLimit) / flexCount; |
166 | 166 |
167 while ((child = iter.next()) != NULL) | 167 while ((child = iter.next()) != NULL) |
168 { | 168 { |
169 if (fRound) | 169 if (fRound) |
170 pos = SkIntToScalar(SkScalarRound(pos)); | 170 pos = SkScalarRoundToScalar(pos); |
171 (child->*mainLocP)(pos); | 171 (child->*mainLocP)(pos); |
172 SkScalar crossLoc = crossStartM + gAlignProcs[fAlign]((child->*crossGetS
izeP)(), crossLimit); | 172 SkScalar crossLoc = crossStartM + gAlignProcs[fAlign]((child->*crossGetS
izeP)(), crossLimit); |
173 if (fRound) | 173 if (fRound) |
174 crossLoc = SkIntToScalar(SkScalarRound(crossLoc)); | 174 crossLoc = SkScalarRoundToScalar(crossLoc); |
175 (child->*crossLocP)(crossLoc); | 175 (child->*crossLocP)(crossLoc); |
176 | 176 |
177 if (crossSetSizeP) | 177 if (crossSetSizeP) |
178 (child->*crossSetSizeP)(crossLimit); | 178 (child->*crossSetSizeP)(crossLimit); |
179 if (child->getFlags() & flexMask) | 179 if (child->getFlags() & flexMask) |
180 (child->*mainSetSizeP)(flexAmount); | 180 (child->*mainSetSizeP)(flexAmount); |
181 pos += (child->*mainGetSizeP)() + fSpacer; | 181 pos += (child->*mainGetSizeP)() + fSpacer; |
182 } | 182 } |
183 } | 183 } |
184 | 184 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 child->setSize( parent->width() - fMargin.fRight - fMargin.fLeft, | 264 child->setSize( parent->width() - fMargin.fRight - fMargin.fLeft, |
265 parent->height() - fMargin.fBottom - fMargin.fTop); | 265 parent->height() - fMargin.fBottom - fMargin.fTop); |
266 } | 266 } |
267 } | 267 } |
268 | 268 |
269 void SkFillViewLayout::onInflate(const SkDOM& dom, const SkDOM::Node* node) | 269 void SkFillViewLayout::onInflate(const SkDOM& dom, const SkDOM::Node* node) |
270 { | 270 { |
271 this->INHERITED::onInflate(dom, node); | 271 this->INHERITED::onInflate(dom, node); |
272 (void)dom.findScalars(node, "margin", (SkScalar*)&fMargin, 4); | 272 (void)dom.findScalars(node, "margin", (SkScalar*)&fMargin, 4); |
273 } | 273 } |
OLD | NEW |