| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 "SkPath.h" |
| 9 | 10 |
| 10 DEF_SIMPLE_GM(PlusMergesAA, canvas, 256, 256) { | 11 DEF_SIMPLE_GM(PlusMergesAA, canvas, 256, 256) { |
| 11 SkPaint p; | 12 SkPaint p; |
| 12 p.setColor(SK_ColorRED); | 13 p.setColor(SK_ColorRED); |
| 13 p.setAntiAlias(true); // <-- crucial to the test that we use AA | 14 p.setAntiAlias(true); // <-- crucial to the test that we use AA |
| 14 | 15 |
| 15 // Draw a two red squares. | 16 // Draw a two red squares. |
| 16 canvas->drawRect(SkRect::MakeWH(100, 100), p); | 17 canvas->drawRect(SkRect::MakeWH(100, 100), p); |
| 17 canvas->drawRect(SkRect::MakeXYWH(150, 0, 100, 100), p); | 18 canvas->drawRect(SkRect::MakeXYWH(150, 0, 100, 100), p); |
| 18 | 19 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 35 canvas->drawPath(bottomRight, p); | 36 canvas->drawPath(bottomRight, p); |
| 36 | 37 |
| 37 // Using Plus on the right should merge the AA of seam together completely c
overing the red. | 38 // Using Plus on the right should merge the AA of seam together completely c
overing the red. |
| 38 canvas->saveLayer(nullptr, nullptr); | 39 canvas->saveLayer(nullptr, nullptr); |
| 39 p.setXfermodeMode(SkXfermode::kPlus_Mode); | 40 p.setXfermodeMode(SkXfermode::kPlus_Mode); |
| 40 canvas->translate(150, 0); | 41 canvas->translate(150, 0); |
| 41 canvas->drawPath(upperLeft, p); | 42 canvas->drawPath(upperLeft, p); |
| 42 canvas->drawPath(bottomRight, p); | 43 canvas->drawPath(bottomRight, p); |
| 43 canvas->restore(); | 44 canvas->restore(); |
| 44 } | 45 } |
| OLD | NEW |