OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 #include "SampleApp.h" | 7 #include "SampleApp.h" |
8 | 8 |
9 #include "SkData.h" | 9 #include "SkData.h" |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
651 if (view->doQuery(&evt)) { | 651 if (view->doQuery(&evt)) { |
652 title->set(evt.findString(gTitleEvtName)); | 652 title->set(evt.findString(gTitleEvtName)); |
653 return true; | 653 return true; |
654 } | 654 } |
655 } | 655 } |
656 return false; | 656 return false; |
657 } | 657 } |
658 | 658 |
659 void SampleWindow::setZoomCenter(float x, float y) | 659 void SampleWindow::setZoomCenter(float x, float y) |
660 { | 660 { |
661 fZoomCenterX = SkFloatToScalar(x); | 661 fZoomCenterX = x; |
662 fZoomCenterY = SkFloatToScalar(y); | 662 fZoomCenterY = y; |
663 } | 663 } |
664 | 664 |
665 bool SampleWindow::zoomIn() | 665 bool SampleWindow::zoomIn() |
666 { | 666 { |
667 // Arbitrarily decided | 667 // Arbitrarily decided |
668 if (fFatBitsScale == 25) return false; | 668 if (fFatBitsScale == 25) return false; |
669 fFatBitsScale++; | 669 fFatBitsScale++; |
670 this->inval(NULL); | 670 this->inval(NULL); |
671 return true; | 671 return true; |
672 } | 672 } |
(...skipping 870 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1543 SkBitmap::kARGB_4444_Config, // 565 -> 4444 | 1543 SkBitmap::kARGB_4444_Config, // 565 -> 4444 |
1544 SkBitmap::kARGB_8888_Config, // 4444 -> 8888 | 1544 SkBitmap::kARGB_8888_Config, // 4444 -> 8888 |
1545 SkBitmap::kRGB_565_Config // 8888 -> 565 | 1545 SkBitmap::kRGB_565_Config // 8888 -> 565 |
1546 }; | 1546 }; |
1547 | 1547 |
1548 static SkBitmap::Config cycle_configs(SkBitmap::Config c) { | 1548 static SkBitmap::Config cycle_configs(SkBitmap::Config c) { |
1549 return gConfigCycle[c]; | 1549 return gConfigCycle[c]; |
1550 } | 1550 } |
1551 | 1551 |
1552 void SampleWindow::changeZoomLevel(float delta) { | 1552 void SampleWindow::changeZoomLevel(float delta) { |
1553 fZoomLevel += SkFloatToScalar(delta); | 1553 fZoomLevel += delta; |
1554 if (fZoomLevel > 0) { | 1554 if (fZoomLevel > 0) { |
1555 fZoomLevel = SkMinScalar(fZoomLevel, MAX_ZOOM_LEVEL); | 1555 fZoomLevel = SkMinScalar(fZoomLevel, MAX_ZOOM_LEVEL); |
1556 fZoomScale = fZoomLevel + SK_Scalar1; | 1556 fZoomScale = fZoomLevel + SK_Scalar1; |
1557 } else if (fZoomLevel < 0) { | 1557 } else if (fZoomLevel < 0) { |
1558 fZoomLevel = SkMaxScalar(fZoomLevel, MIN_ZOOM_LEVEL); | 1558 fZoomLevel = SkMaxScalar(fZoomLevel, MIN_ZOOM_LEVEL); |
1559 fZoomScale = SK_Scalar1 / (SK_Scalar1 - fZoomLevel); | 1559 fZoomScale = SK_Scalar1 / (SK_Scalar1 - fZoomLevel); |
1560 } else { | 1560 } else { |
1561 fZoomScale = SK_Scalar1; | 1561 fZoomScale = SK_Scalar1; |
1562 } | 1562 } |
1563 this->updateMatrix(); | 1563 this->updateMatrix(); |
(...skipping 986 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2550 SkGraphics::Init(); | 2550 SkGraphics::Init(); |
2551 SkEvent::Init(); | 2551 SkEvent::Init(); |
2552 } | 2552 } |
2553 | 2553 |
2554 // FIXME: this should be in a header | 2554 // FIXME: this should be in a header |
2555 void application_term(); | 2555 void application_term(); |
2556 void application_term() { | 2556 void application_term() { |
2557 SkEvent::Term(); | 2557 SkEvent::Term(); |
2558 SkGraphics::Term(); | 2558 SkGraphics::Term(); |
2559 } | 2559 } |
OLD | NEW |