OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2014 Google Inc. | 3 * Copyright 2014 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 #include "gm.h" | 9 #include "gm.h" |
10 | 10 |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 iter.get(); | 162 iter.get(); |
163 iter.next()) { | 163 iter.next()) { |
164 const Clip* clip = iter.get(); | 164 const Clip* clip = iter.get(); |
165 SkScalar x = startX; | 165 SkScalar x = startX; |
166 for (int aa = 0; aa < 2; ++aa) { | 166 for (int aa = 0; aa < 2; ++aa) { |
167 if (doLayer) { | 167 if (doLayer) { |
168 SkRect bounds; | 168 SkRect bounds; |
169 clip->getBounds(&bounds); | 169 clip->getBounds(&bounds); |
170 bounds.outset(2, 2); | 170 bounds.outset(2, 2); |
171 bounds.offset(x, y); | 171 bounds.offset(x, y); |
172 canvas->saveLayer(&bounds, NULL); | 172 canvas->saveLayer(&bounds, nullptr); |
173 } else { | 173 } else { |
174 canvas->save(); | 174 canvas->save(); |
175 } | 175 } |
176 canvas->translate(x, y); | 176 canvas->translate(x, y); |
177 clip->setOnCanvas(canvas, SkRegion::kIntersect_Op, SkToBool(
aa)); | 177 clip->setOnCanvas(canvas, SkRegion::kIntersect_Op, SkToBool(
aa)); |
178 canvas->drawBitmap(fBmp, 0, 0); | 178 canvas->drawBitmap(fBmp, 0, 0); |
179 canvas->restore(); | 179 canvas->restore(); |
180 x += fBmp.width() + kMargin; | 180 x += fBmp.width() + kMargin; |
181 } | 181 } |
182 for (int aa = 0; aa < 2; ++aa) { | 182 for (int aa = 0; aa < 2; ++aa) { |
183 | 183 |
184 SkPaint clipOutlinePaint; | 184 SkPaint clipOutlinePaint; |
185 clipOutlinePaint.setAntiAlias(true); | 185 clipOutlinePaint.setAntiAlias(true); |
186 clipOutlinePaint.setColor(0x50505050); | 186 clipOutlinePaint.setColor(0x50505050); |
187 clipOutlinePaint.setStyle(SkPaint::kStroke_Style); | 187 clipOutlinePaint.setStyle(SkPaint::kStroke_Style); |
188 clipOutlinePaint.setStrokeWidth(0); | 188 clipOutlinePaint.setStrokeWidth(0); |
189 | 189 |
190 if (doLayer) { | 190 if (doLayer) { |
191 SkRect bounds; | 191 SkRect bounds; |
192 clip->getBounds(&bounds); | 192 clip->getBounds(&bounds); |
193 bounds.outset(2, 2); | 193 bounds.outset(2, 2); |
194 bounds.offset(x, y); | 194 bounds.offset(x, y); |
195 canvas->saveLayer(&bounds, NULL); | 195 canvas->saveLayer(&bounds, nullptr); |
196 } else { | 196 } else { |
197 canvas->save(); | 197 canvas->save(); |
198 } | 198 } |
199 canvas->translate(x, y); | 199 canvas->translate(x, y); |
200 SkPath closedClipPath; | 200 SkPath closedClipPath; |
201 clip->asClosedPath(&closedClipPath); | 201 clip->asClosedPath(&closedClipPath); |
202 canvas->drawPath(closedClipPath, clipOutlinePaint); | 202 canvas->drawPath(closedClipPath, clipOutlinePaint); |
203 clip->setOnCanvas(canvas, SkRegion::kIntersect_Op, SkToBool(
aa)); | 203 clip->setOnCanvas(canvas, SkRegion::kIntersect_Op, SkToBool(
aa)); |
204 canvas->scale(1.f, 1.8f); | 204 canvas->scale(1.f, 1.8f); |
205 canvas->drawText(kTxt, SK_ARRAY_COUNT(kTxt)-1, | 205 canvas->drawText(kTxt, SK_ARRAY_COUNT(kTxt)-1, |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 }; | 292 }; |
293 | 293 |
294 SkTLList<Clip> fClips; | 294 SkTLList<Clip> fClips; |
295 SkBitmap fBmp; | 295 SkBitmap fBmp; |
296 | 296 |
297 typedef GM INHERITED; | 297 typedef GM INHERITED; |
298 }; | 298 }; |
299 | 299 |
300 DEF_GM(return new ConvexPolyClip;) | 300 DEF_GM(return new ConvexPolyClip;) |
301 } | 301 } |
OLD | NEW |