Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 | 9 |
| 10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 28 , fTexOverrideFilter(NULL) | 28 , fTexOverrideFilter(NULL) |
| 29 , fOutstandingSaveCount(0) { | 29 , fOutstandingSaveCount(0) { |
| 30 // TODO(chudy): Free up memory from all draw commands in destructor. | 30 // TODO(chudy): Free up memory from all draw commands in destructor. |
| 31 fWidth = width; | 31 fWidth = width; |
| 32 fHeight = height; | 32 fHeight = height; |
| 33 // do we need fBm anywhere? | 33 // do we need fBm anywhere? |
| 34 fBm.setConfig(SkBitmap::kNo_Config, fWidth, fHeight); | 34 fBm.setConfig(SkBitmap::kNo_Config, fWidth, fHeight); |
| 35 fFilter = false; | 35 fFilter = false; |
| 36 fIndex = 0; | 36 fIndex = 0; |
| 37 fUserMatrix.reset(); | 37 fUserMatrix.reset(); |
| 38 | |
| 39 // SkPicturePlayback uses the base-class' quickReject calls to cull clipped | |
| 40 // operations. This can lead to problems in the debugger which expects all | |
| 41 // the operations in the captured skp to appear in the debug canvas. To | |
| 42 // circumvent this we create a wide open clip here (an empty clip rect | |
| 43 // is not sufficient). | |
| 44 // Internally, the SkRect passed to clipRect is converted to an SkIRect and | |
| 45 // rounded out. The following code creates a nearly maximal rect that will | |
| 46 // not get collapsed by the coming conversions (Due to precision loss the | |
| 47 // inset has to be surprisingly large). | |
| 48 SkIRect largeIRect = SkIRect::MakeLargest(); | |
| 49 largeIRect.inset(1024, 1024); | |
| 50 SkRect large = SkRect::MakeFromIRect(largeIRect); | |
| 51 #ifdef SK_DEBUG | |
| 52 large.round(&largeIRect); | |
|
Justin Novosad
2013/11/06 19:57:35
roundOut instead of round?
robertphillips
2013/11/06 20:07:51
Since it is BW, SkRasterClip::op just does a round
robertphillips
2013/11/06 20:40:21
Done.
| |
| 53 SkASSERT(!largeIRect.isEmpty()); | |
| 54 #endif | |
| 55 INHERITED::clipRect(large, SkRegion::kReplace_Op, false); | |
| 56 | |
| 38 } | 57 } |
| 39 | 58 |
| 40 SkDebugCanvas::~SkDebugCanvas() { | 59 SkDebugCanvas::~SkDebugCanvas() { |
| 41 fCommandVector.deleteAll(); | 60 fCommandVector.deleteAll(); |
| 42 SkSafeUnref(fOverdrawFilter); | 61 SkSafeUnref(fOverdrawFilter); |
| 43 } | 62 } |
| 44 | 63 |
| 45 void SkDebugCanvas::addDrawCommand(SkDrawCommand* command) { | 64 void SkDebugCanvas::addDrawCommand(SkDrawCommand* command) { |
| 46 fCommandVector.push(command); | 65 fCommandVector.push(command); |
| 47 } | 66 } |
| (...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 456 | 475 |
| 457 bool SkDebugCanvas::translate(SkScalar dx, SkScalar dy) { | 476 bool SkDebugCanvas::translate(SkScalar dx, SkScalar dy) { |
| 458 addDrawCommand(new SkTranslateCommand(dx, dy)); | 477 addDrawCommand(new SkTranslateCommand(dx, dy)); |
| 459 return true; | 478 return true; |
| 460 } | 479 } |
| 461 | 480 |
| 462 void SkDebugCanvas::toggleCommand(int index, bool toggle) { | 481 void SkDebugCanvas::toggleCommand(int index, bool toggle) { |
| 463 SkASSERT(index < fCommandVector.count()); | 482 SkASSERT(index < fCommandVector.count()); |
| 464 fCommandVector[index]->setVisible(toggle); | 483 fCommandVector[index]->setVisible(toggle); |
| 465 } | 484 } |
| OLD | NEW |