diff options
Diffstat (limited to 'samplecode/SampleApp.cpp')
-rw-r--r-- | samplecode/SampleApp.cpp | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/samplecode/SampleApp.cpp b/samplecode/SampleApp.cpp index 6ca67bcbcd..1b766b021b 100644 --- a/samplecode/SampleApp.cpp +++ b/samplecode/SampleApp.cpp @@ -275,7 +275,8 @@ public: SampleWindow* win) SK_OVERRIDE { #if SK_SUPPORT_GPU if (IsGpuDeviceType(dType) && fCurContext) { - return SkSurface::NewRenderTargetDirect(fCurRenderTarget); + SkSurfaceProps props(win->getSurfaceProps()); + return SkSurface::NewRenderTargetDirect(fCurRenderTarget, &props); } #endif return NULL; @@ -1715,6 +1716,9 @@ bool SampleWindow::onHandleChar(SkUnichar uni) { post_event_to_sink(SkNEW_ARGS(SkEvent, (gUpdateWindowTitleEvtName)), this); this->inval(NULL); break; + case 'D': + toggleDistanceFieldFonts(); + break; case 'f': // only toggleFPS(); @@ -1812,6 +1816,15 @@ void SampleWindow::toggleFPS() { this->inval(NULL); } +void SampleWindow::toggleDistanceFieldFonts() { + SkSurfaceProps props = this->getSurfaceProps(); + uint32_t flags = props.flags() ^ SkSurfaceProps::kUseDistanceFieldFonts_Flag; + this->setSurfaceProps(SkSurfaceProps(flags, props.pixelGeometry())); + + this->updateTitle(); + this->inval(NULL); +} + #include "SkDumpCanvas.h" bool SampleWindow::onHandleKey(SkKey key) { @@ -2023,6 +2036,9 @@ void SampleWindow::updateTitle() { if (fPerspAnim) { title.prepend("<K> "); } + if (this->getSurfaceProps().flags() & SkSurfaceProps::kUseDistanceFieldFonts_Flag) { + title.prepend("<DFF> "); + } title.prepend(trystate_str(fLCDState, "LCD ", "lcd ")); title.prepend(trystate_str(fAAState, "AA ", "aa ")); |