Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小雨青年
freetype
提交
006c241e
F
freetype
项目概览
小雨青年
/
freetype
通知
14
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
F
freetype
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
006c241e
编写于
7月 12, 2011
作者:
N
Nigel Tao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
freetype: update for image.Pix changes (again).
R=r CC=golang-dev
http://codereview.appspot.com/4702041
上级
43d4d896
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
26 addition
and
30 deletion
+26
-30
freetype/raster/paint.go
freetype/raster/paint.go
+26
-30
未找到文件。
freetype/raster/paint.go
浏览文件 @
006c241e
...
...
@@ -62,9 +62,8 @@ func (r AlphaOverPainter) Paint(ss []Span, done bool) {
p
:=
r
.
Image
.
Pix
[
base
+
s
.
X0
:
base
+
s
.
X1
]
a
:=
int
(
s
.
A
>>
24
)
for
i
,
c
:=
range
p
{
v
:=
int
(
c
.
A
)
v
=
(
v
*
255
+
(
255
-
v
)
*
a
)
/
255
p
[
i
]
=
image
.
AlphaColor
{
uint8
(
v
)}
v
:=
int
(
c
)
p
[
i
]
=
uint8
((
v
*
255
+
(
255
-
v
)
*
a
)
/
255
)
}
}
}
...
...
@@ -101,7 +100,7 @@ func (r AlphaSrcPainter) Paint(ss []Span, done bool) {
}
base
:=
(
s
.
Y
-
r
.
Image
.
Rect
.
Min
.
Y
)
*
r
.
Image
.
Stride
-
r
.
Image
.
Rect
.
Min
.
X
p
:=
r
.
Image
.
Pix
[
base
+
s
.
X0
:
base
+
s
.
X1
]
color
:=
image
.
AlphaColor
{
uint8
(
s
.
A
>>
24
)}
color
:=
uint8
(
s
.
A
>>
24
)
for
i
:=
range
p
{
p
[
i
]
=
color
}
...
...
@@ -141,32 +140,29 @@ func (r *RGBAPainter) Paint(ss []Span, done bool) {
if
s
.
X0
>=
s
.
X1
{
continue
}
base
:=
(
s
.
Y
-
r
.
Image
.
Rect
.
Min
.
Y
)
*
r
.
Image
.
Stride
-
r
.
Image
.
Rect
.
Min
.
X
p
:=
r
.
Image
.
Pix
[
base
+
s
.
X0
:
base
+
s
.
X1
]
for
i
,
rgba
:=
range
p
{
// This code is duplicated from drawGlyphOver in $GOROOT/src/pkg/exp/draw/draw.go.
// TODO(nigeltao): Factor out common code into a utility function, once the compiler
// can inline such function calls.
// This code is similar to drawGlyphOver in $GOROOT/src/pkg/image/draw/draw.go.
ma
:=
s
.
A
>>
16
const
M
=
1
<<
16
-
1
const
m
=
1
<<
16
-
1
i0
:=
(
s
.
Y
-
r
.
Image
.
Rect
.
Min
.
Y
)
*
r
.
Image
.
Stride
+
(
s
.
X0
-
r
.
Image
.
Rect
.
Min
.
X
)
*
4
i1
:=
i0
+
(
s
.
X1
-
s
.
X0
)
*
4
if
r
.
Op
==
draw
.
Over
{
dr
:=
uint32
(
rgba
.
R
)
d
g
:=
uint32
(
rgba
.
G
)
d
b
:=
uint32
(
rgba
.
B
)
d
a
:=
uint32
(
rgba
.
A
)
a
:=
M
-
(
r
.
ca
*
ma
/
M
)
a
*=
0x101
dr
=
(
dr
*
a
+
r
.
cr
*
ma
)
/
M
dg
=
(
dg
*
a
+
r
.
cg
*
ma
)
/
M
db
=
(
db
*
a
+
r
.
cb
*
ma
)
/
M
da
=
(
da
*
a
+
r
.
ca
*
ma
)
/
M
p
[
i
]
=
image
.
RGBAColor
{
uint8
(
dr
>>
8
),
uint8
(
dg
>>
8
),
uint8
(
db
>>
8
),
uint8
(
da
>>
8
)
}
for
i
:=
i0
;
i
<
i1
;
i
+=
4
{
d
r
:=
uint32
(
r
.
Image
.
Pix
[
i
+
0
]
)
d
g
:=
uint32
(
r
.
Image
.
Pix
[
i
+
1
]
)
d
b
:=
uint32
(
r
.
Image
.
Pix
[
i
+
2
]
)
da
:=
uint32
(
r
.
Image
.
Pix
[
i
+
3
]
)
a
:=
(
m
-
(
r
.
ca
*
ma
/
m
))
*
0x101
r
.
Image
.
Pix
[
i
+
0
]
=
uint8
((
dr
*
a
+
r
.
cr
*
ma
)
/
m
>>
8
)
r
.
Image
.
Pix
[
i
+
1
]
=
uint8
((
dg
*
a
+
r
.
cg
*
ma
)
/
m
>>
8
)
r
.
Image
.
Pix
[
i
+
2
]
=
uint8
((
db
*
a
+
r
.
cb
*
ma
)
/
m
>>
8
)
r
.
Image
.
Pix
[
i
+
3
]
=
uint8
((
da
*
a
+
r
.
ca
*
ma
)
/
m
>>
8
)
}
}
else
{
dr
:=
r
.
cr
*
ma
/
M
dg
:=
r
.
cg
*
ma
/
M
db
:=
r
.
cb
*
ma
/
M
da
:=
r
.
ca
*
ma
/
M
p
[
i
]
=
image
.
RGBAColor
{
uint8
(
dr
>>
8
),
uint8
(
dg
>>
8
),
uint8
(
db
>>
8
),
uint8
(
da
>>
8
)}
for
i
:=
i0
;
i
<
i1
;
i
+=
4
{
r
.
Image
.
Pix
[
i
+
0
]
=
uint8
(
r
.
cr
*
ma
/
m
>>
8
)
r
.
Image
.
Pix
[
i
+
1
]
=
uint8
(
r
.
cg
*
ma
/
m
>>
8
)
r
.
Image
.
Pix
[
i
+
2
]
=
uint8
(
r
.
cb
*
ma
/
m
>>
8
)
r
.
Image
.
Pix
[
i
+
3
]
=
uint8
(
r
.
ca
*
ma
/
m
>>
8
)
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录