1// compile 2 3// Copyright 2017 The Go Authors. All rights reserved. 4// Use of this source code is governed by a BSD-style 5// license that can be found in the LICENSE file. 6 7// Issue 19515: compiler panics on spilling int128 constant. 8 9package x 10 11type VScrollPanel struct { 12 x, y int 13} 14 15type Color struct { 16 R, G, B, A float32 17} 18 19func maxF(a, b float32) float32 { 20 if a > b { 21 return 0 22 } 23 return 1 24} 25 26type TransformMatrix [6]float32 27 28type Paint struct { 29 xform TransformMatrix 30 feather float32 31 innerColor Color 32 outerColor Color 33} 34 35func BoxGradient(x, y, w, h, f float32, iColor, oColor Color) Paint { 36 return Paint{ 37 xform: TransformMatrix{9, 0, 0, 0, x, y}, 38 feather: maxF(1.0, f), 39 innerColor: iColor, 40 outerColor: oColor, 41 } 42} 43 44func (v *VScrollPanel) Draw() { 45 x := float32(v.x) 46 y := float32(v.y) 47 48 BoxGradient(x+x-2, y-1, 0, 0, 0, Color{}, Color{}) 49 BoxGradient(x+y-2, y-1, 0, 0, 0, Color{}, Color{}) 50} 51 52