Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
sxychenjing
engine
提交
a9bf204c
E
engine
项目概览
sxychenjing
/
engine
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
E
engine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
a9bf204c
编写于
8月 03, 2015
作者:
A
Adam Barth
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #430 from abarth/sk_image
Use SkImage instead of SkBitmap
上级
cf193ccb
c4fd79b5
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
12 addition
and
10 deletion
+12
-10
sky/engine/core/loader/CanvasImageDecoder.cpp
sky/engine/core/loader/CanvasImageDecoder.cpp
+3
-1
sky/engine/core/painting/Canvas.cpp
sky/engine/core/painting/Canvas.cpp
+3
-3
sky/engine/core/painting/CanvasImage.cpp
sky/engine/core/painting/CanvasImage.cpp
+2
-2
sky/engine/core/painting/CanvasImage.h
sky/engine/core/painting/CanvasImage.h
+4
-4
未找到文件。
sky/engine/core/loader/CanvasImageDecoder.cpp
浏览文件 @
a9bf204c
...
@@ -57,7 +57,9 @@ void CanvasImageDecoder::OnDataComplete() {
...
@@ -57,7 +57,9 @@ void CanvasImageDecoder::OnDataComplete() {
}
}
RefPtr
<
CanvasImage
>
resultImage
=
CanvasImage
::
create
();
RefPtr
<
CanvasImage
>
resultImage
=
CanvasImage
::
create
();
resultImage
->
setBitmap
(
decoder
->
frameBufferAtIndex
(
0
)
->
getSkBitmap
());
ImageFrame
*
imageFrame
=
decoder
->
frameBufferAtIndex
(
0
);
RefPtr
<
SkImage
>
skImage
=
adoptRef
(
SkImage
::
NewFromBitmap
(
imageFrame
->
getSkBitmap
()));
resultImage
->
setImage
(
skImage
.
release
());
callback_
->
handleEvent
(
resultImage
.
get
());
callback_
->
handleEvent
(
resultImage
.
get
());
}
}
...
...
sky/engine/core/painting/Canvas.cpp
浏览文件 @
a9bf204c
...
@@ -229,14 +229,14 @@ void Canvas::drawImage(const CanvasImage* image, const Point& p, const Paint* pa
...
@@ -229,14 +229,14 @@ void Canvas::drawImage(const CanvasImage* image, const Point& p, const Paint* pa
if
(
!
m_canvas
)
if
(
!
m_canvas
)
return
;
return
;
ASSERT
(
image
);
ASSERT
(
image
);
m_canvas
->
draw
Bitmap
(
image
->
bitmap
(),
p
.
sk_point
.
x
(),
p
.
sk_point
.
y
(),
&
paint
->
paint
());
m_canvas
->
draw
Image
(
image
->
image
(),
p
.
sk_point
.
x
(),
p
.
sk_point
.
y
(),
&
paint
->
paint
());
}
}
void
Canvas
::
drawImageRect
(
const
CanvasImage
*
image
,
Rect
&
src
,
Rect
&
dst
,
Paint
*
paint
)
{
void
Canvas
::
drawImageRect
(
const
CanvasImage
*
image
,
Rect
&
src
,
Rect
&
dst
,
Paint
*
paint
)
{
if
(
!
m_canvas
)
if
(
!
m_canvas
)
return
;
return
;
ASSERT
(
image
);
ASSERT
(
image
);
m_canvas
->
draw
BitmapRect
(
image
->
bitmap
(),
&
src
.
sk_rect
,
dst
.
sk_rect
,
&
paint
->
paint
());
m_canvas
->
draw
ImageRect
(
image
->
image
(),
&
src
.
sk_rect
,
dst
.
sk_rect
,
&
paint
->
paint
());
}
}
void
Canvas
::
drawPicture
(
Picture
*
picture
)
void
Canvas
::
drawPicture
(
Picture
*
picture
)
...
@@ -272,7 +272,7 @@ void Canvas::drawAtlas(CanvasImage* atlas,
...
@@ -272,7 +272,7 @@ void Canvas::drawAtlas(CanvasImage* atlas,
{
{
if
(
!
m_canvas
)
if
(
!
m_canvas
)
return
;
return
;
RefPtr
<
SkImage
>
skImage
=
a
doptRef
(
SkImage
::
NewFromBitmap
(
atlas
->
bitmap
())
);
RefPtr
<
SkImage
>
skImage
=
a
tlas
->
image
(
);
if
(
transforms
.
size
()
!=
rects
.
size
())
if
(
transforms
.
size
()
!=
rects
.
size
())
return
es
.
ThrowRangeError
(
"transforms and rects lengths must match"
);
return
es
.
ThrowRangeError
(
"transforms and rects lengths must match"
);
if
(
colors
.
size
()
&&
colors
.
size
()
!=
rects
.
size
())
if
(
colors
.
size
()
&&
colors
.
size
()
!=
rects
.
size
())
...
...
sky/engine/core/painting/CanvasImage.cpp
浏览文件 @
a9bf204c
...
@@ -13,11 +13,11 @@ CanvasImage::~CanvasImage() {
...
@@ -13,11 +13,11 @@ CanvasImage::~CanvasImage() {
}
}
int
CanvasImage
::
width
()
const
{
int
CanvasImage
::
width
()
const
{
return
bitmap_
.
width
();
return
image_
->
width
();
}
}
int
CanvasImage
::
height
()
const
{
int
CanvasImage
::
height
()
const
{
return
bitmap_
.
height
();
return
image_
->
height
();
}
}
}
// namespace blink
}
// namespace blink
sky/engine/core/painting/CanvasImage.h
浏览文件 @
a9bf204c
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
#include "sky/engine/tonic/dart_wrappable.h"
#include "sky/engine/tonic/dart_wrappable.h"
#include "sky/engine/wtf/PassRefPtr.h"
#include "sky/engine/wtf/PassRefPtr.h"
#include "sky/engine/wtf/text/AtomicString.h"
#include "sky/engine/wtf/text/AtomicString.h"
#include "third_party/skia/include/core/Sk
Bitmap
.h"
#include "third_party/skia/include/core/Sk
Image
.h"
namespace
blink
{
namespace
blink
{
...
@@ -23,13 +23,13 @@ class CanvasImage final : public RefCounted<CanvasImage>,
...
@@ -23,13 +23,13 @@ class CanvasImage final : public RefCounted<CanvasImage>,
int
width
()
const
;
int
width
()
const
;
int
height
()
const
;
int
height
()
const
;
const
SkBitmap
&
bitmap
()
const
{
return
bitmap_
;
}
SkImage
*
image
()
const
{
return
image_
.
get
()
;
}
void
set
Bitmap
(
const
SkBitmap
&
bitmap
)
{
bitmap_
=
bitmap
;
}
void
set
Image
(
PassRefPtr
<
SkImage
>
image
)
{
image_
=
image
;
}
private:
private:
CanvasImage
();
CanvasImage
();
SkBitmap
bitmap
_
;
RefPtr
<
SkImage
>
image
_
;
};
};
}
// namespace blink
}
// namespace blink
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录