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 #define COPY(field) field = src.field | 111 memcpy(this, &src, sizeof(src)); |
112 #define REF_COPY(field) field = SkSafeRef(src.field) | |
113 REF_COPY(fTypeface); | |
114 REF_COPY(fPathEffect); | |
115 REF_COPY(fShader); | |
116 REF_COPY(fXfermode); | |
117 REF_COPY(fMaskFilter); | |
118 REF_COPY(fColorFilter); | |
119 REF_COPY(fRasterizer); | |
120 REF_COPY(fLooper); | |
121 REF_COPY(fImageFilter); | |
122 REF_COPY(fAnnotation); | |
123 | 112 |
124 COPY(fTextSize); | 113 SkSafeRef(fTypeface); |
125 COPY(fTextScaleX); | 114 SkSafeRef(fPathEffect); |
126 COPY(fTextSkewX); | 115 SkSafeRef(fShader); |
127 COPY(fColor); | 116 SkSafeRef(fXfermode); |
128 COPY(fWidth); | 117 SkSafeRef(fMaskFilter); |
129 COPY(fMiterLimit); | 118 SkSafeRef(fColorFilter); |
130 COPY(fBitfields); | 119 SkSafeRef(fRasterizer); |
131 COPY(fDirtyBits); | 120 SkSafeRef(fLooper); |
| 121 SkSafeRef(fImageFilter); |
| 122 SkSafeRef(fAnnotation); |
132 | 123 |
133 #ifdef SK_BUILD_FOR_ANDROID | 124 #ifdef SK_BUILD_FOR_ANDROID |
134 new (&fPaintOptionsAndroid) SkPaintOptionsAndroid(src.fPaintOptionsAndroid); | 125 new (&fPaintOptionsAndroid) SkPaintOptionsAndroid(src.fPaintOptionsAndroid); |
135 COPY(fGenerationID); | |
136 #endif | 126 #endif |
137 | |
138 #undef COPY | |
139 #undef REF_COPY | |
140 } | 127 } |
141 | 128 |
142 SkPaint::~SkPaint() { | 129 SkPaint::~SkPaint() { |
143 SkSafeUnref(fTypeface); | 130 SkSafeUnref(fTypeface); |
144 SkSafeUnref(fPathEffect); | 131 SkSafeUnref(fPathEffect); |
145 SkSafeUnref(fShader); | 132 SkSafeUnref(fShader); |
146 SkSafeUnref(fXfermode); | 133 SkSafeUnref(fXfermode); |
147 SkSafeUnref(fMaskFilter); | 134 SkSafeUnref(fMaskFilter); |
148 SkSafeUnref(fColorFilter); | 135 SkSafeUnref(fColorFilter); |
149 SkSafeUnref(fRasterizer); | 136 SkSafeUnref(fRasterizer); |
(...skipping 2520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2670 } | 2657 } |
2671 #ifdef SK_BUILD_FOR_ANDROID | 2658 #ifdef SK_BUILD_FOR_ANDROID |
2672 if (dirty & kPaintOptionsAndroid_DirtyBit) { | 2659 if (dirty & kPaintOptionsAndroid_DirtyBit) { |
2673 SkPaintOptionsAndroid options; | 2660 SkPaintOptionsAndroid options; |
2674 options.unflatten(buffer); | 2661 options.unflatten(buffer); |
2675 paint->setPaintOptionsAndroid(options); | 2662 paint->setPaintOptionsAndroid(options); |
2676 } | 2663 } |
2677 #endif | 2664 #endif |
2678 SkASSERT(dirty == paint->fDirtyBits); | 2665 SkASSERT(dirty == paint->fDirtyBits); |
2679 } | 2666 } |
OLD | NEW |