mirror of
https://github.com/golang/go
synced 2024-11-05 19:56:11 -07:00
image/jpeg: use strings.Builder
Change-Id: I0a51aa9e7800689c123ce3eaf74742a4641b7681 Reviewed-on: https://go-review.googlesource.com/c/go/+/428261 Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Robert Griesemer <gri@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Run-TryBot: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
This commit is contained in:
parent
07b19bf5ab
commit
c35bc69c97
@ -5,10 +5,10 @@
|
|||||||
package jpeg
|
package jpeg
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"math"
|
"math"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -181,7 +181,7 @@ func slowIDCT(b *block) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (b *block) String() string {
|
func (b *block) String() string {
|
||||||
s := bytes.NewBuffer(nil)
|
s := &strings.Builder{}
|
||||||
fmt.Fprintf(s, "{\n")
|
fmt.Fprintf(s, "{\n")
|
||||||
for y := 0; y < 8; y++ {
|
for y := 0; y < 8; y++ {
|
||||||
fmt.Fprintf(s, "\t")
|
fmt.Fprintf(s, "\t")
|
||||||
|
@ -177,7 +177,7 @@ func check(bounds image.Rectangle, pix0, pix1 []byte, stride0, stride1 int) erro
|
|||||||
}
|
}
|
||||||
|
|
||||||
func pixString(pix []byte, stride, x, y int) string {
|
func pixString(pix []byte, stride, x, y int) string {
|
||||||
s := bytes.NewBuffer(nil)
|
s := &strings.Builder{}
|
||||||
for j := 0; j < 8; j++ {
|
for j := 0; j < 8; j++ {
|
||||||
fmt.Fprintf(s, "\t")
|
fmt.Fprintf(s, "\t")
|
||||||
for i := 0; i < 8; i++ {
|
for i := 0; i < 8; i++ {
|
||||||
|
@ -13,6 +13,7 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
"os"
|
"os"
|
||||||
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -82,7 +83,7 @@ func TestUnscaledQuant(t *testing.T) {
|
|||||||
}
|
}
|
||||||
if bad {
|
if bad {
|
||||||
names := [nQuantIndex]string{"Luminance", "Chrominance"}
|
names := [nQuantIndex]string{"Luminance", "Chrominance"}
|
||||||
buf := &bytes.Buffer{}
|
buf := &strings.Builder{}
|
||||||
for i, name := range names {
|
for i, name := range names {
|
||||||
fmt.Fprintf(buf, "// %s.\n{\n", name)
|
fmt.Fprintf(buf, "// %s.\n{\n", name)
|
||||||
for zig := 0; zig < blockSize; zig++ {
|
for zig := 0; zig < blockSize; zig++ {
|
||||||
|
Loading…
Reference in New Issue
Block a user