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 | 7 |
8 #include "SampleApp.h" | 8 #include "SampleApp.h" |
9 | 9 |
10 #include "OverView.h" | 10 #include "OverView.h" |
11 #include "Resources.h" | 11 #include "Resources.h" |
12 #include "SampleCode.h" | 12 #include "SampleCode.h" |
13 #include "SamplePipeControllers.h" | 13 #include "SamplePipeControllers.h" |
14 #include "SkCanvas.h" | 14 #include "SkCanvas.h" |
15 #include "SkCommandLineFlags.h" | 15 #include "SkCommandLineFlags.h" |
16 #include "SkData.h" | 16 #include "SkData.h" |
17 #include "SkDevice.h" | 17 #include "SkDevice.h" |
18 #include "SkDocument.h" | 18 #include "SkDocument.h" |
19 #include "SkGPipe.h" | 19 #include "SkGPipe.h" |
20 #include "SkGraphics.h" | 20 #include "SkGraphics.h" |
21 #include "SkImageEncoder.h" | 21 #include "SkImageEncoder.h" |
22 #include "SkOSFile.h" | 22 #include "SkOSFile.h" |
23 //#include "SkPDFDevice.h" | |
24 //#include "SkPDFDocument.h" | |
25 #include "SkPaint.h" | 23 #include "SkPaint.h" |
26 #include "SkPicture.h" | 24 #include "SkPicture.h" |
27 #include "SkPictureRecorder.h" | 25 #include "SkPictureRecorder.h" |
28 #include "SkStream.h" | 26 #include "SkStream.h" |
29 #include "SkSurface.h" | 27 #include "SkSurface.h" |
30 #include "SkTSort.h" | 28 #include "SkTSort.h" |
31 #include "SkTime.h" | 29 #include "SkTime.h" |
32 #include "SkTypeface.h" | 30 #include "SkTypeface.h" |
33 #include "SkWindow.h" | 31 #include "SkWindow.h" |
34 #include "TransitionView.h" | |
35 #include "sk_tool_utils.h" | 32 #include "sk_tool_utils.h" |
36 | 33 |
37 #if SK_SUPPORT_GPU | 34 #if SK_SUPPORT_GPU |
38 #include "gl/GrGLInterface.h" | 35 #include "gl/GrGLInterface.h" |
39 #include "gl/GrGLUtil.h" | 36 #include "gl/GrGLUtil.h" |
40 #include "GrRenderTarget.h" | 37 #include "GrRenderTarget.h" |
41 #include "GrContext.h" | 38 #include "GrContext.h" |
42 #include "SkGpuDevice.h" | 39 #include "SkGpuDevice.h" |
43 #else | 40 #else |
44 class GrContext; | 41 class GrContext; |
(...skipping 1463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1508 m.preConcat(fGesture.localM()); | 1505 m.preConcat(fGesture.localM()); |
1509 m.preConcat(fGesture.globalM()); | 1506 m.preConcat(fGesture.globalM()); |
1510 | 1507 |
1511 this->setLocalMatrix(m); | 1508 this->setLocalMatrix(m); |
1512 | 1509 |
1513 this->updateTitle(); | 1510 this->updateTitle(); |
1514 this->inval(NULL); | 1511 this->inval(NULL); |
1515 } | 1512 } |
1516 bool SampleWindow::previousSample() { | 1513 bool SampleWindow::previousSample() { |
1517 fCurrIndex = (fCurrIndex - 1 + fSamples.count()) % fSamples.count(); | 1514 fCurrIndex = (fCurrIndex - 1 + fSamples.count()) % fSamples.count(); |
1518 this->loadView(create_transition(curr_view(this), (*fSamples[fCurrIndex])(), | 1515 this->loadView((*fSamples[fCurrIndex])()); |
1519 fTransitionPrev)); | |
1520 return true; | 1516 return true; |
1521 } | 1517 } |
1522 | 1518 |
1523 bool SampleWindow::nextSample() { | 1519 bool SampleWindow::nextSample() { |
1524 fCurrIndex = (fCurrIndex + 1) % fSamples.count(); | 1520 fCurrIndex = (fCurrIndex + 1) % fSamples.count(); |
1525 this->loadView(create_transition(curr_view(this), (*fSamples[fCurrIndex])(), | 1521 this->loadView((*fSamples[fCurrIndex])()); |
1526 fTransitionNext)); | |
1527 return true; | 1522 return true; |
1528 } | 1523 } |
1529 | 1524 |
1530 bool SampleWindow::goToSample(int i) { | 1525 bool SampleWindow::goToSample(int i) { |
1531 fCurrIndex = (i) % fSamples.count(); | 1526 fCurrIndex = (i) % fSamples.count(); |
1532 this->loadView(create_transition(curr_view(this),(*fSamples[fCurrIndex])(),
6)); | 1527 this->loadView((*fSamples[fCurrIndex])()); |
1533 return true; | 1528 return true; |
1534 } | 1529 } |
1535 | 1530 |
1536 SkString SampleWindow::getSampleTitle(int i) { | 1531 SkString SampleWindow::getSampleTitle(int i) { |
1537 return ::getSampleTitle(fSamples[i]); | 1532 return ::getSampleTitle(fSamples[i]); |
1538 } | 1533 } |
1539 | 1534 |
1540 int SampleWindow::sampleCount() { | 1535 int SampleWindow::sampleCount() { |
1541 return fSamples.count(); | 1536 return fSamples.count(); |
1542 } | 1537 } |
1543 | 1538 |
1544 void SampleWindow::showOverview() { | 1539 void SampleWindow::showOverview() { |
1545 this->loadView(create_transition(curr_view(this), | 1540 this->loadView(create_overview(fSamples.count(), fSamples.begin())); |
1546 create_overview(fSamples.count(), fSamples.
begin()), | |
1547 4)); | |
1548 } | 1541 } |
1549 | 1542 |
1550 void SampleWindow::installDrawFilter(SkCanvas* canvas) { | 1543 void SampleWindow::installDrawFilter(SkCanvas* canvas) { |
1551 canvas->setDrawFilter(new FlagsDrawFilter(fLCDState, fAAState, fSubpixelStat
e, | 1544 canvas->setDrawFilter(new FlagsDrawFilter(fLCDState, fAAState, fSubpixelStat
e, |
1552 fHintingState, fFilterLevelIndex))
->unref(); | 1545 fHintingState, fFilterLevelIndex))
->unref(); |
1553 } | 1546 } |
1554 | 1547 |
1555 void SampleWindow::postAnimatingEvent() { | 1548 void SampleWindow::postAnimatingEvent() { |
1556 if (fAnimating) { | 1549 if (fAnimating) { |
1557 (new SkEvent(ANIMATING_EVENTTYPE, this->getSinkID()))->postDelay(ANIMATI
NG_DELAY); | 1550 (new SkEvent(ANIMATING_EVENTTYPE, this->getSinkID()))->postDelay(ANIMATI
NG_DELAY); |
(...skipping 876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2434 setenv("ANDROID_ROOT", "/android/device/data", 0); | 2427 setenv("ANDROID_ROOT", "/android/device/data", 0); |
2435 #endif | 2428 #endif |
2436 SkGraphics::Init(); | 2429 SkGraphics::Init(); |
2437 SkEvent::Init(); | 2430 SkEvent::Init(); |
2438 } | 2431 } |
2439 | 2432 |
2440 void application_term() { | 2433 void application_term() { |
2441 SkEvent::Term(); | 2434 SkEvent::Term(); |
2442 SkGraphics::Term(); | 2435 SkGraphics::Term(); |
2443 } | 2436 } |
OLD | NEW |