Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(743)

Unified Diff: samplecode/SampleApp.cpp

Issue 631943002: add surfaceprops to SkWindow, and 'D' to toggle distancefieldfonts (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « samplecode/SampleApp.h ('k') | src/views/SkWindow.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: samplecode/SampleApp.cpp
diff --git a/samplecode/SampleApp.cpp b/samplecode/SampleApp.cpp
index 6ca67bcbcd75aea22fe010a46a43def2d058efa4..1b766b021b2c68c0d86b055ab62043d9d9e68180 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 "));
« no previous file with comments | « samplecode/SampleApp.h ('k') | src/views/SkWindow.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698