| 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 "Test.h" | 8 #include "Test.h" |
| 9 #include "SkPath.h" | 9 #include "SkPath.h" |
| 10 #include "SkPaint.h" | 10 #include "SkPaint.h" |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 | 135 |
| 136 static void test_copy(skiatest::Reporter* reporter) { | 136 static void test_copy(skiatest::Reporter* reporter) { |
| 137 SkPaint paint; | 137 SkPaint paint; |
| 138 // set a few member variables | 138 // set a few member variables |
| 139 paint.setStyle(SkPaint::kStrokeAndFill_Style); | 139 paint.setStyle(SkPaint::kStrokeAndFill_Style); |
| 140 paint.setTextAlign(SkPaint::kLeft_Align); | 140 paint.setTextAlign(SkPaint::kLeft_Align); |
| 141 paint.setStrokeWidth(SkIntToScalar(2)); | 141 paint.setStrokeWidth(SkIntToScalar(2)); |
| 142 // set a few pointers | 142 // set a few pointers |
| 143 SkLayerDrawLooper* looper = new SkLayerDrawLooper(); | 143 SkLayerDrawLooper* looper = new SkLayerDrawLooper(); |
| 144 paint.setLooper(looper)->unref(); | 144 paint.setLooper(looper)->unref(); |
| 145 SkMaskFilter* mask = SkBlurMaskFilter::Create(1, SkBlurMaskFilter::kNormal_B
lurStyle); | 145 SkMaskFilter* mask = SkBlurMaskFilter::Create(1, SkBlurMaskFilter::kNormal_B
lurStyle, |
| 146 SkBlurMaskFilter::kNone_BlurFl
ag); |
| 146 paint.setMaskFilter(mask)->unref(); | 147 paint.setMaskFilter(mask)->unref(); |
| 147 | 148 |
| 148 // copy the paint using the copy constructor and check they are the same | 149 // copy the paint using the copy constructor and check they are the same |
| 149 SkPaint copiedPaint = paint; | 150 SkPaint copiedPaint = paint; |
| 150 REPORTER_ASSERT(reporter, paint == copiedPaint); | 151 REPORTER_ASSERT(reporter, paint == copiedPaint); |
| 151 | 152 |
| 152 #ifdef SK_BUILD_FOR_ANDROID | 153 #ifdef SK_BUILD_FOR_ANDROID |
| 153 // the copy constructor should preserve the Generation ID | 154 // the copy constructor should preserve the Generation ID |
| 154 uint32_t paintGenID = paint.getGenerationID(); | 155 uint32_t paintGenID = paint.getGenerationID(); |
| 155 uint32_t copiedPaintGenID = copiedPaint.getGenerationID(); | 156 uint32_t copiedPaintGenID = copiedPaint.getGenerationID(); |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 | 246 |
| 246 // need to implement charsToGlyphs on other backends (e.g. linux, win) | 247 // need to implement charsToGlyphs on other backends (e.g. linux, win) |
| 247 // before we can run this tests everywhere | 248 // before we can run this tests everywhere |
| 248 if (false) { | 249 if (false) { |
| 249 test_cmap(reporter); | 250 test_cmap(reporter); |
| 250 } | 251 } |
| 251 } | 252 } |
| 252 | 253 |
| 253 #include "TestClassDef.h" | 254 #include "TestClassDef.h" |
| 254 DEFINE_TESTCLASS("Paint", TestPaintClass, TestPaint) | 255 DEFINE_TESTCLASS("Paint", TestPaintClass, TestPaint) |
| OLD | NEW |