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

Side by Side Diff: third_party/WebKit/Source/platform/testing/PictureMatchers.cpp

Issue 2615813003: Migrate WTF::Vector::append() to ::push_back() [part 14 of N] (Closed)
Patch Set: rebase, small fix in FontSettings.h Created 3 years, 11 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "platform/testing/PictureMatchers.h" 5 #include "platform/testing/PictureMatchers.h"
6 6
7 #include "platform/geometry/FloatQuad.h" 7 #include "platform/geometry/FloatQuad.h"
8 #include "platform/geometry/FloatRect.h" 8 #include "platform/geometry/FloatRect.h"
9 #include "third_party/skia/include/core/SkCanvas.h" 9 #include "third_party/skia/include/core/SkCanvas.h"
10 #include "third_party/skia/include/core/SkPicture.h" 10 #include "third_party/skia/include/core/SkPicture.h"
(...skipping 28 matching lines...) Expand all
39 } 39 }
40 SkPoint quad[4]; 40 SkPoint quad[4];
41 getTotalMatrix().mapRectToQuad(quad, clippedRect); 41 getTotalMatrix().mapRectToQuad(quad, clippedRect);
42 QuadWithColor quadWithColor; 42 QuadWithColor quadWithColor;
43 quadWithColor.quad = FloatQuad(quad); 43 quadWithColor.quad = FloatQuad(quad);
44 44
45 unsigned paintAlpha = static_cast<unsigned>(paint.getAlpha()); 45 unsigned paintAlpha = static_cast<unsigned>(paint.getAlpha());
46 SkPaint paintWithAlpha(paint); 46 SkPaint paintWithAlpha(paint);
47 paintWithAlpha.setAlpha(static_cast<U8CPU>(m_alpha * paintAlpha / 255)); 47 paintWithAlpha.setAlpha(static_cast<U8CPU>(m_alpha * paintAlpha / 255));
48 quadWithColor.color = Color(paintWithAlpha.getColor()); 48 quadWithColor.color = Color(paintWithAlpha.getColor());
49 m_quads.append(quadWithColor); 49 m_quads.push_back(quadWithColor);
50 SkCanvas::onDrawRect(clippedRect, paint); 50 SkCanvas::onDrawRect(clippedRect, paint);
51 } 51 }
52 52
53 SkCanvas::SaveLayerStrategy getSaveLayerStrategy( 53 SkCanvas::SaveLayerStrategy getSaveLayerStrategy(
54 const SaveLayerRec& rec) override { 54 const SaveLayerRec& rec) override {
55 m_saveCount++; 55 m_saveCount++;
56 unsigned layerAlpha = static_cast<unsigned>(rec.fPaint->getAlpha()); 56 unsigned layerAlpha = static_cast<unsigned>(rec.fPaint->getAlpha());
57 if (layerAlpha < 255) { 57 if (layerAlpha < 255) {
58 DCHECK_EQ(m_alphaSaveLayerCount, -1); 58 DCHECK_EQ(m_alphaSaveLayerCount, -1);
59 m_alphaSaveLayerCount = m_saveCount; 59 m_alphaSaveLayerCount = m_saveCount;
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 rectsWithColor.push_back(RectWithColor(rect, color)); 162 rectsWithColor.push_back(RectWithColor(rect, color));
163 return ::testing::MakeMatcher(new DrawsRectanglesMatcher(rectsWithColor)); 163 return ::testing::MakeMatcher(new DrawsRectanglesMatcher(rectsWithColor));
164 } 164 }
165 165
166 ::testing::Matcher<const SkPicture&> drawsRectangles( 166 ::testing::Matcher<const SkPicture&> drawsRectangles(
167 const Vector<RectWithColor>& rectsWithColor) { 167 const Vector<RectWithColor>& rectsWithColor) {
168 return ::testing::MakeMatcher(new DrawsRectanglesMatcher(rectsWithColor)); 168 return ::testing::MakeMatcher(new DrawsRectanglesMatcher(rectsWithColor));
169 } 169 }
170 170
171 } // namespace blink 171 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698