OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
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 | 8 |
9 #include "SkLayerRasterizer.h" | 9 #include "SkLayerRasterizer.h" |
10 #include "SkDraw.h" | 10 #include "SkDraw.h" |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 SkMatrix drawMatrix; // this translates the path by each l
ayer's offset | 122 SkMatrix drawMatrix; // this translates the path by each l
ayer's offset |
123 | 123 |
124 rectClip.setRect(SkIRect::MakeWH(mask->fBounds.width(), mask->fBounds.he
ight())); | 124 rectClip.setRect(SkIRect::MakeWH(mask->fBounds.width(), mask->fBounds.he
ight())); |
125 | 125 |
126 translatedMatrix = matrix; | 126 translatedMatrix = matrix; |
127 translatedMatrix.postTranslate(-SkIntToScalar(mask->fBounds.fLeft), | 127 translatedMatrix.postTranslate(-SkIntToScalar(mask->fBounds.fLeft), |
128 -SkIntToScalar(mask->fBounds.fTop)); | 128 -SkIntToScalar(mask->fBounds.fTop)); |
129 | 129 |
130 draw.fMatrix = &drawMatrix; | 130 draw.fMatrix = &drawMatrix; |
131 draw.fRC = &rectClip; | 131 draw.fRC = &rectClip; |
132 draw.fClip = &rectClip.bwRgn(); | |
133 // we set the matrixproc in the loop, as the matrix changes each time (p
otentially) | 132 // we set the matrixproc in the loop, as the matrix changes each time (p
otentially) |
134 | 133 |
135 SkDeque::F2BIter iter(*fLayers); | 134 SkDeque::F2BIter iter(*fLayers); |
136 SkLayerRasterizer_Rec* rec; | 135 SkLayerRasterizer_Rec* rec; |
137 | 136 |
138 while ((rec = (SkLayerRasterizer_Rec*)iter.next()) != nullptr) { | 137 while ((rec = (SkLayerRasterizer_Rec*)iter.next()) != nullptr) { |
139 drawMatrix = translatedMatrix; | 138 drawMatrix = translatedMatrix; |
140 drawMatrix.preTranslate(rec->fOffset.fX, rec->fOffset.fY); | 139 drawMatrix.preTranslate(rec->fOffset.fX, rec->fOffset.fY); |
141 draw.drawPath(path, rec->fPaint); | 140 draw.drawPath(path, rec->fPaint); |
142 } | 141 } |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 while ((recOrig = static_cast<SkLayerRasterizer_Rec*>(iter.next())) != nullp
tr) { | 217 while ((recOrig = static_cast<SkLayerRasterizer_Rec*>(iter.next())) != nullp
tr) { |
219 SkDEBUGCODE(count++); | 218 SkDEBUGCODE(count++); |
220 SkLayerRasterizer_Rec* recCopy = static_cast<SkLayerRasterizer_Rec*>(lay
ers->push_back()); | 219 SkLayerRasterizer_Rec* recCopy = static_cast<SkLayerRasterizer_Rec*>(lay
ers->push_back()); |
221 new (&recCopy->fPaint) SkPaint(recOrig->fPaint); | 220 new (&recCopy->fPaint) SkPaint(recOrig->fPaint); |
222 recCopy->fOffset = recOrig->fOffset; | 221 recCopy->fOffset = recOrig->fOffset; |
223 } | 222 } |
224 SkASSERT(fLayers->count() == count); | 223 SkASSERT(fLayers->count() == count); |
225 SkASSERT(layers->count() == count); | 224 SkASSERT(layers->count() == count); |
226 return sk_sp<SkLayerRasterizer>(new SkLayerRasterizer(layers)); | 225 return sk_sp<SkLayerRasterizer>(new SkLayerRasterizer(layers)); |
227 } | 226 } |
OLD | NEW |