| 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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 | 117 |
| 118 this->updateStackForSaveLayer(); | 118 this->updateStackForSaveLayer(); |
| 119 | 119 |
| 120 GrAccelData::SaveLayerInfo& dst = fAccelData->addSaveLayerInfo(); | 120 GrAccelData::SaveLayerInfo& dst = fAccelData->addSaveLayerInfo(); |
| 121 | 121 |
| 122 // If src.fPicture is NULL the layer is in dp.picture; otherwise | 122 // If src.fPicture is NULL the layer is in dp.picture; otherwise |
| 123 // it belongs to a sub-picture. | 123 // it belongs to a sub-picture. |
| 124 dst.fPicture = src.fPicture ? src.fPicture : static_cast<const SkPic
ture*>(dp.picture); | 124 dst.fPicture = src.fPicture ? src.fPicture : static_cast<const SkPic
ture*>(dp.picture); |
| 125 dst.fPicture->ref(); | 125 dst.fPicture->ref(); |
| 126 dst.fBounds = newClip; | 126 dst.fBounds = newClip; |
| 127 dst.fOriginXform = src.fOriginXform; | 127 dst.fLocalMat = src.fLocalMat; |
| 128 dst.fOriginXform.postConcat(*fCTM); | 128 dst.fPreMat = src.fPreMat; |
| 129 dst.fPreMat.preConcat(*fCTM); |
| 129 if (src.fPaint) { | 130 if (src.fPaint) { |
| 130 dst.fPaint = SkNEW_ARGS(SkPaint, (*src.fPaint)); | 131 dst.fPaint = SkNEW_ARGS(SkPaint, (*src.fPaint)); |
| 131 } | 132 } |
| 132 dst.fSaveLayerOpID = src.fSaveLayerOpID; | 133 dst.fSaveLayerOpID = src.fSaveLayerOpID; |
| 133 dst.fRestoreOpID = src.fRestoreOpID; | 134 dst.fRestoreOpID = src.fRestoreOpID; |
| 134 dst.fHasNestedLayers = src.fHasNestedLayers; | 135 dst.fHasNestedLayers = src.fHasNestedLayers; |
| 135 dst.fIsNested = fSaveLayersInStack > 0 || src.fIsNested; | 136 dst.fIsNested = fSaveLayersInStack > 0 || src.fIsNested; |
| 136 } | 137 } |
| 137 } | 138 } |
| 138 | 139 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 if (!si.fIsSaveLayer) { | 174 if (!si.fIsSaveLayer) { |
| 174 return; | 175 return; |
| 175 } | 176 } |
| 176 | 177 |
| 177 --fSaveLayersInStack; | 178 --fSaveLayersInStack; |
| 178 | 179 |
| 179 GrAccelData::SaveLayerInfo& slInfo = fAccelData->addSaveLayerInfo(); | 180 GrAccelData::SaveLayerInfo& slInfo = fAccelData->addSaveLayerInfo(); |
| 180 | 181 |
| 181 SkASSERT(NULL == slInfo.fPicture); // This layer is in the top-most pic
ture | 182 SkASSERT(NULL == slInfo.fPicture); // This layer is in the top-most pic
ture |
| 182 slInfo.fBounds = si.fBounds; | 183 slInfo.fBounds = si.fBounds; |
| 183 slInfo.fOriginXform = *fCTM; | 184 slInfo.fLocalMat = *fCTM; |
| 185 slInfo.fPreMat = SkMatrix::I(); |
| 184 if (si.fPaint) { | 186 if (si.fPaint) { |
| 185 slInfo.fPaint = SkNEW_ARGS(SkPaint, (*si.fPaint)); | 187 slInfo.fPaint = SkNEW_ARGS(SkPaint, (*si.fPaint)); |
| 186 } | 188 } |
| 187 slInfo.fSaveLayerOpID = si.fStartIndex; | 189 slInfo.fSaveLayerOpID = si.fStartIndex; |
| 188 slInfo.fRestoreOpID = fCurrentOp; | 190 slInfo.fRestoreOpID = fCurrentOp; |
| 189 slInfo.fHasNestedLayers = si.fHasNestedSaveLayer; | 191 slInfo.fHasNestedLayers = si.fHasNestedSaveLayer; |
| 190 slInfo.fIsNested = fSaveLayersInStack > 0; | 192 slInfo.fIsNested = fSaveLayersInStack > 0; |
| 191 } | 193 } |
| 192 | 194 |
| 193 // Returns true if rect was meaningfully adjusted for the effects of paint, | 195 // Returns true if rect was meaningfully adjusted for the effects of paint, |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 } | 253 } |
| 252 | 254 |
| 253 SkAutoTUnref<GrAccelData> data(SkNEW_ARGS(GrAccelData, (key))); | 255 SkAutoTUnref<GrAccelData> data(SkNEW_ARGS(GrAccelData, (key))); |
| 254 | 256 |
| 255 pict->EXPERIMENTAL_addAccelData(data); | 257 pict->EXPERIMENTAL_addAccelData(data); |
| 256 | 258 |
| 257 CollectLayers collector(pict, data); | 259 CollectLayers collector(pict, data); |
| 258 | 260 |
| 259 return data; | 261 return data; |
| 260 } | 262 } |
| OLD | NEW |