aboutsummaryrefslogtreecommitdiff
path: root/samplecode/SampleApp.cpp
diff options
context:
space:
mode:
authordjsollen@google.com <djsollen@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-12-07 21:52:34 +0000
committerdjsollen@google.com <djsollen@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-12-07 21:52:34 +0000
commitbcedc220121e36b7c6f52aadb7000de1c5aee609 (patch)
treebbcdae8175be6d9d05d6ceebd3b8fe8096fa2994 /samplecode/SampleApp.cpp
parentd3d377f1d6f2b4450ca34a3c1b9de880b8a0632c (diff)
Added the following 3 features to sample app.
1) Imported SKP files can now be run using the bbox playback ('b' key) 2) Imported SKP files are displayed using their basename 3) FPS counter has been updated to print time to draw all tiles Review URL: https://codereview.appspot.com/6904057 git-svn-id: http://skia.googlecode.com/svn/trunk@6718 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'samplecode/SampleApp.cpp')
-rw-r--r--samplecode/SampleApp.cpp25
1 files changed, 19 insertions, 6 deletions
diff --git a/samplecode/SampleApp.cpp b/samplecode/SampleApp.cpp
index cc06e04250..716998f960 100644
--- a/samplecode/SampleApp.cpp
+++ b/samplecode/SampleApp.cpp
@@ -1051,6 +1051,10 @@ void SampleWindow::draw(SkCanvas* canvas) {
this->updateMatrix();
}
+ if (fMeasureFPS) {
+ fMeasureFPS_Time = 0;
+ }
+
if (fNClip) {
this->INHERITED::draw(canvas);
SkBitmap orig = capture_bitmap(canvas);
@@ -1111,6 +1115,11 @@ void SampleWindow::draw(SkCanvas* canvas) {
magnify(canvas);
}
+ if (fMeasureFPS && fMeasureFPS_Time) {
+ this->updateTitle();
+ this->postInvalDelay();
+ }
+
// do this last
fDevManager->publishCanvas(fDeviceType, canvas, this);
}
@@ -1396,10 +1405,8 @@ void SampleWindow::afterChildren(SkCanvas* orig) {
}
// Do this after presentGL and other finishing, rather than in afterChild
- if (fMeasureFPS && fMeasureFPS_Time) {
- fMeasureFPS_Time = SkTime::GetMSecs() - fMeasureFPS_Time;
- this->updateTitle();
- this->postInvalDelay();
+ if (fMeasureFPS && fMeasureFPS_StartTime) {
+ fMeasureFPS_Time += SkTime::GetMSecs() - fMeasureFPS_StartTime;
}
// if ((fScrollTestX | fScrollTestY) != 0)
@@ -1471,9 +1478,8 @@ void SampleWindow::beforeChild(SkView* child, SkCanvas* canvas) {
this->installDrawFilter(canvas);
if (fMeasureFPS) {
- fMeasureFPS_Time = 0; // 0 means the child is not aware of repeat-draw
if (SampleView::SetRepeatDraw(child, FPS_REPEAT_COUNT)) {
- fMeasureFPS_Time = SkTime::GetMSecs();
+ fMeasureFPS_StartTime = SkTime::GetMSecs();
}
} else {
(void)SampleView::SetRepeatDraw(child, 1);
@@ -1778,6 +1784,13 @@ bool SampleWindow::onHandleChar(SkUnichar uni) {
}
switch (uni) {
+ case 'b':
+ {
+ postEventToSink(SkNEW_ARGS(SkEvent, ("PictFileView::toggleBBox")), curr_view(this));
+ this->updateTitle();
+ this->inval(NULL);
+ break;
+ }
case 'B':
// gIgnoreFastBlurRect = !gIgnoreFastBlurRect;
this->inval(NULL);