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 | 9 |
10 #include "SkPaintPriv.h" | 10 #include "SkPaintPriv.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 | 82 |
83 template <typename T> void updateClipBounds(const T&) { /* most ops don't ch
ange the clip */ } | 83 template <typename T> void updateClipBounds(const T&) { /* most ops don't ch
ange the clip */ } |
84 // Each of these devBounds fields is the state of the device bounds after th
e op. | 84 // Each of these devBounds fields is the state of the device bounds after th
e op. |
85 // So Restore's devBounds are those bounds saved by its paired Save or SaveL
ayer. | 85 // So Restore's devBounds are those bounds saved by its paired Save or SaveL
ayer. |
86 void updateClipBounds(const SkRecords::Restore& op) { fCurrentClipBounds
= op.devBounds; } | 86 void updateClipBounds(const SkRecords::Restore& op) { fCurrentClipBounds
= op.devBounds; } |
87 void updateClipBounds(const SkRecords::ClipPath& op) { fCurrentClipBounds
= op.devBounds; } | 87 void updateClipBounds(const SkRecords::ClipPath& op) { fCurrentClipBounds
= op.devBounds; } |
88 void updateClipBounds(const SkRecords::ClipRRect& op) { fCurrentClipBounds
= op.devBounds; } | 88 void updateClipBounds(const SkRecords::ClipRRect& op) { fCurrentClipBounds
= op.devBounds; } |
89 void updateClipBounds(const SkRecords::ClipRect& op) { fCurrentClipBounds
= op.devBounds; } | 89 void updateClipBounds(const SkRecords::ClipRect& op) { fCurrentClipBounds
= op.devBounds; } |
90 void updateClipBounds(const SkRecords::ClipRegion& op) { fCurrentClipBounds
= op.devBounds; } | 90 void updateClipBounds(const SkRecords::ClipRegion& op) { fCurrentClipBounds
= op.devBounds; } |
91 void updateClipBounds(const SkRecords::SaveLayer& op) { | 91 void updateClipBounds(const SkRecords::SaveLayer& op) { |
92 if (NULL != op.bounds) { | 92 if (op.bounds) { |
93 fCurrentClipBounds.intersect(this->adjustAndMap(*op.bounds, op.paint
)); | 93 fCurrentClipBounds.intersect(this->adjustAndMap(*op.bounds, op.paint
)); |
94 } | 94 } |
95 } | 95 } |
96 | 96 |
97 template <typename T> void trackSaveLayers(const T& op) { | 97 template <typename T> void trackSaveLayers(const T& op) { |
98 /* most ops aren't involved in saveLayers */ | 98 /* most ops aren't involved in saveLayers */ |
99 } | 99 } |
100 void trackSaveLayers(const SkRecords::Save& s) { this->pushSaveBlock(); } | 100 void trackSaveLayers(const SkRecords::Save& s) { this->pushSaveBlock(); } |
101 void trackSaveLayers(const SkRecords::SaveLayer& sl) { this->pushSaveLayerBl
ock(sl.paint); } | 101 void trackSaveLayers(const SkRecords::SaveLayer& sl) { this->pushSaveLayerBl
ock(sl.paint); } |
102 void trackSaveLayers(const SkRecords::Restore& r) { this->popSaveBlock(); } | 102 void trackSaveLayers(const SkRecords::Restore& r) { this->popSaveBlock(); } |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 // EXPERIMENTAL_optimize method. | 257 // EXPERIMENTAL_optimize method. |
258 const GrAccelData* GPUOptimize(const SkPicture* pict) { | 258 const GrAccelData* GPUOptimize(const SkPicture* pict) { |
259 if (NULL == pict || pict->cullRect().isEmpty()) { | 259 if (NULL == pict || pict->cullRect().isEmpty()) { |
260 return NULL; | 260 return NULL; |
261 } | 261 } |
262 | 262 |
263 SkPicture::AccelData::Key key = GrAccelData::ComputeAccelDataKey(); | 263 SkPicture::AccelData::Key key = GrAccelData::ComputeAccelDataKey(); |
264 | 264 |
265 const GrAccelData* existing = | 265 const GrAccelData* existing = |
266 static_cast<const GrAccelData*>(pict->EXPERIMENTAL_g
etAccelData(key)); | 266 static_cast<const GrAccelData*>(pict->EXPERIMENTAL_g
etAccelData(key)); |
267 if (NULL != existing) { | 267 if (existing) { |
268 return existing; | 268 return existing; |
269 } | 269 } |
270 | 270 |
271 SkAutoTUnref<GrAccelData> data(SkNEW_ARGS(GrAccelData, (key))); | 271 SkAutoTUnref<GrAccelData> data(SkNEW_ARGS(GrAccelData, (key))); |
272 | 272 |
273 pict->EXPERIMENTAL_addAccelData(data); | 273 pict->EXPERIMENTAL_addAccelData(data); |
274 | 274 |
275 CollectLayers collector(pict, data); | 275 CollectLayers collector(pict, data); |
276 | 276 |
277 return data; | 277 return data; |
278 } | 278 } |
OLD | NEW |