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.roundOut(&largeIRect); |
| 53 SkASSERT(!largeIRect.isEmpty()); |
| 54 #endif |
| 55 INHERITED::clipRect(large, SkRegion::kReplace_Op, false); |
38 } | 56 } |
39 | 57 |
40 SkDebugCanvas::~SkDebugCanvas() { | 58 SkDebugCanvas::~SkDebugCanvas() { |
41 fCommandVector.deleteAll(); | 59 fCommandVector.deleteAll(); |
42 SkSafeUnref(fOverdrawFilter); | 60 SkSafeUnref(fOverdrawFilter); |
43 } | 61 } |
44 | 62 |
45 void SkDebugCanvas::addDrawCommand(SkDrawCommand* command) { | 63 void SkDebugCanvas::addDrawCommand(SkDrawCommand* command) { |
46 fCommandVector.push(command); | 64 fCommandVector.push(command); |
47 } | 65 } |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
456 | 474 |
457 bool SkDebugCanvas::translate(SkScalar dx, SkScalar dy) { | 475 bool SkDebugCanvas::translate(SkScalar dx, SkScalar dy) { |
458 addDrawCommand(new SkTranslateCommand(dx, dy)); | 476 addDrawCommand(new SkTranslateCommand(dx, dy)); |
459 return true; | 477 return true; |
460 } | 478 } |
461 | 479 |
462 void SkDebugCanvas::toggleCommand(int index, bool toggle) { | 480 void SkDebugCanvas::toggleCommand(int index, bool toggle) { |
463 SkASSERT(index < fCommandVector.count()); | 481 SkASSERT(index < fCommandVector.count()); |
464 fCommandVector[index]->setVisible(toggle); | 482 fCommandVector[index]->setVisible(toggle); |
465 } | 483 } |
OLD | NEW |