From c62c195db3649c07d702a10af2004fd20085fae6 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sat, 7 Oct 2017 15:01:33 +0900 Subject: [PATCH] graphics: Bug fix: Stop using texel adjustment on iOS (#442) --- vertices.go | 8 -------- vertices_ios.go | 22 ++++++++++++++++++++++ vertices_notios.go | 28 ++++++++++++++++++++++++++++ 3 files changed, 50 insertions(+), 8 deletions(-) create mode 100644 vertices_ios.go create mode 100644 vertices_notios.go diff --git a/vertices.go b/vertices.go index 3eacf0e58..9239e5dc1 100644 --- a/vertices.go +++ b/vertices.go @@ -17,7 +17,6 @@ package ebiten import ( "github.com/hajimehoshi/ebiten/internal/affine" "github.com/hajimehoshi/ebiten/internal/restorable" - "github.com/hajimehoshi/ebiten/internal/web" ) // texelAdjustment represents a number to be used to adjust texel. @@ -26,13 +25,6 @@ import ( // See #317. var texelAdjustment float32 = 256 -func init() { - if web.IsIOSSafari() { - // Texel adjustment causes glitches on iOS Safari. - texelAdjustment = 0 - } -} - var ( quadFloat32Num = restorable.QuadVertexSizeInBytes() / 4 theVerticesBackend = &verticesBackend{} diff --git a/vertices_ios.go b/vertices_ios.go new file mode 100644 index 000000000..34e1979c5 --- /dev/null +++ b/vertices_ios.go @@ -0,0 +1,22 @@ +// Copyright 2017 The Ebiten Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// +build ios + +package ebiten + +func init() { + // Texel adjustment causes glitches on iOS. + texelAdjustment = 0 +} diff --git a/vertices_notios.go b/vertices_notios.go new file mode 100644 index 000000000..bd8d401f2 --- /dev/null +++ b/vertices_notios.go @@ -0,0 +1,28 @@ +// Copyright 2017 The Ebiten Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// +build !ios + +package ebiten + +import ( + "github.com/hajimehoshi/ebiten/internal/web" +) + +func init() { + if web.IsIOSSafari() { + // Texel adjustment causes glitches on iOS. + texelAdjustment = 0 + } +}