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 "sk_tool_utils.h" | 8 #include "sk_tool_utils.h" |
9 #include "SkBitmapSource.h" | 9 #include "SkBitmapSource.h" |
10 #include "SkOffsetImageFilter.h" | 10 #include "SkOffsetImageFilter.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 canvas->scale(scale, scale); | 50 canvas->scale(scale, scale); |
51 canvas->drawBitmap(bitmap, 0, 0, &paint); | 51 canvas->drawBitmap(bitmap, 0, 0, &paint); |
52 canvas->restore(); | 52 canvas->restore(); |
53 | 53 |
54 // Draw a boundary rect around the intersection of the clip rect and cro
p rect. | 54 // Draw a boundary rect around the intersection of the clip rect and cro
p rect. |
55 SkRect cropRectFloat; | 55 SkRect cropRectFloat; |
56 SkMatrix::MakeScale(scale, scale).mapRect(&cropRectFloat, SkRect::Make(c
ropRect)); | 56 SkMatrix::MakeScale(scale, scale).mapRect(&cropRectFloat, SkRect::Make(c
ropRect)); |
57 if (clipRect.intersect(cropRectFloat)) { | 57 if (clipRect.intersect(cropRectFloat)) { |
58 SkPaint strokePaint; | 58 SkPaint strokePaint; |
59 strokePaint.setStyle(SkPaint::kStroke_Style); | 59 strokePaint.setStyle(SkPaint::kStroke_Style); |
| 60 strokePaint.setStrokeWidth(2); |
60 strokePaint.setColor(SK_ColorRED); | 61 strokePaint.setColor(SK_ColorRED); |
61 canvas->drawRect(clipRect, strokePaint); | 62 canvas->drawRect(clipRect, strokePaint); |
62 } | 63 } |
63 } | 64 } |
64 | 65 |
65 void onOnceBeforeDraw() override { | 66 void onOnceBeforeDraw() override { |
66 make_bitmap(); | 67 make_bitmap(); |
67 | 68 |
68 fCheckerboard.allocN32Pixels(80, 80); | 69 fCheckerboard.allocN32Pixels(80, 80); |
69 SkCanvas checkerboardCanvas(fCheckerboard); | 70 SkCanvas checkerboardCanvas(fCheckerboard); |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 | 206 |
206 // crop==clip==dst | 207 // crop==clip==dst |
207 canvas->translate(100, 0); | 208 canvas->translate(100, 0); |
208 this->doDraw(canvas, r, SkOffsetImageFilter::Create(40, 0, NULL, &cr2),
&r2); | 209 this->doDraw(canvas, r, SkOffsetImageFilter::Create(40, 0, NULL, &cr2),
&r2); |
209 } | 210 } |
210 | 211 |
211 private: | 212 private: |
212 typedef skiagm::GM INHERITED; | 213 typedef skiagm::GM INHERITED; |
213 }; | 214 }; |
214 DEF_GM( return new SimpleOffsetImageFilterGM; ) | 215 DEF_GM( return new SimpleOffsetImageFilterGM; ) |
OLD | NEW |