private void CycleResolutionScale() { BenchmarkRenderSetup setup = this.renderSetup.Res; int currentIndex = this.renderResolutionScales.IndexOf(setup.ResolutionScale); int newIndex = (currentIndex + 1 + this.renderResolutionScales.Count) % this.renderResolutionScales.Count; setup.ResolutionScale = this.renderResolutionScales[newIndex]; }
private void CycleAntialiasingQuality() { BenchmarkRenderSetup setup = this.renderSetup.Res; int currentIndex = this.renderAAQualityLevels.IndexOf(setup.AntialiasingQuality); int newIndex = (currentIndex + 1 + this.renderAAQualityLevels.Count) % this.renderAAQualityLevels.Count; setup.AntialiasingQuality = this.renderAAQualityLevels[newIndex]; }
private void CycleRenderSize() { BenchmarkRenderSetup setup = this.renderSetup.Res; int currentIndex = this.renderSizes.IndexOf(setup.RenderingSize); int newIndex = (currentIndex + 1 + this.renderSizes.Count) % this.renderSizes.Count; setup.RenderingSize = this.renderSizes[newIndex]; }
void ICmpBenchmarkOverlayRenderer.DrawOverlay(Canvas canvas) { BenchmarkRenderSetup setup = this.renderSetup.Res; if (setup == null) { return; } // Update the displayed info text only when the data changes. // This is a benchmark. We don't want any allocation or perf // noise in our setup. if (this.displayedRenderSize != setup.RenderingSize || this.displayedRenderScale != setup.ResolutionScale || this.displayedAAQuality != setup.AntialiasingQuality) { this.displayedRenderSize = setup.RenderingSize; this.displayedRenderScale = setup.ResolutionScale; this.displayedAAQuality = setup.AntialiasingQuality; this.text.SourceText = string.Format( "Render Size: {0} x {1}/n" + "Res. Scaling: {2:F}x/n" + "AA Quality: {3}", this.displayedRenderSize.X, this.displayedRenderSize.Y, this.displayedRenderScale, this.displayedAAQuality); } canvas.DrawText(this.text, ref this.textBufferGlyphs, ref this.textBufferIcons, canvas.Width - 10, 10, 0, null, Alignment.TopRight, true); }