OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "SkBlurMask.h" | 8 #include "SkBlurMask.h" |
9 #include "SkBlurMaskFilter.h" | 9 #include "SkBlurMaskFilter.h" |
10 #include "SkLayerDrawLooper.h" | 10 #include "SkLayerDrawLooper.h" |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 } | 140 } |
141 } | 141 } |
142 | 142 |
143 DEF_TEST(Paint_copy, reporter) { | 143 DEF_TEST(Paint_copy, reporter) { |
144 SkPaint paint; | 144 SkPaint paint; |
145 // set a few member variables | 145 // set a few member variables |
146 paint.setStyle(SkPaint::kStrokeAndFill_Style); | 146 paint.setStyle(SkPaint::kStrokeAndFill_Style); |
147 paint.setTextAlign(SkPaint::kLeft_Align); | 147 paint.setTextAlign(SkPaint::kLeft_Align); |
148 paint.setStrokeWidth(SkIntToScalar(2)); | 148 paint.setStrokeWidth(SkIntToScalar(2)); |
149 // set a few pointers | 149 // set a few pointers |
150 SkLayerDrawLooper* looper = new SkLayerDrawLooper(); | 150 SkLayerDrawLooper::Builder looperBuilder; |
| 151 SkLayerDrawLooper* looper = looperBuilder.detachLooper(); |
151 paint.setLooper(looper)->unref(); | 152 paint.setLooper(looper)->unref(); |
152 SkMaskFilter* mask = SkBlurMaskFilter::Create(SkBlurMaskFilter::kNormal_Blur
Style, | 153 SkMaskFilter* mask = SkBlurMaskFilter::Create(SkBlurMaskFilter::kNormal_Blur
Style, |
153 SkBlurMask::ConvertRadiusToSigma(SkIntToSc
alar(1))); | 154 SkBlurMask::ConvertRadiusToSigma(SkIntToSc
alar(1))); |
154 paint.setMaskFilter(mask)->unref(); | 155 paint.setMaskFilter(mask)->unref(); |
155 | 156 |
156 // copy the paint using the copy constructor and check they are the same | 157 // copy the paint using the copy constructor and check they are the same |
157 SkPaint copiedPaint = paint; | 158 SkPaint copiedPaint = paint; |
158 REPORTER_ASSERT(reporter, paint == copiedPaint); | 159 REPORTER_ASSERT(reporter, paint == copiedPaint); |
159 | 160 |
160 #ifdef SK_BUILD_FOR_ANDROID | 161 #ifdef SK_BUILD_FOR_ANDROID |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 ASSERT(other.getTextScaleX() == paint.getTextScaleX()); | 272 ASSERT(other.getTextScaleX() == paint.getTextScaleX()); |
272 ASSERT(other.getTextSize() == paint.getTextSize()); | 273 ASSERT(other.getTextSize() == paint.getTextSize()); |
273 ASSERT(other.getLooper() == paint.getLooper()); | 274 ASSERT(other.getLooper() == paint.getLooper()); |
274 | 275 |
275 // We have to be a little looser and compare just the modes. Pointers might
not be the same. | 276 // We have to be a little looser and compare just the modes. Pointers might
not be the same. |
276 SkXfermode::Mode otherMode, paintMode; | 277 SkXfermode::Mode otherMode, paintMode; |
277 ASSERT(other.getXfermode()->asMode(&otherMode)); | 278 ASSERT(other.getXfermode()->asMode(&otherMode)); |
278 ASSERT(paint.getXfermode()->asMode(&paintMode)); | 279 ASSERT(paint.getXfermode()->asMode(&paintMode)); |
279 ASSERT(otherMode == paintMode); | 280 ASSERT(otherMode == paintMode); |
280 } | 281 } |
OLD | NEW |