OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 "SkCanvasPriv.h" | 8 #include "SkCanvasPriv.h" |
9 #include "SkClipStack.h" | 9 #include "SkClipStack.h" |
10 #include "SkDebugCanvas.h" | 10 #include "SkDebugCanvas.h" |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 fActiveLayers.pop(); | 189 fActiveLayers.pop(); |
190 } | 190 } |
191 } | 191 } |
192 | 192 |
193 for (int i = 0; i < fActiveLayers.count(); ++i) { | 193 for (int i = 0; i < fActiveLayers.count(); ++i) { |
194 fActiveLayers[i]->setActive(true); | 194 fActiveLayers[i]->setActive(true); |
195 } | 195 } |
196 | 196 |
197 } | 197 } |
198 | 198 |
199 void SkDebugCanvas::drawTo(SkCanvas* canvas, int index) { | 199 void SkDebugCanvas::drawTo(SkCanvas* canvas, int index, int m) { |
200 SkASSERT(!fCommandVector.isEmpty()); | 200 SkASSERT(!fCommandVector.isEmpty()); |
201 SkASSERT(index < fCommandVector.count()); | 201 SkASSERT(index < fCommandVector.count()); |
202 | 202 |
203 int saveCount = canvas->save(); | 203 int saveCount = canvas->save(); |
204 | 204 |
205 SkRect windowRect = SkRect::MakeWH(SkIntToScalar(canvas->getBaseLayerSize().
width()), | 205 SkRect windowRect = SkRect::MakeWH(SkIntToScalar(canvas->getBaseLayerSize().
width()), |
206 SkIntToScalar(canvas->getBaseLayerSize().
height())); | 206 SkIntToScalar(canvas->getBaseLayerSize().
height())); |
207 | 207 |
208 bool pathOpsMode = getAllowSimplifyClip(); | 208 bool pathOpsMode = getAllowSimplifyClip(); |
209 canvas->setAllowSimplifyClip(pathOpsMode); | 209 canvas->setAllowSimplifyClip(pathOpsMode); |
(...skipping 11 matching lines...) Expand all Loading... |
221 } | 221 } |
222 | 222 |
223 if (fMegaVizMode) { | 223 if (fMegaVizMode) { |
224 this->markActiveCommands(index); | 224 this->markActiveCommands(index); |
225 } | 225 } |
226 | 226 |
227 // If we have a GPU backend we can also visualize the batching information | 227 // If we have a GPU backend we can also visualize the batching information |
228 #if SK_SUPPORT_GPU | 228 #if SK_SUPPORT_GPU |
229 GrAuditTrail* at = nullptr; | 229 GrAuditTrail* at = nullptr; |
230 GrRenderTarget* rt = canvas->internal_private_accessTopLayerRenderTarget(); | 230 GrRenderTarget* rt = canvas->internal_private_accessTopLayerRenderTarget(); |
231 if (rt && fDrawGpuBatchBounds) { | 231 if (rt && (fDrawGpuBatchBounds || m != -1)) { |
232 GrContext* ctx = rt->getContext(); | 232 GrContext* ctx = rt->getContext(); |
233 if (ctx) { | 233 if (ctx) { |
234 at = ctx->getAuditTrail(); | 234 at = ctx->getAuditTrail(); |
235 } | 235 } |
236 } | 236 } |
237 #endif | 237 #endif |
238 | 238 |
239 for (int i = 0; i <= index; i++) { | 239 for (int i = 0; i <= index; i++) { |
240 if (i == index && fFilter) { | 240 if (i == index && fFilter) { |
241 canvas->clear(0xAAFFFFFF); | 241 canvas->clear(0xAAFFFFFF); |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 // draw any batches if required and issue a full reset onto GrAuditTrail | 332 // draw any batches if required and issue a full reset onto GrAuditTrail |
333 if (at) { | 333 if (at) { |
334 // get the render target of the top device so we can ignore batches draw
n offscreen | 334 // get the render target of the top device so we can ignore batches draw
n offscreen |
335 SkBaseDevice* bd = canvas->getDevice_just_for_deprecated_compatibility_t
esting(); | 335 SkBaseDevice* bd = canvas->getDevice_just_for_deprecated_compatibility_t
esting(); |
336 SkGpuDevice* gbd = reinterpret_cast<SkGpuDevice*>(bd); | 336 SkGpuDevice* gbd = reinterpret_cast<SkGpuDevice*>(bd); |
337 uint32_t rtID = gbd->accessRenderTarget()->getUniqueID(); | 337 uint32_t rtID = gbd->accessRenderTarget()->getUniqueID(); |
338 | 338 |
339 // get the bounding boxes to draw | 339 // get the bounding boxes to draw |
340 GrAuditTrail::AutoEnable ae(at); | 340 GrAuditTrail::AutoEnable ae(at); |
341 SkTArray<GrAuditTrail::BatchInfo> childrenBounds; | 341 SkTArray<GrAuditTrail::BatchInfo> childrenBounds; |
342 at->getBoundsByClientID(&childrenBounds, index); | 342 if (m == -1) { |
| 343 at->getBoundsByClientID(&childrenBounds, index); |
| 344 } else { |
| 345 // the client wants us to draw the mth batch |
| 346 at->getBoundsByBatchListID(&childrenBounds.push_back(), m); |
| 347 } |
343 SkPaint paint; | 348 SkPaint paint; |
344 paint.setStyle(SkPaint::kStroke_Style); | 349 paint.setStyle(SkPaint::kStroke_Style); |
345 paint.setStrokeWidth(1); | 350 paint.setStrokeWidth(1); |
346 for (int i = 0; i < childrenBounds.count(); i++) { | 351 for (int i = 0; i < childrenBounds.count(); i++) { |
347 if (childrenBounds[i].fRenderTargetUniqueID != rtID) { | 352 if (childrenBounds[i].fRenderTargetUniqueID != rtID) { |
348 // offscreen draw, ignore for now | 353 // offscreen draw, ignore for now |
349 continue; | 354 continue; |
350 } | 355 } |
351 paint.setColor(SK_ColorBLACK); | 356 paint.setColor(SK_ColorBLACK); |
352 canvas->drawRect(childrenBounds[i].fBounds, paint); | 357 canvas->drawRect(childrenBounds[i].fBounds, paint); |
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
716 } | 721 } |
717 | 722 |
718 bool SkDebugCanvas::lastClipStackData(const SkPath& devPath) { | 723 bool SkDebugCanvas::lastClipStackData(const SkPath& devPath) { |
719 if (fCalledAddStackData) { | 724 if (fCalledAddStackData) { |
720 fClipStackData.appendf("<br>"); | 725 fClipStackData.appendf("<br>"); |
721 addPathData(devPath, "pathOut"); | 726 addPathData(devPath, "pathOut"); |
722 return true; | 727 return true; |
723 } | 728 } |
724 return false; | 729 return false; |
725 } | 730 } |
OLD | NEW |