| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "SkAlphaThresholdFilter.h" | 9 #include "SkAlphaThresholdFilter.h" |
| 10 #include "SkRandom.h" | 10 #include "SkRandom.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { | 36 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { |
| 37 SkIRect rects[2]; | 37 SkIRect rects[2]; |
| 38 rects[0] = SkIRect::MakeXYWH(0, 150, WIDTH, HEIGHT - 300); | 38 rects[0] = SkIRect::MakeXYWH(0, 150, WIDTH, HEIGHT - 300); |
| 39 rects[1] = SkIRect::MakeXYWH(150, 0, WIDTH - 300, HEIGHT); | 39 rects[1] = SkIRect::MakeXYWH(150, 0, WIDTH - 300, HEIGHT); |
| 40 SkRegion region; | 40 SkRegion region; |
| 41 region.setRects(rects, 2); | 41 region.setRects(rects, 2); |
| 42 | 42 |
| 43 SkMatrix matrix; | 43 SkMatrix matrix; |
| 44 matrix.reset(); | 44 matrix.reset(); |
| 45 matrix.setTranslate(WIDTH * .1f, HEIGHT * .1f); | 45 matrix.setTranslate(WIDTH * .1f, HEIGHT * .1f); |
| 46 matrix.postScale(.8, .8); | 46 matrix.postScale(.8f, .8f); |
| 47 | 47 |
| 48 canvas->concat(matrix); | 48 canvas->concat(matrix); |
| 49 | 49 |
| 50 SkPaint paint; | 50 SkPaint paint; |
| 51 paint.setImageFilter( | 51 paint.setImageFilter( |
| 52 SkAlphaThresholdFilter::Create(region, 0.2f, 0.7f))->unref(); | 52 SkAlphaThresholdFilter::Create(region, 0.2f, 0.7f))->unref(); |
| 53 canvas->saveLayer(NULL, &paint); | 53 canvas->saveLayer(NULL, &paint); |
| 54 paint.setAntiAlias(true); | 54 paint.setAntiAlias(true); |
| 55 | 55 |
| 56 SkPaint rect_paint; | 56 SkPaint rect_paint; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 73 private: | 73 private: |
| 74 typedef GM INHERITED; | 74 typedef GM INHERITED; |
| 75 }; | 75 }; |
| 76 | 76 |
| 77 ////////////////////////////////////////////////////////////////////////////// | 77 ////////////////////////////////////////////////////////////////////////////// |
| 78 | 78 |
| 79 static GM* MyFactory(void*) { return new ImageAlphaThresholdGM; } | 79 static GM* MyFactory(void*) { return new ImageAlphaThresholdGM; } |
| 80 static GMRegistry reg(MyFactory); | 80 static GMRegistry reg(MyFactory); |
| 81 | 81 |
| 82 } | 82 } |
| OLD | NEW |