Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
680 views
in Technique[技术] by (71.8m points)

cordova - Phone Android HTML5 Hardware Acceleration - Canvas

I am having a strange issue. When I have hardware acceleration enabled, if I am drawing to a canvas element, whatever is drawn on the canvas, will be re-drawn to the top of the page.

If I turn off Hardware Acceleration, this issue does not occur.

I have only personally tested it on Android 4.1.1, but I've noticed this issue before on one of our users awhile ago that I couldn't replicate (They were on Android 3+ atleast)

I can't exactly grab a screenshot (not too sure how to do that on Android), but I will try break down the process.

with hardware accel enabled

  1. user fills out usual details.
  2. user scrolls to bottom of page, draws out a Signature on canvas element.
  3. If user forgot something at top of page and scrolls to top of page
  4. A visual bug occurs, the signature they drew appears at the top of the page

However with no hardware accel, step 4 does not occur. Is there something I'm supposed to do to the HTML5 Canvas?

I'm not sure what information I need to pass over here - it seems to occur on Samsung, HTC and Google Nexus Phones/Tablets so its a consistant bug.

I tried searching around, but I always end up getting Game Development threads or the likes.

I really would like to have Hardware Accel enabled, this is the only issue that occurs from it - the peformance gains are soooo incredible

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The duplicated HTML5 canvas issue in Android has emeerged with version 4.1.1 and it's not fixed in the latest 4.2 yet.

The solution is that none of the parents HTML elements to the canvas will have overflow:hidden or overflow:scroll


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...