| 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 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 | 343 |
| 344 void Viewer::drawSlide(SkCanvas* canvas, bool inSplitScreen) { | 344 void Viewer::drawSlide(SkCanvas* canvas, bool inSplitScreen) { |
| 345 SkASSERT(!inSplitScreen || fWindow->supportsContentRect()); | 345 SkASSERT(!inSplitScreen || fWindow->supportsContentRect()); |
| 346 | 346 |
| 347 int count = canvas->save(); | 347 int count = canvas->save(); |
| 348 | 348 |
| 349 if (fWindow->supportsContentRect()) { | 349 if (fWindow->supportsContentRect()) { |
| 350 SkRect contentRect = fWindow->getContentRect(); | 350 SkRect contentRect = fWindow->getContentRect(); |
| 351 // If inSplitScreen, translate the image half screen to the right. | 351 // If inSplitScreen, translate the image half screen to the right. |
| 352 // Thus we have two copies of the image on each half of the screen. | 352 // Thus we have two copies of the image on each half of the screen. |
| 353 contentRect.fLeft += inSplitScreen ? (contentRect.fRight - contentRect.f
Left) * 0.5f : 0f; | 353 contentRect.fLeft += |
| 354 inSplitScreen ? (contentRect.fRight - contentRect.fLeft) * 0.5f
: 0.0f; |
| 354 canvas->clipRect(contentRect); | 355 canvas->clipRect(contentRect); |
| 355 canvas->translate(contentRect.fLeft, contentRect.fTop); | 356 canvas->translate(contentRect.fLeft, contentRect.fTop); |
| 356 } | 357 } |
| 357 | 358 |
| 358 canvas->clear(SK_ColorWHITE); | 359 canvas->clear(SK_ColorWHITE); |
| 359 canvas->concat(fDefaultMatrix); | 360 canvas->concat(fDefaultMatrix); |
| 360 canvas->concat(computeMatrix()); | 361 canvas->concat(computeMatrix()); |
| 361 | 362 |
| 362 canvas->getMetaData().setBool(kImageColorXformMetaData, inSplitScreen); | 363 canvas->getMetaData().setBool(kImageColorXformMetaData, inSplitScreen); |
| 363 fSlides[fCurrentSlide]->draw(canvas); | 364 fSlides[fCurrentSlide]->draw(canvas); |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 558 bool newSplitScreen = stateValue.equals(kON); | 559 bool newSplitScreen = stateValue.equals(kON); |
| 559 if (newSplitScreen != fSplitScreen) { | 560 if (newSplitScreen != fSplitScreen) { |
| 560 fSplitScreen = newSplitScreen; | 561 fSplitScreen = newSplitScreen; |
| 561 fWindow->inval(); | 562 fWindow->inval(); |
| 562 updateUIState(); | 563 updateUIState(); |
| 563 } | 564 } |
| 564 } else { | 565 } else { |
| 565 SkDebugf("Unknown stateName: %s", stateName.c_str()); | 566 SkDebugf("Unknown stateName: %s", stateName.c_str()); |
| 566 } | 567 } |
| 567 } | 568 } |
| OLD | NEW |