| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 #include "SkPaint.h" | 9 #include "SkPaint.h" |
| 10 #include "SkAnnotation.h" | 10 #include "SkAnnotation.h" |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 fStyle = kFill_Style; | 101 fStyle = kFill_Style; |
| 102 fTextEncoding = kUTF8_TextEncoding; | 102 fTextEncoding = kUTF8_TextEncoding; |
| 103 fHinting = SkPaintDefaults_Hinting; | 103 fHinting = SkPaintDefaults_Hinting; |
| 104 #ifdef SK_BUILD_FOR_ANDROID | 104 #ifdef SK_BUILD_FOR_ANDROID |
| 105 new (&fPaintOptionsAndroid) SkPaintOptionsAndroid; | 105 new (&fPaintOptionsAndroid) SkPaintOptionsAndroid; |
| 106 fGenerationID = 0; | 106 fGenerationID = 0; |
| 107 #endif | 107 #endif |
| 108 } | 108 } |
| 109 | 109 |
| 110 SkPaint::SkPaint(const SkPaint& src) { | 110 SkPaint::SkPaint(const SkPaint& src) { |
| 111 memcpy(this, &src, sizeof(src)); | 111 #define COPY(field) field = src.field |
| 112 #define REF_COPY(field) field = SkSafeRef(src.field) |
| 113 COPY(fTextSize); |
| 114 COPY(fTextScaleX); |
| 115 COPY(fTextSkewX); |
| 116 COPY(fColor); |
| 117 COPY(fWidth); |
| 118 COPY(fMiterLimit); |
| 112 | 119 |
| 113 SkSafeRef(fTypeface); | 120 REF_COPY(fTypeface); |
| 114 SkSafeRef(fPathEffect); | 121 REF_COPY(fPathEffect); |
| 115 SkSafeRef(fShader); | 122 REF_COPY(fShader); |
| 116 SkSafeRef(fXfermode); | 123 REF_COPY(fXfermode); |
| 117 SkSafeRef(fMaskFilter); | 124 REF_COPY(fMaskFilter); |
| 118 SkSafeRef(fColorFilter); | 125 REF_COPY(fColorFilter); |
| 119 SkSafeRef(fRasterizer); | 126 REF_COPY(fRasterizer); |
| 120 SkSafeRef(fLooper); | 127 REF_COPY(fLooper); |
| 121 SkSafeRef(fImageFilter); | 128 REF_COPY(fImageFilter); |
| 122 SkSafeRef(fAnnotation); | 129 REF_COPY(fAnnotation); |
| 130 |
| 131 COPY(fBitfields); |
| 132 COPY(fDirtyBits); |
| 133 #undef COPY |
| 134 #undef REF_COPY |
| 123 | 135 |
| 124 #ifdef SK_BUILD_FOR_ANDROID | 136 #ifdef SK_BUILD_FOR_ANDROID |
| 125 new (&fPaintOptionsAndroid) SkPaintOptionsAndroid(src.fPaintOptionsAndroid); | 137 new (&fPaintOptionsAndroid) SkPaintOptionsAndroid(src.fPaintOptionsAndroid); |
| 126 #endif | 138 #endif |
| 127 } | 139 } |
| 128 | 140 |
| 129 SkPaint::~SkPaint() { | 141 SkPaint::~SkPaint() { |
| 130 SkSafeUnref(fTypeface); | 142 SkSafeUnref(fTypeface); |
| 131 SkSafeUnref(fPathEffect); | 143 SkSafeUnref(fPathEffect); |
| 132 SkSafeUnref(fShader); | 144 SkSafeUnref(fShader); |
| (...skipping 2524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2657 } | 2669 } |
| 2658 #ifdef SK_BUILD_FOR_ANDROID | 2670 #ifdef SK_BUILD_FOR_ANDROID |
| 2659 if (dirty & kPaintOptionsAndroid_DirtyBit) { | 2671 if (dirty & kPaintOptionsAndroid_DirtyBit) { |
| 2660 SkPaintOptionsAndroid options; | 2672 SkPaintOptionsAndroid options; |
| 2661 options.unflatten(buffer); | 2673 options.unflatten(buffer); |
| 2662 paint->setPaintOptionsAndroid(options); | 2674 paint->setPaintOptionsAndroid(options); |
| 2663 } | 2675 } |
| 2664 #endif | 2676 #endif |
| 2665 SkASSERT(dirty == paint->fDirtyBits); | 2677 SkASSERT(dirty == paint->fDirtyBits); |
| 2666 } | 2678 } |
| OLD | NEW |