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 "SkCanvasPriv.h" |
9 #include "SkDevice.h" | 10 #include "SkDevice.h" |
10 #include "SkDraw.h" | 11 #include "SkDraw.h" |
11 #include "SkPaintPriv.h" | 12 #include "SkPaintPriv.h" |
12 #include "SkPictureData.h" | 13 #include "SkPictureData.h" |
13 #include "SkPicturePlayback.h" | 14 #include "SkPicturePlayback.h" |
14 | 15 |
15 SkPicture::AccelData::Key GPUAccelData::ComputeAccelDataKey() { | 16 SkPicture::AccelData::Key GPUAccelData::ComputeAccelDataKey() { |
16 static const SkPicture::AccelData::Key gGPUID = SkPicture::AccelData::Genera
teDomain(); | 17 static const SkPicture::AccelData::Key gGPUID = SkPicture::AccelData::Genera
teDomain(); |
17 | 18 |
18 return gGPUID; | 19 return gGPUID; |
(...skipping 208 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 | 228 // for speed, just respect the bounds, and disable AA. May give us a few |
228 // false positives and negatives. | 229 // false positives and negatives. |
229 virtual void onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyle)
SK_OVERRIDE { | 230 virtual void onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyle)
SK_OVERRIDE { |
230 this->updateClipConservativelyUsingBounds(path.getBounds(), op, | 231 this->updateClipConservativelyUsingBounds(path.getBounds(), op, |
231 path.isInverseFillType()); | 232 path.isInverseFillType()); |
232 } | 233 } |
233 virtual void onClipRRect(const SkRRect& rrect, SkRegion::Op op, ClipEdgeStyl
e) SK_OVERRIDE { | 234 virtual void onClipRRect(const SkRRect& rrect, SkRegion::Op op, ClipEdgeStyl
e) SK_OVERRIDE { |
234 this->updateClipConservativelyUsingBounds(rrect.getBounds(), op, false); | 235 this->updateClipConservativelyUsingBounds(rrect.getBounds(), op, false); |
235 } | 236 } |
236 | 237 |
237 virtual void onDrawPicture(const SkPicture* picture) SK_OVERRIDE { | 238 virtual void onDrawPicture(const SkPicture* picture, const SkMatrix* matrix, |
| 239 const SkPaint* paint) SK_OVERRIDE { |
| 240 SkAutoCanvasMatrixPaint acmp(this, matrix, paint, picture->width(), pict
ure->height()); |
| 241 |
238 if (NULL != picture->fData.get()) { | 242 if (NULL != picture->fData.get()) { |
239 // Disable the BBH for the old path so all the draw calls | 243 // Disable the BBH for the old path so all the draw calls |
240 // will be seen. The stock SkPicture::draw method can't be | 244 // will be seen. The stock SkPicture::draw method can't be |
241 // invoked since it just uses a vanilla SkPicturePlayback. | 245 // invoked since it just uses a vanilla SkPicturePlayback. |
242 SkPicturePlayback playback(picture); | 246 SkPicturePlayback playback(picture); |
243 playback.setUseBBH(false); | 247 playback.setUseBBH(false); |
244 playback.draw(this, NULL); | 248 playback.draw(this, NULL); |
245 } else { | 249 } else { |
246 // Since we know this is the SkRecord path we can just call | 250 // Since we know this is the SkRecord path we can just call |
247 // SkPicture::draw. | 251 // SkPicture::draw. |
(...skipping 18 matching lines...) Expand all Loading... |
266 playback.setUseBBH(false); | 270 playback.setUseBBH(false); |
267 | 271 |
268 GrGatherDevice device(pict->width(), pict->height(), &playback, accelData, 0
); | 272 GrGatherDevice device(pict->width(), pict->height(), &playback, accelData, 0
); |
269 GrGatherCanvas canvas(&device); | 273 GrGatherCanvas canvas(&device); |
270 | 274 |
271 canvas.clipRect(SkRect::MakeWH(SkIntToScalar(pict->width()), | 275 canvas.clipRect(SkRect::MakeWH(SkIntToScalar(pict->width()), |
272 SkIntToScalar(pict->height())), | 276 SkIntToScalar(pict->height())), |
273 SkRegion::kIntersect_Op, false); | 277 SkRegion::kIntersect_Op, false); |
274 playback.draw(&canvas, NULL); | 278 playback.draw(&canvas, NULL); |
275 } | 279 } |
OLD | NEW |