OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 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 "Viewer.h" | 8 #include "Viewer.h" |
9 | 9 |
10 #include "GMSlide.h" | 10 #include "GMSlide.h" |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 fGesture.reset(); | 216 fGesture.reset(); |
217 fDefaultMatrix.reset(); | 217 fDefaultMatrix.reset(); |
218 fDefaultMatrixInv.reset(); | 218 fDefaultMatrixInv.reset(); |
219 | 219 |
220 if (fWindow->supportsContentRect() && fWindow->scaleContentToFit()) { | 220 if (fWindow->supportsContentRect() && fWindow->scaleContentToFit()) { |
221 const SkRect contentRect = fWindow->getContentRect(); | 221 const SkRect contentRect = fWindow->getContentRect(); |
222 const SkISize slideSize = fSlides[fCurrentSlide]->getDimensions(); | 222 const SkISize slideSize = fSlides[fCurrentSlide]->getDimensions(); |
223 const SkRect slideBounds = SkRect::MakeIWH(slideSize.width(), slideSize.
height()); | 223 const SkRect slideBounds = SkRect::MakeIWH(slideSize.width(), slideSize.
height()); |
224 if (contentRect.width() > 0 && contentRect.height() > 0) { | 224 if (contentRect.width() > 0 && contentRect.height() > 0) { |
225 fDefaultMatrix.setRectToRect(slideBounds, contentRect, SkMatrix::kSt
art_ScaleToFit); | 225 fDefaultMatrix.setRectToRect(slideBounds, contentRect, SkMatrix::kSt
art_ScaleToFit); |
226 bool inverted = fDefaultMatrix.invert(&fDefaultMatrixInv); | 226 SkAssertResult(fDefaultMatrix.invert(&fDefaultMatrixInv)); |
227 SkASSERT(inverted); | |
228 } | 227 } |
229 } | 228 } |
230 | 229 |
231 if (fWindow->supportsContentRect()) { | 230 if (fWindow->supportsContentRect()) { |
232 const SkISize slideSize = fSlides[fCurrentSlide]->getDimensions(); | 231 const SkISize slideSize = fSlides[fCurrentSlide]->getDimensions(); |
233 SkRect windowRect = fWindow->getContentRect(); | 232 SkRect windowRect = fWindow->getContentRect(); |
234 fDefaultMatrixInv.mapRect(&windowRect); | 233 fDefaultMatrixInv.mapRect(&windowRect); |
235 fGesture.setTransLimit(SkRect::MakeWH(slideSize.width(), slideSize.heigh
t()), windowRect); | 234 fGesture.setTransLimit(SkRect::MakeWH(slideSize.width(), slideSize.heigh
t()), windowRect); |
236 } | 235 } |
237 | 236 |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 // Record measurements | 375 // Record measurements |
377 fMeasurements[fCurrentMeasurement++] = ms; | 376 fMeasurements[fCurrentMeasurement++] = ms; |
378 fCurrentMeasurement &= (kMeasurementCount - 1); // fast mod | 377 fCurrentMeasurement &= (kMeasurementCount - 1); // fast mod |
379 SkASSERT(fCurrentMeasurement < kMeasurementCount); | 378 SkASSERT(fCurrentMeasurement < kMeasurementCount); |
380 | 379 |
381 fAnimTimer.updateTime(); | 380 fAnimTimer.updateTime(); |
382 if (fSlides[fCurrentSlide]->animate(fAnimTimer) || fDisplayStats) { | 381 if (fSlides[fCurrentSlide]->animate(fAnimTimer) || fDisplayStats) { |
383 fWindow->inval(); | 382 fWindow->inval(); |
384 } | 383 } |
385 } | 384 } |
OLD | NEW |