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 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 | 324 |
325 canvas->restoreToCount(saveCount); | 325 canvas->restoreToCount(saveCount); |
326 | 326 |
327 if (fPaintFilterCanvas) { | 327 if (fPaintFilterCanvas) { |
328 fPaintFilterCanvas->removeAll(); | 328 fPaintFilterCanvas->removeAll(); |
329 } | 329 } |
330 | 330 |
331 #if SK_SUPPORT_GPU | 331 #if SK_SUPPORT_GPU |
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 // we pick three colorblind-safe colors, 75% alpha |
| 335 static const SkColor kTotalBounds = SkColorSetARGB(0xC0, 0x6A, 0x3D, 0x9
A); |
| 336 static const SkColor kOpBatchBounds = SkColorSetARGB(0xC0, 0xE3, 0x1A, 0
x1C); |
| 337 static const SkColor kOtherBatchBounds = SkColorSetARGB(0xC0, 0xFF, 0x7F
, 0x00); |
| 338 |
334 // get the render target of the top device so we can ignore batches draw
n offscreen | 339 // 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(); | 340 SkBaseDevice* bd = canvas->getDevice_just_for_deprecated_compatibility_t
esting(); |
336 SkGpuDevice* gbd = reinterpret_cast<SkGpuDevice*>(bd); | 341 SkGpuDevice* gbd = reinterpret_cast<SkGpuDevice*>(bd); |
337 uint32_t rtID = gbd->accessRenderTarget()->getUniqueID(); | 342 uint32_t rtID = gbd->accessRenderTarget()->getUniqueID(); |
338 | 343 |
339 // get the bounding boxes to draw | 344 // get the bounding boxes to draw |
340 GrAuditTrail::AutoEnable ae(at); | 345 GrAuditTrail::AutoEnable ae(at); |
341 SkTArray<GrAuditTrail::BatchInfo> childrenBounds; | 346 SkTArray<GrAuditTrail::BatchInfo> childrenBounds; |
342 at->getBoundsByClientID(&childrenBounds, index); | 347 at->getBoundsByClientID(&childrenBounds, index); |
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(kTotalBounds); |
352 canvas->drawRect(childrenBounds[i].fBounds, paint); | 357 canvas->drawRect(childrenBounds[i].fBounds, paint); |
353 for (int j = 0; j < childrenBounds[i].fBatches.count(); j++) { | 358 for (int j = 0; j < childrenBounds[i].fBatches.count(); j++) { |
354 const GrAuditTrail::BatchInfo::Batch& batch = childrenBounds[i].
fBatches[j]; | 359 const GrAuditTrail::BatchInfo::Batch& batch = childrenBounds[i].
fBatches[j]; |
355 if (batch.fClientID != index) { | 360 if (batch.fClientID != index) { |
356 paint.setColor(SK_ColorBLUE); | 361 paint.setColor(kOtherBatchBounds); |
357 } else { | 362 } else { |
358 paint.setColor(SK_ColorRED); | 363 paint.setColor(kOpBatchBounds); |
359 } | 364 } |
360 canvas->drawRect(batch.fBounds, paint); | 365 canvas->drawRect(batch.fBounds, paint); |
361 } | 366 } |
362 } | 367 } |
363 | 368 |
364 at->fullReset(); | 369 at->fullReset(); |
365 } | 370 } |
366 | 371 |
367 #endif | 372 #endif |
368 } | 373 } |
(...skipping 347 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 |