| 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" |
| (...skipping 2117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2128 canvas = writer.startRecording(pc, flags); | 2128 canvas = writer.startRecording(pc, flags); |
| 2129 //Must draw before controller goes out of scope and sends data | 2129 //Must draw before controller goes out of scope and sends data |
| 2130 this->INHERITED::draw(canvas); | 2130 this->INHERITED::draw(canvas); |
| 2131 //explicitly end recording to ensure writer is flushed before the memory | 2131 //explicitly end recording to ensure writer is flushed before the memory |
| 2132 //is freed in the deconstructor of the controller | 2132 //is freed in the deconstructor of the controller |
| 2133 writer.endRecording(); | 2133 writer.endRecording(); |
| 2134 } | 2134 } |
| 2135 } | 2135 } |
| 2136 | 2136 |
| 2137 void SampleView::onDraw(SkCanvas* canvas) { | 2137 void SampleView::onDraw(SkCanvas* canvas) { |
| 2138 if (!fHaveCalledOnceBeforeDraw) { |
| 2139 fHaveCalledOnceBeforeDraw = true; |
| 2140 this->onOnceBeforeDraw(); |
| 2141 } |
| 2138 this->onDrawBackground(canvas); | 2142 this->onDrawBackground(canvas); |
| 2139 | 2143 |
| 2140 for (int i = 0; i < fRepeatCount; i++) { | 2144 for (int i = 0; i < fRepeatCount; i++) { |
| 2141 SkAutoCanvasRestore acr(canvas, true); | 2145 SkAutoCanvasRestore acr(canvas, true); |
| 2142 this->onDrawContent(canvas); | 2146 this->onDrawContent(canvas); |
| 2143 } | 2147 } |
| 2144 } | 2148 } |
| 2145 | 2149 |
| 2146 void SampleView::onDrawBackground(SkCanvas* canvas) { | 2150 void SampleView::onDrawBackground(SkCanvas* canvas) { |
| 2147 canvas->drawColor(fBGColor); | 2151 canvas->drawColor(fBGColor); |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2281 setenv("ANDROID_ROOT", "/android/device/data", 0); | 2285 setenv("ANDROID_ROOT", "/android/device/data", 0); |
| 2282 #endif | 2286 #endif |
| 2283 SkGraphics::Init(); | 2287 SkGraphics::Init(); |
| 2284 SkEvent::Init(); | 2288 SkEvent::Init(); |
| 2285 } | 2289 } |
| 2286 | 2290 |
| 2287 void application_term() { | 2291 void application_term() { |
| 2288 SkEvent::Term(); | 2292 SkEvent::Term(); |
| 2289 SkGraphics::Term(); | 2293 SkGraphics::Term(); |
| 2290 } | 2294 } |
| OLD | NEW |