| 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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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::Builder looperBuilder; | 150 SkLayerDrawLooper::Builder looperBuilder; |
| 151 SkLayerDrawLooper* looper = looperBuilder.detachLooper(); | 151 SkLayerDrawLooper* looper = looperBuilder.detachLooper(); |
| 152 paint.setLooper(looper)->unref(); | 152 paint.setLooper(looper)->unref(); |
| 153 SkMaskFilter* mask = SkBlurMaskFilter::Create(SkBlurMaskFilter::kNormal_Blur
Style, | 153 SkMaskFilter* mask = SkBlurMaskFilter::Create(kNormal_SkBlurStyle, |
| 154 SkBlurMask::ConvertRadiusToSigma(SkIntToSc
alar(1))); | 154 SkBlurMask::ConvertRadiusToSigma(SkIntToSc
alar(1))); |
| 155 paint.setMaskFilter(mask)->unref(); | 155 paint.setMaskFilter(mask)->unref(); |
| 156 | 156 |
| 157 // 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 |
| 158 SkPaint copiedPaint = paint; | 158 SkPaint copiedPaint = paint; |
| 159 REPORTER_ASSERT(reporter, paint == copiedPaint); | 159 REPORTER_ASSERT(reporter, paint == copiedPaint); |
| 160 | 160 |
| 161 #ifdef SK_BUILD_FOR_ANDROID | 161 #ifdef SK_BUILD_FOR_ANDROID |
| 162 // the copy constructor should preserve the Generation ID | 162 // the copy constructor should preserve the Generation ID |
| 163 uint32_t paintGenID = paint.getGenerationID(); | 163 uint32_t paintGenID = paint.getGenerationID(); |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 ASSERT(other.getTextScaleX() == paint.getTextScaleX()); | 342 ASSERT(other.getTextScaleX() == paint.getTextScaleX()); |
| 343 ASSERT(other.getTextSize() == paint.getTextSize()); | 343 ASSERT(other.getTextSize() == paint.getTextSize()); |
| 344 ASSERT(other.getLooper() == paint.getLooper()); | 344 ASSERT(other.getLooper() == paint.getLooper()); |
| 345 | 345 |
| 346 // We have to be a little looser and compare just the modes. Pointers might
not be the same. | 346 // We have to be a little looser and compare just the modes. Pointers might
not be the same. |
| 347 SkXfermode::Mode otherMode, paintMode; | 347 SkXfermode::Mode otherMode, paintMode; |
| 348 ASSERT(other.getXfermode()->asMode(&otherMode)); | 348 ASSERT(other.getXfermode()->asMode(&otherMode)); |
| 349 ASSERT(paint.getXfermode()->asMode(&paintMode)); | 349 ASSERT(paint.getXfermode()->asMode(&paintMode)); |
| 350 ASSERT(otherMode == paintMode); | 350 ASSERT(otherMode == paintMode); |
| 351 } | 351 } |
| OLD | NEW |