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

Side by Side Diff: src/views/SkStackViewLayout.cpp

Issue 1316233002: Style Change: NULL->nullptr (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-08-27 (Thursday) 10:25:06 EDT Created 5 years, 3 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
« no previous file with comments | « src/views/SkProgressView.cpp ('k') | src/views/SkTagList.h » ('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 /* 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 ignore its current value but increment the counter for flexChildren 72 ignore its current value but increment the counter for flexChildren
73 */ 73 */
74 static SkScalar compute_children_limit(SkView* parent, GetSizeProc sizeProc, int * count, 74 static SkScalar compute_children_limit(SkView* parent, GetSizeProc sizeProc, int * count,
75 uint32_t flexMask, int* flexCount) 75 uint32_t flexMask, int* flexCount)
76 { 76 {
77 SkView::B2FIter iter(parent); 77 SkView::B2FIter iter(parent);
78 SkView* child; 78 SkView* child;
79 SkScalar limit = 0; 79 SkScalar limit = 0;
80 int n = 0, flex = 0; 80 int n = 0, flex = 0;
81 81
82 while ((child = iter.next()) != NULL) 82 while ((child = iter.next()) != nullptr)
83 { 83 {
84 n += 1; 84 n += 1;
85 if (child->getFlags() & flexMask) 85 if (child->getFlags() & flexMask)
86 flex += 1; 86 flex += 1;
87 else 87 else
88 limit += (child->*sizeProc)(); 88 limit += (child->*sizeProc)();
89 } 89 }
90 if (count) 90 if (count)
91 *count = n; 91 *count = n;
92 if (flexCount) 92 if (flexCount)
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 mainLocP = &SkView::setLocY; 138 mainLocP = &SkView::setLocY;
139 crossLocP = &SkView::setLocX; 139 crossLocP = &SkView::setLocX;
140 140
141 mainSetSizeP = &SkView::setHeight; 141 mainSetSizeP = &SkView::setHeight;
142 crossSetSizeP = &SkView::setWidth; 142 crossSetSizeP = &SkView::setWidth;
143 143
144 flexMask = SkView::kFlexV_Mask; 144 flexMask = SkView::kFlexV_Mask;
145 } 145 }
146 crossLimit += (parent->*crossGetSizeP)(); 146 crossLimit += (parent->*crossGetSizeP)();
147 if (fAlign != kStretch_Align) 147 if (fAlign != kStretch_Align)
148 crossSetSizeP = NULL; 148 crossSetSizeP = nullptr;
149 149
150 int childCount, flexCount; 150 int childCount, flexCount;
151 SkScalar childLimit = compute_children_limit(parent, mainGetSizeP, &child Count, flexMask, &flexCount); 151 SkScalar childLimit = compute_children_limit(parent, mainGetSizeP, &child Count, flexMask, &flexCount);
152 152
153 if (childCount == 0) 153 if (childCount == 0)
154 return; 154 return;
155 155
156 childLimit += (childCount - 1) * fSpacer; 156 childLimit += (childCount - 1) * fSpacer;
157 157
158 SkScalar parentLimit = (parent->*mainGetSizeP)() - startM - endM; 158 SkScalar parentLimit = (parent->*mainGetSizeP)() - startM - endM;
159 SkScalar pos = startM + gAlignProcs[fPack](childLimit, parentLimit); 159 SkScalar pos = startM + gAlignProcs[fPack](childLimit, parentLimit);
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()) != nullptr)
168 { 168 {
169 if (fRound) 169 if (fRound)
170 pos = SkScalarRoundToScalar(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 = SkScalarRoundToScalar(crossLoc); 174 crossLoc = SkScalarRoundToScalar(crossLoc);
175 (child->*crossLocP)(crossLoc); 175 (child->*crossLocP)(crossLoc);
176 176
177 if (crossSetSizeP) 177 if (crossSetSizeP)
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 void SkFillViewLayout::setMargin(const SkRect& margin) 251 void SkFillViewLayout::setMargin(const SkRect& margin)
252 { 252 {
253 fMargin = margin; 253 fMargin = margin;
254 } 254 }
255 255
256 void SkFillViewLayout::onLayoutChildren(SkView* parent) 256 void SkFillViewLayout::onLayoutChildren(SkView* parent)
257 { 257 {
258 SkView::B2FIter iter(parent); 258 SkView::B2FIter iter(parent);
259 SkView* child; 259 SkView* child;
260 260
261 while ((child = iter.next()) != NULL) 261 while ((child = iter.next()) != nullptr)
262 { 262 {
263 child->setLoc(fMargin.fLeft, fMargin.fTop); 263 child->setLoc(fMargin.fLeft, fMargin.fTop);
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 }
OLDNEW
« no previous file with comments | « src/views/SkProgressView.cpp ('k') | src/views/SkTagList.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698