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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 } | 139 } |
140 | 140 |
141 DEF_TEST(Paint_copy, reporter) { | 141 DEF_TEST(Paint_copy, reporter) { |
142 SkPaint paint; | 142 SkPaint paint; |
143 // set a few member variables | 143 // set a few member variables |
144 paint.setStyle(SkPaint::kStrokeAndFill_Style); | 144 paint.setStyle(SkPaint::kStrokeAndFill_Style); |
145 paint.setTextAlign(SkPaint::kLeft_Align); | 145 paint.setTextAlign(SkPaint::kLeft_Align); |
146 paint.setStrokeWidth(SkIntToScalar(2)); | 146 paint.setStrokeWidth(SkIntToScalar(2)); |
147 // set a few pointers | 147 // set a few pointers |
148 SkLayerDrawLooper::Builder looperBuilder; | 148 SkLayerDrawLooper::Builder looperBuilder; |
149 SkLayerDrawLooper* looper = looperBuilder.detachLooper(); | 149 paint.setLooper(looperBuilder.detach()); |
150 paint.setLooper(looper)->unref(); | |
151 SkMaskFilter* mask = SkBlurMaskFilter::Create(kNormal_SkBlurStyle, | 150 SkMaskFilter* mask = SkBlurMaskFilter::Create(kNormal_SkBlurStyle, |
152 SkBlurMask::ConvertRadiusToSigma(SkIntToSc
alar(1))); | 151 SkBlurMask::ConvertRadiusToSigma(SkIntToSc
alar(1))); |
153 paint.setMaskFilter(mask)->unref(); | 152 paint.setMaskFilter(mask)->unref(); |
154 | 153 |
155 // copy the paint using the copy constructor and check they are the same | 154 // copy the paint using the copy constructor and check they are the same |
156 SkPaint copiedPaint = paint; | 155 SkPaint copiedPaint = paint; |
157 REPORTER_ASSERT(reporter, paint == copiedPaint); | 156 REPORTER_ASSERT(reporter, paint == copiedPaint); |
158 | 157 |
159 // copy the paint using the equal operator and check they are the same | 158 // copy the paint using the equal operator and check they are the same |
160 copiedPaint = paint; | 159 copiedPaint = paint; |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 SkColorMatrix cm; | 361 SkColorMatrix cm; |
363 cm.setIdentity(); // does not change alpha | 362 cm.setIdentity(); // does not change alpha |
364 paint.setColorFilter(SkColorMatrixFilter::Create(cm))->unref(); | 363 paint.setColorFilter(SkColorMatrixFilter::Create(cm))->unref(); |
365 REPORTER_ASSERT(r, paint.nothingToDraw()); | 364 REPORTER_ASSERT(r, paint.nothingToDraw()); |
366 | 365 |
367 cm.postTranslate(0, 0, 0, 1); // wacks alpha | 366 cm.postTranslate(0, 0, 0, 1); // wacks alpha |
368 paint.setColorFilter(SkColorMatrixFilter::Create(cm))->unref(); | 367 paint.setColorFilter(SkColorMatrixFilter::Create(cm))->unref(); |
369 REPORTER_ASSERT(r, !paint.nothingToDraw()); | 368 REPORTER_ASSERT(r, !paint.nothingToDraw()); |
370 } | 369 } |
371 | 370 |
OLD | NEW |