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

Side by Side Diff: tests/LayerRasterizerTest.cpp

Issue 233883002: Cast int to float. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 8 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 | « no previous file | no next file » | 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 * Copyright 2014 Google Inc. 2 * Copyright 2014 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkDeque.h" 8 #include "SkDeque.h"
9 #include "SkLayerRasterizer.h" 9 #include "SkLayerRasterizer.h"
10 #include "SkPaint.h" 10 #include "SkPaint.h"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 static bool equals(const SkLayerRasterizer_Rec& rec1, const SkLayerRasterizer_Re c& rec2) { 78 static bool equals(const SkLayerRasterizer_Rec& rec1, const SkLayerRasterizer_Re c& rec2) {
79 return rec1.fPaint == rec2.fPaint && rec1.fOffset == rec2.fOffset; 79 return rec1.fPaint == rec2.fPaint && rec1.fOffset == rec2.fOffset;
80 } 80 }
81 81
82 DEF_TEST(LayerRasterizer_copy, reporter) { 82 DEF_TEST(LayerRasterizer_copy, reporter) {
83 SkLayerRasterizer::Builder builder; 83 SkLayerRasterizer::Builder builder;
84 SkPaint paint; 84 SkPaint paint;
85 // Create a bunch of paints with different flags. 85 // Create a bunch of paints with different flags.
86 for (uint32_t flags = 0x01; flags < SkPaint::kAllFlags; flags <<= 1) { 86 for (uint32_t flags = 0x01; flags < SkPaint::kAllFlags; flags <<= 1) {
87 paint.setFlags(flags); 87 paint.setFlags(flags);
88 builder.addLayer(paint, flags, flags); 88 builder.addLayer(paint, static_cast<SkScalar>(flags), static_cast<SkScal ar>(flags));
89 } 89 }
90 90
91 // Create a layer rasterizer with all the existing layers. 91 // Create a layer rasterizer with all the existing layers.
92 SkAutoTUnref<SkLayerRasterizer> firstCopy(builder.snapshotRasterizer()); 92 SkAutoTUnref<SkLayerRasterizer> firstCopy(builder.snapshotRasterizer());
93 93
94 // Add one more layer. 94 // Add one more layer.
95 paint.setFlags(SkPaint::kAllFlags); 95 paint.setFlags(SkPaint::kAllFlags);
96 builder.addLayer(paint); 96 builder.addLayer(paint);
97 97
98 SkAutoTUnref<SkLayerRasterizer> oneLarger(builder.snapshotRasterizer()); 98 SkAutoTUnref<SkLayerRasterizer> oneLarger(builder.snapshotRasterizer());
(...skipping 30 matching lines...) Expand all
129 recDetached = static_cast<const SkLayerRasterizer_Rec*>(iterDetached.ne xt()); 129 recDetached = static_cast<const SkLayerRasterizer_Rec*>(iterDetached.ne xt());
130 130
131 REPORTER_ASSERT(reporter, equals(*recOneLarger, *recDetached)); 131 REPORTER_ASSERT(reporter, equals(*recOneLarger, *recDetached));
132 if (smallerCount == i) { 132 if (smallerCount == i) {
133 REPORTER_ASSERT(reporter, recFirstCopy == NULL); 133 REPORTER_ASSERT(reporter, recFirstCopy == NULL);
134 } else { 134 } else {
135 REPORTER_ASSERT(reporter, equals(*recFirstCopy, *recOneLarger)); 135 REPORTER_ASSERT(reporter, equals(*recFirstCopy, *recOneLarger));
136 } 136 }
137 } 137 }
138 } 138 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698