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 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
227 // for speed, just respect the bounds, and disable AA. May give us a few | 227 // for speed, just respect the bounds, and disable AA. May give us a few |
228 // false positives and negatives. | 228 // false positives and negatives. |
229 virtual void onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyle) SK_OVERRIDE { | 229 virtual void onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyle) SK_OVERRIDE { |
230 this->updateClipConservativelyUsingBounds(path.getBounds(), op, | 230 this->updateClipConservativelyUsingBounds(path.getBounds(), op, |
231 path.isInverseFillType()); | 231 path.isInverseFillType()); |
232 } | 232 } |
233 virtual void onClipRRect(const SkRRect& rrect, SkRegion::Op op, ClipEdgeStyl e) SK_OVERRIDE { | 233 virtual void onClipRRect(const SkRRect& rrect, SkRegion::Op op, ClipEdgeStyl e) SK_OVERRIDE { |
234 this->updateClipConservativelyUsingBounds(rrect.getBounds(), op, false); | 234 this->updateClipConservativelyUsingBounds(rrect.getBounds(), op, false); |
235 } | 235 } |
236 | 236 |
237 virtual void onDrawPicture(const SkPicture* picture) SK_OVERRIDE { | 237 virtual void onDrawPicture(const SkPicture* picture, const SkMatrix* matrix, |
238 const SkPaint* paint) SK_OVERRIDE { | |
238 if (NULL != picture->fData.get()) { | 239 if (NULL != picture->fData.get()) { |
239 // Disable the BBH for the old path so all the draw calls | 240 // Disable the BBH for the old path so all the draw calls |
240 // will be seen. The stock SkPicture::draw method can't be | 241 // will be seen. The stock SkPicture::draw method can't be |
241 // invoked since it just uses a vanilla SkPicturePlayback. | 242 // invoked since it just uses a vanilla SkPicturePlayback. |
242 SkPicturePlayback playback(picture); | 243 SkPicturePlayback playback(picture); |
243 playback.setUseBBH(false); | 244 playback.setUseBBH(false); |
244 playback.draw(this, NULL); | 245 playback.draw(this, NULL); |
mtklein
2014/08/07 21:25:20
Seems like we should pass matrix and paint through
reed1
2014/08/08 13:57:29
Done.
| |
245 } else { | 246 } else { |
246 // Since we know this is the SkRecord path we can just call | 247 // Since we know this is the SkRecord path we can just call |
247 // SkPicture::draw. | 248 // SkPicture::draw. |
248 picture->draw(this); | 249 picture->draw(this); |
mtklein
2014/08/07 21:25:20
... and here?
reed1
2014/08/08 13:57:29
Done.
| |
249 } | 250 } |
250 } | 251 } |
251 | 252 |
252 private: | 253 private: |
253 typedef SkCanvas INHERITED; | 254 typedef SkCanvas INHERITED; |
254 }; | 255 }; |
255 | 256 |
256 // GatherGPUInfo is only intended to be called within the context of SkGpuDevice 's | 257 // GatherGPUInfo is only intended to be called within the context of SkGpuDevice 's |
257 // EXPERIMENTAL_optimize method. | 258 // EXPERIMENTAL_optimize method. |
258 void GatherGPUInfo(const SkPicture* pict, GPUAccelData* accelData) { | 259 void GatherGPUInfo(const SkPicture* pict, GPUAccelData* accelData) { |
259 if (NULL == pict || 0 == pict->width() || 0 == pict->height()) { | 260 if (NULL == pict || 0 == pict->width() || 0 == pict->height()) { |
260 return ; | 261 return ; |
261 } | 262 } |
262 | 263 |
263 // BBH-based rendering doesn't re-issue many of the operations the gather | 264 // BBH-based rendering doesn't re-issue many of the operations the gather |
264 // process cares about (e.g., saves and restores) so it must be disabled. | 265 // process cares about (e.g., saves and restores) so it must be disabled. |
265 SkPicturePlayback playback(pict); | 266 SkPicturePlayback playback(pict); |
266 playback.setUseBBH(false); | 267 playback.setUseBBH(false); |
267 | 268 |
268 GrGatherDevice device(pict->width(), pict->height(), &playback, accelData, 0 ); | 269 GrGatherDevice device(pict->width(), pict->height(), &playback, accelData, 0 ); |
269 GrGatherCanvas canvas(&device); | 270 GrGatherCanvas canvas(&device); |
270 | 271 |
271 canvas.clipRect(SkRect::MakeWH(SkIntToScalar(pict->width()), | 272 canvas.clipRect(SkRect::MakeWH(SkIntToScalar(pict->width()), |
272 SkIntToScalar(pict->height())), | 273 SkIntToScalar(pict->height())), |
273 SkRegion::kIntersect_Op, false); | 274 SkRegion::kIntersect_Op, false); |
274 playback.draw(&canvas, NULL); | 275 playback.draw(&canvas, NULL); |
275 } | 276 } |
OLD | NEW |