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 "SkPath.h" | 8 #include "SkPath.h" |
9 #include "SkStream.h" | 9 #include "SkStream.h" |
10 #include "gm.h" | 10 #include "gm.h" |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 SkMatrix clipM; | 160 SkMatrix clipM; |
161 clipM.reset(); | 161 clipM.reset(); |
162 clipM.preScale(scale, scale); | 162 clipM.preScale(scale, scale); |
163 clipM.postTranslate(bounds.fLeft - 17, bounds.fTop - 24.5f + 420); | 163 clipM.postTranslate(bounds.fLeft - 17, bounds.fTop - 24.5f + 420); |
164 SkPath clip; | 164 SkPath clip; |
165 if (index < 2) { | 165 if (index < 2) { |
166 fClipL.transform(clipM, &clip); | 166 fClipL.transform(clipM, &clip); |
167 } else { | 167 } else { |
168 fClipS.transform(clipM, &clip); | 168 fClipS.transform(clipM, &clip); |
169 } | 169 } |
170 canvas->clipPath(clip, SkCanvas::kIntersect_Op, true); | 170 canvas->clipPath(clip, true); |
171 canvas->scale(scale, scale); | 171 canvas->scale(scale, scale); |
172 canvas->drawBitmap(offscreen, (bounds.fLeft - 17) / scale, | 172 canvas->drawBitmap(offscreen, (bounds.fLeft - 17) / scale, |
173 (bounds.fTop - 20 + 420) / scale); | 173 (bounds.fTop - 20 + 420) / scale); |
174 canvas->restore(); | 174 canvas->restore(); |
175 | 175 |
176 if (bounds.width() > 20) { | 176 if (bounds.width() > 20) { |
177 canvas->save(); | 177 canvas->save(); |
178 clipM.reset(); | 178 clipM.reset(); |
179 clipM.preScale(scale, scale); | 179 clipM.preScale(scale, scale); |
180 clipM.postTranslate(bounds.fLeft - 17 - 275, bounds.fTop - 24.5f + 4
20); | 180 clipM.postTranslate(bounds.fLeft - 17 - 275, bounds.fTop - 24.5f + 4
20); |
181 SkPath clip; | 181 SkPath clip; |
182 fClipR.transform(clipM, &clip); | 182 fClipR.transform(clipM, &clip); |
183 canvas->clipPath(clip, SkCanvas::kIntersect_Op, true); | 183 canvas->clipPath(clip, true); |
184 canvas->scale(10.f, 10.f); | 184 canvas->scale(10.f, 10.f); |
185 canvas->drawBitmap(offscreen, (bounds.fLeft - 17 - 275 | 185 canvas->drawBitmap(offscreen, (bounds.fLeft - 17 - 275 |
186 + (index >= 5 ? 5 : 0)) / scale, (bounds.fTop - 20 + 420) /
scale); | 186 + (index >= 5 ? 5 : 0)) / scale, (bounds.fTop - 20 + 420) /
scale); |
187 canvas->restore(); | 187 canvas->restore(); |
188 } | 188 } |
189 } | 189 } |
190 | 190 |
191 }; | 191 }; |
192 | 192 |
193 /////////////////////////////////////////////////////////////////////////////// | 193 /////////////////////////////////////////////////////////////////////////////// |
194 | 194 |
195 DEF_GM( return new StrokeZeroGM(); ) | 195 DEF_GM( return new StrokeZeroGM(); ) |
OLD | NEW |