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); |
132 #undef COPY | 121 SkSafeRef(fImageFilter); |
133 #undef REF_COPY | 122 SkSafeRef(fAnnotation); |
134 | 123 |
135 #ifdef SK_BUILD_FOR_ANDROID | 124 #ifdef SK_BUILD_FOR_ANDROID |
136 new (&fPaintOptionsAndroid) SkPaintOptionsAndroid(src.fPaintOptionsAndroid); | 125 new (&fPaintOptionsAndroid) SkPaintOptionsAndroid(src.fPaintOptionsAndroid); |
137 #endif | 126 #endif |
138 } | 127 } |
139 | 128 |
140 SkPaint::~SkPaint() { | 129 SkPaint::~SkPaint() { |
141 SkSafeUnref(fTypeface); | 130 SkSafeUnref(fTypeface); |
142 SkSafeUnref(fPathEffect); | 131 SkSafeUnref(fPathEffect); |
143 SkSafeUnref(fShader); | 132 SkSafeUnref(fShader); |
(...skipping 2524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2668 } | 2657 } |
2669 #ifdef SK_BUILD_FOR_ANDROID | 2658 #ifdef SK_BUILD_FOR_ANDROID |
2670 if (dirty & kPaintOptionsAndroid_DirtyBit) { | 2659 if (dirty & kPaintOptionsAndroid_DirtyBit) { |
2671 SkPaintOptionsAndroid options; | 2660 SkPaintOptionsAndroid options; |
2672 options.unflatten(buffer); | 2661 options.unflatten(buffer); |
2673 paint->setPaintOptionsAndroid(options); | 2662 paint->setPaintOptionsAndroid(options); |
2674 } | 2663 } |
2675 #endif | 2664 #endif |
2676 SkASSERT(dirty == paint->fDirtyBits); | 2665 SkASSERT(dirty == paint->fDirtyBits); |
2677 } | 2666 } |
OLD | NEW |