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" |
11 #include "SkPaintPriv.h" | 11 #include "SkPaintPriv.h" |
| 12 #include "SkPicturePlayback.h" |
12 | 13 |
13 SkPicture::AccelData::Key GPUAccelData::ComputeAccelDataKey() { | 14 SkPicture::AccelData::Key GPUAccelData::ComputeAccelDataKey() { |
14 static const SkPicture::AccelData::Key gGPUID = SkPicture::AccelData::Genera
teDomain(); | 15 static const SkPicture::AccelData::Key gGPUID = SkPicture::AccelData::Genera
teDomain(); |
15 | 16 |
16 return gGPUID; | 17 return gGPUID; |
17 } | 18 } |
18 | 19 |
19 // The GrGather device performs GPU-backend-specific preprocessing on | 20 // The GrGather device performs GPU-backend-specific preprocessing on |
20 // a picture. The results are stored in a GPUAccelData. | 21 // a picture. The results are stored in a GPUAccelData. |
21 // | 22 // |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 return; | 243 return; |
243 } | 244 } |
244 | 245 |
245 this->clipRect(SkRect::MakeWH(SkIntToScalar(fPicture->width()), | 246 this->clipRect(SkRect::MakeWH(SkIntToScalar(fPicture->width()), |
246 SkIntToScalar(fPicture->height())), | 247 SkIntToScalar(fPicture->height())), |
247 SkRegion::kIntersect_Op, false); | 248 SkRegion::kIntersect_Op, false); |
248 this->drawPicture(*fPicture); | 249 this->drawPicture(*fPicture); |
249 } | 250 } |
250 | 251 |
251 virtual void drawPicture(SkPicture& picture) SK_OVERRIDE { | 252 virtual void drawPicture(SkPicture& picture) SK_OVERRIDE { |
| 253 // BBH-based rendering doesn't re-issue many of the operations the gathe
r |
| 254 // process cares about (e.g., saves and restores) so it must be disabled
. |
| 255 if (NULL != picture.fPlayback) { |
| 256 picture.fPlayback->setUseBBH(false); |
| 257 } |
252 picture.draw(this); | 258 picture.draw(this); |
| 259 if (NULL != picture.fPlayback) { |
| 260 picture.fPlayback->setUseBBH(true); |
| 261 } |
253 } | 262 } |
254 protected: | 263 protected: |
255 // disable aa for speed | 264 // disable aa for speed |
256 virtual void onClipRect(const SkRect& rect, SkRegion::Op op, ClipEdgeStyle)
SK_OVERRIDE { | 265 virtual void onClipRect(const SkRect& rect, SkRegion::Op op, ClipEdgeStyle)
SK_OVERRIDE { |
257 this->INHERITED::onClipRect(rect, op, kHard_ClipEdgeStyle); | 266 this->INHERITED::onClipRect(rect, op, kHard_ClipEdgeStyle); |
258 } | 267 } |
259 | 268 |
260 // for speed, just respect the bounds, and disable AA. May give us a few | 269 // for speed, just respect the bounds, and disable AA. May give us a few |
261 // false positives and negatives. | 270 // false positives and negatives. |
262 virtual void onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyle)
SK_OVERRIDE { | 271 virtual void onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyle)
SK_OVERRIDE { |
(...skipping 15 matching lines...) Expand all Loading... |
278 void GatherGPUInfo(SkPicture* pict, GPUAccelData* accelData) { | 287 void GatherGPUInfo(SkPicture* pict, GPUAccelData* accelData) { |
279 if (0 == pict->width() || 0 == pict->height()) { | 288 if (0 == pict->width() || 0 == pict->height()) { |
280 return ; | 289 return ; |
281 } | 290 } |
282 | 291 |
283 GrGatherDevice device(pict->width(), pict->height(), pict, accelData, 0); | 292 GrGatherDevice device(pict->width(), pict->height(), pict, accelData, 0); |
284 GrGatherCanvas canvas(&device, pict); | 293 GrGatherCanvas canvas(&device, pict); |
285 | 294 |
286 canvas.gather(); | 295 canvas.gather(); |
287 } | 296 } |
OLD | NEW |