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 #include "SkDevice.h" | 9 #include "SkDevice.h" |
10 #include "SkDraw.h" | 10 #include "SkDraw.h" |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 | 130 |
131 if (device->fAlreadyDrawn) { | 131 if (device->fAlreadyDrawn) { |
132 return; | 132 return; |
133 } | 133 } |
134 | 134 |
135 device->fInfo.fRestoreOpID = fPicture->EXPERIMENTAL_curOpID(); | 135 device->fInfo.fRestoreOpID = fPicture->EXPERIMENTAL_curOpID(); |
136 device->fInfo.fCTM = *draw.fMatrix; | 136 device->fInfo.fCTM = *draw.fMatrix; |
137 device->fInfo.fCTM.postTranslate(SkIntToScalar(-device->getOrigin().fX), | 137 device->fInfo.fCTM.postTranslate(SkIntToScalar(-device->getOrigin().fX), |
138 SkIntToScalar(-device->getOrigin().fY))
; | 138 SkIntToScalar(-device->getOrigin().fY))
; |
139 | 139 |
140 // We need the x & y values that will yield 'getOrigin' when transformed | 140 device->fInfo.fOffset = device->getOrigin(); |
141 // by 'draw.fMatrix'. | |
142 device->fInfo.fOffset.iset(device->getOrigin()); | |
143 | |
144 SkMatrix invMatrix; | |
145 if (draw.fMatrix->invert(&invMatrix)) { | |
146 invMatrix.mapPoints(&device->fInfo.fOffset, 1); | |
147 } else { | |
148 device->fInfo.fValid = false; | |
149 } | |
150 | 141 |
151 if (NeedsDeepCopy(paint)) { | 142 if (NeedsDeepCopy(paint)) { |
152 // This NULL acts as a signal that the paint was uncopyable (for now
) | 143 // This NULL acts as a signal that the paint was uncopyable (for now
) |
153 device->fInfo.fPaint = NULL; | 144 device->fInfo.fPaint = NULL; |
154 device->fInfo.fValid = false; | 145 device->fInfo.fValid = false; |
155 } else { | 146 } else { |
156 device->fInfo.fPaint = SkNEW_ARGS(SkPaint, (paint)); | 147 device->fInfo.fPaint = SkNEW_ARGS(SkPaint, (paint)); |
157 } | 148 } |
158 | 149 |
159 fAccelData->addSaveLayerInfo(device->fInfo); | 150 fAccelData->addSaveLayerInfo(device->fInfo); |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 void GatherGPUInfo(SkPicture* pict, GPUAccelData* accelData) { | 278 void GatherGPUInfo(SkPicture* pict, GPUAccelData* accelData) { |
288 if (0 == pict->width() || 0 == pict->height()) { | 279 if (0 == pict->width() || 0 == pict->height()) { |
289 return ; | 280 return ; |
290 } | 281 } |
291 | 282 |
292 GrGatherDevice device(pict->width(), pict->height(), pict, accelData, 0); | 283 GrGatherDevice device(pict->width(), pict->height(), pict, accelData, 0); |
293 GrGatherCanvas canvas(&device, pict); | 284 GrGatherCanvas canvas(&device, pict); |
294 | 285 |
295 canvas.gather(); | 286 canvas.gather(); |
296 } | 287 } |
OLD | NEW |