fix tests duto api changes

This commit is contained in:
侯歌 2024-09-18 16:15:18 +08:00
parent b996875625
commit ec23068dd2
3 changed files with 9 additions and 18 deletions

View File

@ -58,8 +58,7 @@ TEST_F(BENCHMARK,FillBlit){
TEST_F(BENCHMARK,Jpeg){ TEST_F(BENCHMARK,Jpeg){
int64_t t1=SystemClock::uptimeMillis(); int64_t t1=SystemClock::uptimeMillis();
for(int i=0;i<100;i++){ for(int i=0;i<100;i++){
auto dec =ImageDecoder::create(nullptr,"radio_logo.jpg"); auto img =ImageDecoder::loadImage(nullptr,"radio_logo.jpg");
RefPtr<ImageSurface>img=dec->decode();
} }
int64_t t2=SystemClock::uptimeMillis(); int64_t t2=SystemClock::uptimeMillis();
printf("jpeg decoe time:%f \r\n",(t2-t1)/100.f); printf("jpeg decoe time:%f \r\n",(t2-t1)/100.f);

View File

@ -112,8 +112,7 @@ TEST_F(DRAWABLE,bitmapalpha){
} }
TEST_F(DRAWABLE,ninepatch1){ TEST_F(DRAWABLE,ninepatch1){
auto dec = ImageDecoder::create(nullptr,"/home/houzh/Miniwin/apps/ntvplus/assets/drawable/paopao1.9.png"); auto img = ImageDecoder::loadImage(nullptr,"/home/houzh/Miniwin/apps/ntvplus/assets/drawable/paopao1.9.png");
RefPtr<ImageSurface>img = dec->decode();
NinePatchDrawable *d=new NinePatchDrawable(img); NinePatchDrawable *d=new NinePatchDrawable(img);
d->setBounds(50,50,600,200); d->setBounds(50,50,600,200);
d->draw(*ctx); d->draw(*ctx);
@ -121,8 +120,7 @@ TEST_F(DRAWABLE,ninepatch1){
} }
TEST_F(DRAWABLE,ninepatch2){ TEST_F(DRAWABLE,ninepatch2){
auto dec = ImageDecoder::create(nullptr,"/home/houzh/Miniwin/apps/ntvplus/assets/drawable/btn_normal.9.png");//paopao1.9.png"); auto img = ImageDecoder::loadImage(nullptr,"/home/houzh/Miniwin/apps/ntvplus/assets/drawable/btn_normal.9.png");//paopao1.9.png");
RefPtr<ImageSurface>img= dec->decode();
ctx->set_source_rgb(.4,.4,.0); ctx->set_source_rgb(.4,.4,.0);
ctx->rectangle(0,0,700,300); ctx->rectangle(0,0,700,300);
ctx->fill(); ctx->fill();

View File

@ -92,8 +92,7 @@ Assets *IMAGE::rm=nullptr;
TEST_F(IMAGE,Bitmap){ TEST_F(IMAGE,Bitmap){
loadImages("./","bmp"); loadImages("./","bmp");
for(int i=0;i<images.size();i++){ for(int i=0;i<images.size();i++){
auto dec = ImageDecoder::create(nullptr,images[i]); auto img = ImageDecoder::loadImage(nullptr,images[i]);
RefPtr<ImageSurface>img=dec->decode();
RECT rect={0,0,800,600}; RECT rect={0,0,800,600};
for(int i=0;i<10;i++){ for(int i=0;i<10;i++){
ctx->set_color(0xFF000000|(i*20<<16)); ctx->set_color(0xFF000000|(i*20<<16));
@ -111,8 +110,7 @@ TEST_F(IMAGE,Image_PNG){
printf("%lu image loaded\r\n",images.size()); printf("%lu image loaded\r\n",images.size());
for(int i=0;i<images.size();i++){ for(int i=0;i<images.size();i++){
tmstart(); tmstart();
auto dec = ImageDecoder::create(nullptr,images[i]); auto img = ImageDecoder::loadImage(nullptr,images[i]);
RefPtr<ImageSurface>img=dec->decode();
tmend("decodepng"); tmend("decodepng");
RECT rect={0,0,800,600}; RECT rect={0,0,800,600};
ctx->rectangle(rect); ctx->rectangle(rect);
@ -134,8 +132,7 @@ TEST_F(IMAGE,Image_JPG){
printf("%lu img loaded\r\n",images.size()); printf("%lu img loaded\r\n",images.size());
for(int i=0;i<images.size();i++){ for(int i=0;i<images.size();i++){
tmstart(); tmstart();
auto dec = ImageDecoder::create(nullptr,images[i]); auto img = ImageDecoder::loadImage(nullptr,images[i]);
RefPtr<ImageSurface>img=dec->decode();
tmend("decodejpg"); tmend("decodejpg");
RECT rect={0,0,800,600}; RECT rect={0,0,800,600};
ctx->rectangle(rect);ctx->fill(); ctx->rectangle(rect);ctx->fill();
@ -152,8 +149,7 @@ TEST_F(IMAGE,Image_JPG){
TEST_F(IMAGE,draw){ TEST_F(IMAGE,draw){
loadImages("/home/houzh/JPG/",""); loadImages("/home/houzh/JPG/","");
for(int i=0;i<images.size();i++){ for(int i=0;i<images.size();i++){
auto dec = ImageDecoder::create(nullptr,images[i]); auto img = ImageDecoder::loadImage(nullptr,images[i]);
RefPtr<ImageSurface>img=dec->decode();
RECT dst={100,100,200,200}; RECT dst={100,100,200,200};
RECT rs={img->get_width()/2,img->get_height()/2,img->get_width()/2,img->get_height()/2}; RECT rs={img->get_width()/2,img->get_height()/2,img->get_width()/2,img->get_height()/2};
ctx->draw_image(img,dst,&rs); ctx->draw_image(img,dst,&rs);
@ -163,8 +159,7 @@ TEST_F(IMAGE,draw){
} }
TEST_F(IMAGE,ninepatch1){ TEST_F(IMAGE,ninepatch1){
auto dec = ImageDecoder::create(nullptr,"/home/houzh/Miniwin/apps/ntvplus/assets/drawable/paopao1.9.png"); auto img = ImageDecoder::loadImage(nullptr,"/home/houzh/Miniwin/apps/ntvplus/assets/drawable/paopao1.9.png");
RefPtr<ImageSurface>img = dec->decode();
RECT rect={50,50,400,100}; RECT rect={50,50,400,100};
//std::vector<NinePatchBlock> horz,vert; //std::vector<NinePatchBlock> horz,vert;
//img->get_ninepatch(horz,vert); //img->get_ninepatch(horz,vert);
@ -172,8 +167,7 @@ TEST_F(IMAGE,ninepatch1){
} }
TEST_F(IMAGE,ninepatch2){ TEST_F(IMAGE,ninepatch2){
auto dec = ImageDecoder::create(nullptr,"/home/houzh/Miniwin/apps/ntvplus/assets/drawable/btn_normal.9.png"); auto img = ImageDecoder::loadImage(nullptr,"/home/houzh/Miniwin/apps/ntvplus/assets/drawable/btn_normal.9.png");
RefPtr<ImageSurface>img = dec->decode();
RECT rect={50,50,400,100}; RECT rect={50,50,400,100};
//std::vector<NinePatchBlock> horz,vert; //std::vector<NinePatchBlock> horz,vert;
//img->get_ninepatch(horz,vert); //img->get_ninepatch(horz,vert);