| 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 25 matching lines...) Expand all Loading... |
| 36 // rounded out. The following code creates a nearly maximal rect that will | 36 // rounded out. The following code creates a nearly maximal rect that will |
| 37 // not get collapsed by the coming conversions (Due to precision loss the | 37 // not get collapsed by the coming conversions (Due to precision loss the |
| 38 // inset has to be surprisingly large). | 38 // inset has to be surprisingly large). |
| 39 SkIRect largeIRect = SkIRect::MakeLargest(); | 39 SkIRect largeIRect = SkIRect::MakeLargest(); |
| 40 largeIRect.inset(1024, 1024); | 40 largeIRect.inset(1024, 1024); |
| 41 SkRect large = SkRect::Make(largeIRect); | 41 SkRect large = SkRect::Make(largeIRect); |
| 42 #ifdef SK_DEBUG | 42 #ifdef SK_DEBUG |
| 43 large.roundOut(&largeIRect); | 43 large.roundOut(&largeIRect); |
| 44 SkASSERT(!largeIRect.isEmpty()); | 44 SkASSERT(!largeIRect.isEmpty()); |
| 45 #endif | 45 #endif |
| 46 INHERITED::clipRect(large, SkRegion::kReplace_Op, false); | 46 // call the base class' version to avoid adding a draw command |
| 47 this->INHERITED::onClipRect(large, SkRegion::kReplace_Op, kHard_ClipEdgeStyl
e); |
| 47 } | 48 } |
| 48 | 49 |
| 49 SkDebugCanvas::~SkDebugCanvas() { | 50 SkDebugCanvas::~SkDebugCanvas() { |
| 50 fCommandVector.deleteAll(); | 51 fCommandVector.deleteAll(); |
| 51 SkSafeUnref(fOverdrawFilter); | 52 SkSafeUnref(fOverdrawFilter); |
| 52 SkSafeUnref(fTexOverrideFilter); | 53 SkSafeUnref(fTexOverrideFilter); |
| 53 } | 54 } |
| 54 | 55 |
| 55 void SkDebugCanvas::addDrawCommand(SkDrawCommand* command) { | 56 void SkDebugCanvas::addDrawCommand(SkDrawCommand* command) { |
| 56 fCommandVector.push(command); | 57 fCommandVector.push(command); |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 } | 291 } |
| 291 | 292 |
| 292 fOverrideTexFiltering = overrideTexFiltering; | 293 fOverrideTexFiltering = overrideTexFiltering; |
| 293 fTexOverrideFilter->setFilterLevel(level); | 294 fTexOverrideFilter->setFilterLevel(level); |
| 294 } | 295 } |
| 295 | 296 |
| 296 void SkDebugCanvas::clear(SkColor color) { | 297 void SkDebugCanvas::clear(SkColor color) { |
| 297 addDrawCommand(new SkClearCommand(color)); | 298 addDrawCommand(new SkClearCommand(color)); |
| 298 } | 299 } |
| 299 | 300 |
| 300 bool SkDebugCanvas::clipPath(const SkPath& path, SkRegion::Op op, bool doAA) { | 301 void SkDebugCanvas::onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyl
e edgeStyle) { |
| 301 addDrawCommand(new SkClipPathCommand(path, op, doAA)); | 302 this->addDrawCommand(new SkClipPathCommand(path, op, kSoft_ClipEdgeStyle ==
edgeStyle)); |
| 302 return true; | |
| 303 } | 303 } |
| 304 | 304 |
| 305 bool SkDebugCanvas::clipRect(const SkRect& rect, SkRegion::Op op, bool doAA) { | 305 void SkDebugCanvas::onClipRect(const SkRect& rect, SkRegion::Op op, ClipEdgeStyl
e edgeStyle) { |
| 306 addDrawCommand(new SkClipRectCommand(rect, op, doAA)); | 306 this->addDrawCommand(new SkClipRectCommand(rect, op, kSoft_ClipEdgeStyle ==
edgeStyle)); |
| 307 return true; | |
| 308 } | 307 } |
| 309 | 308 |
| 310 bool SkDebugCanvas::clipRRect(const SkRRect& rrect, SkRegion::Op op, bool doAA)
{ | 309 void SkDebugCanvas::onClipRRect(const SkRRect& rrect, SkRegion::Op op, ClipEdgeS
tyle edgeStyle) { |
| 311 addDrawCommand(new SkClipRRectCommand(rrect, op, doAA)); | 310 this->addDrawCommand(new SkClipRRectCommand(rrect, op, kSoft_ClipEdgeStyle =
= edgeStyle)); |
| 312 return true; | |
| 313 } | 311 } |
| 314 | 312 |
| 315 bool SkDebugCanvas::clipRegion(const SkRegion& region, SkRegion::Op op) { | 313 void SkDebugCanvas::onClipRegion(const SkRegion& region, SkRegion::Op op) { |
| 316 addDrawCommand(new SkClipRegionCommand(region, op)); | 314 this->addDrawCommand(new SkClipRegionCommand(region, op)); |
| 317 return true; | |
| 318 } | 315 } |
| 319 | 316 |
| 320 bool SkDebugCanvas::concat(const SkMatrix& matrix) { | 317 bool SkDebugCanvas::concat(const SkMatrix& matrix) { |
| 321 addDrawCommand(new SkConcatCommand(matrix)); | 318 addDrawCommand(new SkConcatCommand(matrix)); |
| 322 return true; | 319 return true; |
| 323 } | 320 } |
| 324 | 321 |
| 325 void SkDebugCanvas::drawBitmap(const SkBitmap& bitmap, SkScalar left, | 322 void SkDebugCanvas::drawBitmap(const SkBitmap& bitmap, SkScalar left, |
| 326 SkScalar top, const SkPaint* paint = NULL) { | 323 SkScalar top, const SkPaint* paint = NULL) { |
| 327 addDrawCommand(new SkDrawBitmapCommand(bitmap, left, top, paint)); | 324 addDrawCommand(new SkDrawBitmapCommand(bitmap, left, top, paint)); |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 474 | 471 |
| 475 bool SkDebugCanvas::translate(SkScalar dx, SkScalar dy) { | 472 bool SkDebugCanvas::translate(SkScalar dx, SkScalar dy) { |
| 476 addDrawCommand(new SkTranslateCommand(dx, dy)); | 473 addDrawCommand(new SkTranslateCommand(dx, dy)); |
| 477 return true; | 474 return true; |
| 478 } | 475 } |
| 479 | 476 |
| 480 void SkDebugCanvas::toggleCommand(int index, bool toggle) { | 477 void SkDebugCanvas::toggleCommand(int index, bool toggle) { |
| 481 SkASSERT(index < fCommandVector.count()); | 478 SkASSERT(index < fCommandVector.count()); |
| 482 fCommandVector[index]->setVisible(toggle); | 479 fCommandVector[index]->setVisible(toggle); |
| 483 } | 480 } |
| OLD | NEW |