| 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 "gm.h" | 8 #include "gm.h" |
| 9 #include "SkAAClip.h" | 9 #include "SkAAClip.h" |
| 10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 | 99 |
| 100 void drawPathsOped(SkCanvas* canvas, SkCanvas::ClipOp op, SkColor color) { | 100 void drawPathsOped(SkCanvas* canvas, SkCanvas::ClipOp op, SkColor color) { |
| 101 | 101 |
| 102 this->drawOrig(canvas); | 102 this->drawOrig(canvas); |
| 103 | 103 |
| 104 canvas->save(); | 104 canvas->save(); |
| 105 | 105 |
| 106 // create the clip mask with the supplied boolean op | 106 // create the clip mask with the supplied boolean op |
| 107 if (kPath_GeomType == fGeomType) { | 107 if (kPath_GeomType == fGeomType) { |
| 108 // path-based case | 108 // path-based case |
| 109 canvas->clipPath(fBasePath, SkCanvas::kReplace_Op, true); | 109 canvas->clipPath(fBasePath, true); |
| 110 canvas->clipPath(fRectPath, op, true); | 110 canvas->clipPath(fRectPath, op, true); |
| 111 } else { | 111 } else { |
| 112 // rect-based case | 112 // rect-based case |
| 113 canvas->clipRect(fBase, SkCanvas::kReplace_Op, true); | 113 canvas->clipRect(fBase, true); |
| 114 canvas->clipRect(fRect, op, true); | 114 canvas->clipRect(fRect, op, true); |
| 115 } | 115 } |
| 116 | 116 |
| 117 // draw a rect that will entirely cover the clip mask area | 117 // draw a rect that will entirely cover the clip mask area |
| 118 SkPaint paint; | 118 SkPaint paint; |
| 119 paint.setColor(color); | 119 paint.setColor(color); |
| 120 | 120 |
| 121 SkRect r = SkRect::MakeLTRB(SkIntToScalar(90), SkIntToScalar(90), | 121 SkRect r = SkRect::MakeLTRB(SkIntToScalar(90), SkIntToScalar(90), |
| 122 SkIntToScalar(180), SkIntToScalar(180)); | 122 SkIntToScalar(180), SkIntToScalar(180)); |
| 123 | 123 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 }; | 194 }; |
| 195 | 195 |
| 196 ////////////////////////////////////////////////////////////////////////////// | 196 ////////////////////////////////////////////////////////////////////////////// |
| 197 | 197 |
| 198 // rects | 198 // rects |
| 199 DEF_GM( return new SimpleClipGM(SimpleClipGM::kRect_GeomType); ) | 199 DEF_GM( return new SimpleClipGM(SimpleClipGM::kRect_GeomType); ) |
| 200 DEF_GM( return new SimpleClipGM(SimpleClipGM::kPath_GeomType); ) | 200 DEF_GM( return new SimpleClipGM(SimpleClipGM::kPath_GeomType); ) |
| 201 DEF_GM( return new SimpleClipGM(SimpleClipGM::kAAClip_GeomType); ) | 201 DEF_GM( return new SimpleClipGM(SimpleClipGM::kAAClip_GeomType); ) |
| 202 | 202 |
| 203 } | 203 } |
| OLD | NEW |