| 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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 // TODO: need to store an SkRect in GrAccelData::SaveLayerInfo? | 113 // TODO: need to store an SkRect in GrAccelData::SaveLayerInfo? |
| 114 SkRect srcRect = SkRect::MakeXYWH(SkIntToScalar(src.fOffset.fX), | 114 SkRect srcRect = SkRect::MakeXYWH(SkIntToScalar(src.fOffset.fX), |
| 115 SkIntToScalar(src.fOffset.fY), | 115 SkIntToScalar(src.fOffset.fY), |
| 116 SkIntToScalar(src.fSize.width()), | 116 SkIntToScalar(src.fSize.width()), |
| 117 SkIntToScalar(src.fSize.height()))
; | 117 SkIntToScalar(src.fSize.height()))
; |
| 118 SkIRect newClip(fCurrentClipBounds); | 118 SkIRect newClip(fCurrentClipBounds); |
| 119 newClip.intersect(this->adjustAndMap(srcRect, dp.paint)); | 119 newClip.intersect(this->adjustAndMap(srcRect, dp.paint)); |
| 120 | 120 |
| 121 GrAccelData::SaveLayerInfo& dst = fAccelData->addSaveLayerInfo(); | 121 GrAccelData::SaveLayerInfo& dst = fAccelData->addSaveLayerInfo(); |
| 122 | 122 |
| 123 dst.fValid = true; | |
| 124 // If src.fPicture is NULL the layer is in dp.picture; otherwise | 123 // If src.fPicture is NULL the layer is in dp.picture; otherwise |
| 125 // it belongs to a sub-picture. | 124 // it belongs to a sub-picture. |
| 126 dst.fPicture = src.fPicture ? src.fPicture : static_cast<const SkPic
ture*>(dp.picture); | 125 dst.fPicture = src.fPicture ? src.fPicture : static_cast<const SkPic
ture*>(dp.picture); |
| 127 dst.fPicture->ref(); | 126 dst.fPicture->ref(); |
| 128 dst.fSize = SkISize::Make(newClip.width(), newClip.height()); | 127 dst.fSize = SkISize::Make(newClip.width(), newClip.height()); |
| 129 dst.fOffset = SkIPoint::Make(newClip.fLeft, newClip.fTop); | 128 dst.fOffset = SkIPoint::Make(newClip.fLeft, newClip.fTop); |
| 130 dst.fOriginXform = src.fOriginXform; | 129 dst.fOriginXform = src.fOriginXform; |
| 131 dst.fOriginXform.postConcat(*fCTM); | 130 dst.fOriginXform.postConcat(*fCTM); |
| 132 if (src.fPaint) { | 131 if (src.fPaint) { |
| 133 dst.fPaint = SkNEW_ARGS(SkPaint, (*src.fPaint)); | 132 dst.fPaint = SkNEW_ARGS(SkPaint, (*src.fPaint)); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 fSaveStack.pop(&si); | 173 fSaveStack.pop(&si); |
| 175 | 174 |
| 176 if (!si.fIsSaveLayer) { | 175 if (!si.fIsSaveLayer) { |
| 177 return; | 176 return; |
| 178 } | 177 } |
| 179 | 178 |
| 180 --fSaveLayersInStack; | 179 --fSaveLayersInStack; |
| 181 | 180 |
| 182 GrAccelData::SaveLayerInfo& slInfo = fAccelData->addSaveLayerInfo(); | 181 GrAccelData::SaveLayerInfo& slInfo = fAccelData->addSaveLayerInfo(); |
| 183 | 182 |
| 184 slInfo.fValid = true; | |
| 185 SkASSERT(NULL == slInfo.fPicture); // This layer is in the top-most pic
ture | 183 SkASSERT(NULL == slInfo.fPicture); // This layer is in the top-most pic
ture |
| 186 slInfo.fSize = SkISize::Make(si.fBounds.width(), si.fBounds.height()); | 184 slInfo.fSize = SkISize::Make(si.fBounds.width(), si.fBounds.height()); |
| 187 slInfo.fOffset = SkIPoint::Make(si.fBounds.fLeft, si.fBounds.fTop); | 185 slInfo.fOffset = SkIPoint::Make(si.fBounds.fLeft, si.fBounds.fTop); |
| 188 slInfo.fOriginXform = *fCTM; | 186 slInfo.fOriginXform = *fCTM; |
| 189 if (si.fPaint) { | 187 if (si.fPaint) { |
| 190 slInfo.fPaint = SkNEW_ARGS(SkPaint, (*si.fPaint)); | 188 slInfo.fPaint = SkNEW_ARGS(SkPaint, (*si.fPaint)); |
| 191 } | 189 } |
| 192 slInfo.fSaveLayerOpID = si.fStartIndex; | 190 slInfo.fSaveLayerOpID = si.fStartIndex; |
| 193 slInfo.fRestoreOpID = fCurrentOp; | 191 slInfo.fRestoreOpID = fCurrentOp; |
| 194 slInfo.fHasNestedLayers = si.fHasNestedSaveLayer; | 192 slInfo.fHasNestedLayers = si.fHasNestedSaveLayer; |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 } | 254 } |
| 257 | 255 |
| 258 SkAutoTUnref<GrAccelData> data(SkNEW_ARGS(GrAccelData, (key))); | 256 SkAutoTUnref<GrAccelData> data(SkNEW_ARGS(GrAccelData, (key))); |
| 259 | 257 |
| 260 pict->EXPERIMENTAL_addAccelData(data); | 258 pict->EXPERIMENTAL_addAccelData(data); |
| 261 | 259 |
| 262 CollectLayers collector(pict, data); | 260 CollectLayers collector(pict, data); |
| 263 | 261 |
| 264 return data; | 262 return data; |
| 265 } | 263 } |
| OLD | NEW |