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 #include "SkPictureData.h" |
13 | 13 |
14 SkPicture::AccelData::Key GPUAccelData::ComputeAccelDataKey() { | 14 SkPicture::AccelData::Key GPUAccelData::ComputeAccelDataKey() { |
15 static const SkPicture::AccelData::Key gGPUID = SkPicture::AccelData::Genera
teDomain(); | 15 static const SkPicture::AccelData::Key gGPUID = SkPicture::AccelData::Genera
teDomain(); |
16 | 16 |
17 return gGPUID; | 17 return gGPUID; |
18 } | 18 } |
19 | 19 |
20 // The GrGather device performs GPU-backend-specific preprocessing on | 20 // The GrGather device performs GPU-backend-specific preprocessing on |
21 // a picture. The results are stored in a GPUAccelData. | 21 // a picture. The results are stored in a GPUAccelData. |
22 // | 22 // |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 this->updateClipConservativelyUsingBounds(path.getBounds(), op, | 243 this->updateClipConservativelyUsingBounds(path.getBounds(), op, |
244 path.isInverseFillType()); | 244 path.isInverseFillType()); |
245 } | 245 } |
246 virtual void onClipRRect(const SkRRect& rrect, SkRegion::Op op, ClipEdgeStyl
e) SK_OVERRIDE { | 246 virtual void onClipRRect(const SkRRect& rrect, SkRegion::Op op, ClipEdgeStyl
e) SK_OVERRIDE { |
247 this->updateClipConservativelyUsingBounds(rrect.getBounds(), op, false); | 247 this->updateClipConservativelyUsingBounds(rrect.getBounds(), op, false); |
248 } | 248 } |
249 | 249 |
250 virtual void onDrawPicture(const SkPicture* picture) SK_OVERRIDE { | 250 virtual void onDrawPicture(const SkPicture* picture) SK_OVERRIDE { |
251 // BBH-based rendering doesn't re-issue many of the operations the gathe
r | 251 // BBH-based rendering doesn't re-issue many of the operations the gathe
r |
252 // process cares about (e.g., saves and restores) so it must be disabled
. | 252 // process cares about (e.g., saves and restores) so it must be disabled
. |
253 if (NULL != picture->fPlayback.get()) { | 253 if (NULL != picture->fData.get()) { |
254 picture->fPlayback->setUseBBH(false); | 254 picture->fData->setUseBBH(false); |
255 } | 255 } |
256 picture->draw(this); | 256 picture->draw(this); |
257 if (NULL != picture->fPlayback.get()) { | 257 if (NULL != picture->fData.get()) { |
258 picture->fPlayback->setUseBBH(true); | 258 picture->fData->setUseBBH(true); |
259 } | 259 } |
260 } | 260 } |
261 | 261 |
262 private: | 262 private: |
263 const SkPicture* fPicture; | 263 const SkPicture* fPicture; |
264 | 264 |
265 typedef SkCanvas INHERITED; | 265 typedef SkCanvas INHERITED; |
266 }; | 266 }; |
267 | 267 |
268 // GatherGPUInfo is only intended to be called within the context of SkGpuDevice
's | 268 // GatherGPUInfo is only intended to be called within the context of SkGpuDevice
's |
269 // EXPERIMENTAL_optimize method. | 269 // EXPERIMENTAL_optimize method. |
270 void GatherGPUInfo(const SkPicture* pict, GPUAccelData* accelData) { | 270 void GatherGPUInfo(const SkPicture* pict, GPUAccelData* accelData) { |
271 if (0 == pict->width() || 0 == pict->height()) { | 271 if (0 == pict->width() || 0 == pict->height()) { |
272 return ; | 272 return ; |
273 } | 273 } |
274 | 274 |
275 GrGatherDevice device(pict->width(), pict->height(), pict, accelData, 0); | 275 GrGatherDevice device(pict->width(), pict->height(), pict, accelData, 0); |
276 GrGatherCanvas canvas(&device, pict); | 276 GrGatherCanvas canvas(&device, pict); |
277 | 277 |
278 canvas.gather(); | 278 canvas.gather(); |
279 } | 279 } |
OLD | NEW |