Bug 1259734 - use AppendElements in DisplayItemClip::AppendRoundedRects; r=dholbert
authorNathan Froyd <froydnj.com>
Fri, 25 Mar 2016 09:34:37 -0400
changeset 290901 c24b873c12cb8a1c3753d725fe649e3848672b8d
parent 290900 364b20e86805a62113e5262a0292a6a15dbfff1b
child 290902 3f5ed1912b14b7a1f2ae9d9697f9a65f3ec516a1
push id74422
push usernfroyd@mozilla.com
push dateWed, 30 Mar 2016 15:35:00 +0000
treeherdermozilla-inbound@c24b873c12cb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdholbert
bugs1259734
milestone48.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1259734 - use AppendElements in DisplayItemClip::AppendRoundedRects; r=dholbert It is shorter and nicer than writing out the loop ourselves.
layout/base/DisplayItemClip.cpp
--- a/layout/base/DisplayItemClip.cpp
+++ b/layout/base/DisplayItemClip.cpp
@@ -398,20 +398,18 @@ DisplayItemClip::GetCommonRoundedRectCou
     }
   }
   return clipCount;
 }
 
 void
 DisplayItemClip::AppendRoundedRects(nsTArray<RoundedRect>* aArray, uint32_t aCount) const
 {
-  uint32_t count = std::min(mRoundedClipRects.Length(), size_t(aCount));
-  for (uint32_t i = 0; i < count; ++i) {
-    *aArray->AppendElement() = mRoundedClipRects[i];
-  }
+  size_t count = std::min(mRoundedClipRects.Length(), size_t(aCount));
+  aArray->AppendElements(mRoundedClipRects.Elements(), count);
 }
 
 bool
 DisplayItemClip::ComputeRegionInClips(DisplayItemClip* aOldClip,
                                       const nsPoint& aShift,
                                       nsRegion* aCombined) const
 {
   if (!mHaveClipRect || (aOldClip && !aOldClip->mHaveClipRect)) {