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 "GrPictureUtils.h" | 8 #include "GrPictureUtils.h" |
9 | 9 |
10 #include "SkPaintPriv.h" | 10 #include "SkPaintPriv.h" |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 SkIntToScalar(src.fSize.height()))
; | 119 SkIntToScalar(src.fSize.height()))
; |
120 SkIRect newClip(fCurrentClipBounds); | 120 SkIRect newClip(fCurrentClipBounds); |
121 newClip.intersect(this->adjustAndMap(srcRect, dp.paint)); | 121 newClip.intersect(this->adjustAndMap(srcRect, dp.paint)); |
122 | 122 |
123 dst.fValid = true; | 123 dst.fValid = true; |
124 dst.fPictureID = dp.picture->uniqueID(); | 124 dst.fPictureID = dp.picture->uniqueID(); |
125 dst.fSize = SkISize::Make(newClip.width(), newClip.height()); | 125 dst.fSize = SkISize::Make(newClip.width(), newClip.height()); |
126 dst.fOffset = SkIPoint::Make(newClip.fLeft, newClip.fTop); | 126 dst.fOffset = SkIPoint::Make(newClip.fLeft, newClip.fTop); |
127 dst.fOriginXform = *fCTM; | 127 dst.fOriginXform = *fCTM; |
128 dst.fOriginXform.postConcat(src.fOriginXform); | 128 dst.fOriginXform.postConcat(src.fOriginXform); |
129 dst.fOriginXform.postTranslate(SkIntToScalar(-newClip.fLeft), | |
130 SkIntToScalar(-newClip.fTop)); | |
131 | 129 |
132 if (NULL == src.fPaint) { | 130 if (NULL == src.fPaint) { |
133 dst.fPaint = NULL; | 131 dst.fPaint = NULL; |
134 } else { | 132 } else { |
135 dst.fPaint = SkNEW_ARGS(SkPaint, (*src.fPaint)); | 133 dst.fPaint = SkNEW_ARGS(SkPaint, (*src.fPaint)); |
136 } | 134 } |
137 | 135 |
138 dst.fSaveLayerOpID = src.fSaveLayerOpID; | 136 dst.fSaveLayerOpID = src.fSaveLayerOpID; |
139 dst.fRestoreOpID = src.fRestoreOpID; | 137 dst.fRestoreOpID = src.fRestoreOpID; |
140 dst.fHasNestedLayers = src.fHasNestedLayers; | 138 dst.fHasNestedLayers = src.fHasNestedLayers; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 | 182 |
185 --fSaveLayersInStack; | 183 --fSaveLayersInStack; |
186 | 184 |
187 GrAccelData::SaveLayerInfo slInfo; | 185 GrAccelData::SaveLayerInfo slInfo; |
188 | 186 |
189 slInfo.fValid = true; | 187 slInfo.fValid = true; |
190 slInfo.fPictureID = fPictureID; | 188 slInfo.fPictureID = fPictureID; |
191 slInfo.fSize = SkISize::Make(si.fBounds.width(), si.fBounds.height()); | 189 slInfo.fSize = SkISize::Make(si.fBounds.width(), si.fBounds.height()); |
192 slInfo.fOffset = SkIPoint::Make(si.fBounds.fLeft, si.fBounds.fTop); | 190 slInfo.fOffset = SkIPoint::Make(si.fBounds.fLeft, si.fBounds.fTop); |
193 slInfo.fOriginXform = *fCTM; | 191 slInfo.fOriginXform = *fCTM; |
194 slInfo.fOriginXform.postTranslate(SkIntToScalar(-si.fBounds.fLeft), | |
195 SkIntToScalar(-si.fBounds.fTop)); | |
196 | 192 |
197 if (NULL == si.fPaint) { | 193 if (NULL == si.fPaint) { |
198 slInfo.fPaint = NULL; | 194 slInfo.fPaint = NULL; |
199 } else { | 195 } else { |
200 slInfo.fPaint = SkNEW_ARGS(SkPaint, (*si.fPaint)); | 196 slInfo.fPaint = SkNEW_ARGS(SkPaint, (*si.fPaint)); |
201 } | 197 } |
202 | 198 |
203 slInfo.fSaveLayerOpID = si.fStartIndex; | 199 slInfo.fSaveLayerOpID = si.fStartIndex; |
204 slInfo.fRestoreOpID = fCurrentOp; | 200 slInfo.fRestoreOpID = fCurrentOp; |
205 slInfo.fHasNestedLayers = si.fHasNestedSaveLayer; | 201 slInfo.fHasNestedLayers = si.fHasNestedSaveLayer; |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 } | 265 } |
270 | 266 |
271 SkAutoTUnref<GrAccelData> data(SkNEW_ARGS(GrAccelData, (key))); | 267 SkAutoTUnref<GrAccelData> data(SkNEW_ARGS(GrAccelData, (key))); |
272 | 268 |
273 pict->EXPERIMENTAL_addAccelData(data); | 269 pict->EXPERIMENTAL_addAccelData(data); |
274 | 270 |
275 CollectLayers collector(pict, data); | 271 CollectLayers collector(pict, data); |
276 | 272 |
277 return data; | 273 return data; |
278 } | 274 } |
OLD | NEW |