OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 "SkRecordOpts.h" | 8 #include "SkRecordOpts.h" |
9 | 9 |
10 #include "SkRecordPattern.h" | 10 #include "SkRecordPattern.h" |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 | 124 |
125 SkPaint* drawPaint = pattern->second<SkPaint>(); | 125 SkPaint* drawPaint = pattern->second<SkPaint>(); |
126 if (drawPaint == NULL) { | 126 if (drawPaint == NULL) { |
127 // We can just give the draw the SaveLayer's paint. | 127 // We can just give the draw the SaveLayer's paint. |
128 // TODO(mtklein): figure out how to do this clearly | 128 // TODO(mtklein): figure out how to do this clearly |
129 return false; | 129 return false; |
130 } | 130 } |
131 | 131 |
132 const uint32_t layerColor = layerPaint->getColor(); | 132 const uint32_t layerColor = layerPaint->getColor(); |
133 const uint32_t drawColor = drawPaint->getColor(); | 133 const uint32_t drawColor = drawPaint->getColor(); |
134 if (!IsOnlyAlpha(layerColor) || !IsOpaque(drawColor) || HasAnyEffect(*la
yerPaint)) { | 134 if (!IsOnlyAlpha(layerColor) || !IsOpaque(drawColor) || |
| 135 HasAnyEffect(*layerPaint) || HasAnyEffect(*drawPaint)) { |
135 // Too fancy for us. Actually, as long as layerColor is just an alp
ha | 136 // Too fancy for us. Actually, as long as layerColor is just an alp
ha |
136 // we can blend it into drawColor's alpha; drawColor doesn't strictl
y have to be opaque. | 137 // we can blend it into drawColor's alpha; drawColor doesn't strictl
y have to be opaque. |
137 return false; | 138 return false; |
138 } | 139 } |
139 | 140 |
140 drawPaint->setColor(SkColorSetA(drawColor, SkColorGetA(layerColor))); | 141 drawPaint->setColor(SkColorSetA(drawColor, SkColorGetA(layerColor))); |
141 return KillSaveLayerAndRestore(record, begin); | 142 return KillSaveLayerAndRestore(record, begin); |
142 } | 143 } |
143 | 144 |
144 static bool KillSaveLayerAndRestore(SkRecord* record, unsigned saveLayerInde
x) { | 145 static bool KillSaveLayerAndRestore(SkRecord* record, unsigned saveLayerInde
x) { |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 }; | 294 }; |
294 | 295 |
295 SkTDArray<Pair> fPushStack; | 296 SkTDArray<Pair> fPushStack; |
296 SkRecord* fRecord; | 297 SkRecord* fRecord; |
297 unsigned fIndex; | 298 unsigned fIndex; |
298 }; | 299 }; |
299 void SkRecordAnnotateCullingPairs(SkRecord* record) { | 300 void SkRecordAnnotateCullingPairs(SkRecord* record) { |
300 CullAnnotator pass; | 301 CullAnnotator pass; |
301 pass.apply(record); | 302 pass.apply(record); |
302 } | 303 } |
OLD | NEW |