OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkPath.h" | 10 #include "SkPath.h" |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 canvas->drawRect(targetRect, shapePaint); | 110 canvas->drawRect(targetRect, shapePaint); |
111 shape = recorder.finishRecordingAsPicture(); | 111 shape = recorder.finishRecordingAsPicture(); |
112 } | 112 } |
113 | 113 |
114 SkPaint layerPaint; | 114 SkPaint layerPaint; |
115 layerPaint.setColor(SkColorSetARGB(130, 0, 0, 0)); | 115 layerPaint.setColor(SkColorSetARGB(130, 0, 0, 0)); |
116 canvas->saveLayer(&targetRect, &layerPaint); | 116 canvas->saveLayer(&targetRect, &layerPaint); |
117 canvas->save(); | 117 canvas->save(); |
118 canvas->clipRect(targetRect); | 118 canvas->clipRect(targetRect); |
119 SkPaint drawPaint; | 119 SkPaint drawPaint; |
120 drawPaint.setImageFilter(SkPictureImageFilter::Create(shape.get()))-
>unref(); | 120 drawPaint.setImageFilter(SkPictureImageFilter::Make(shape)); |
121 installDetector(&drawPaint); | 121 installDetector(&drawPaint); |
122 canvas->saveLayer(&targetRect, &drawPaint); | 122 canvas->saveLayer(&targetRect, &drawPaint); |
123 canvas->restore(); | 123 canvas->restore(); |
124 canvas->restore(); | 124 canvas->restore(); |
125 canvas->restore(); | 125 canvas->restore(); |
126 } | 126 } |
127 | 127 |
128 // Draws two columns of rectangles. The test is correct when: | 128 // Draws two columns of rectangles. The test is correct when: |
129 // - Left and right columns always identical | 129 // - Left and right columns always identical |
130 // - First 3 rows are green, with a white dent in the middle row | 130 // - First 3 rows are green, with a white dent in the middle row |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 } | 207 } |
208 | 208 |
209 canvas->restore(); | 209 canvas->restore(); |
210 canvas->translate(SkIntToScalar(0), SkIntToScalar(kTestRectSize)
+ SkIntToScalar(1)); | 210 canvas->translate(SkIntToScalar(0), SkIntToScalar(kTestRectSize)
+ SkIntToScalar(1)); |
211 } | 211 } |
212 | 212 |
213 } | 213 } |
214 } | 214 } |
215 } | 215 } |
216 | 216 |
OLD | NEW |