Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3221350
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T15:51:58+00:00 2026-05-17T15:51:58+00:00

In a simple canvas test I created for performance and quality measurement purposes, a

  • 0

In a simple canvas test I created for performance and quality measurement purposes, a canvas is painted with randomised colors and images during an unlimited period.

A sample is shown here: http://litterific.com/minisite/

Warning: Only open this in Opera or Chrome, the script is pretty heavy can hang up on slow computers, don’t leave the script running while you are getting coffee ;)) It is just a rough prototype and did not optimize it.

What I noticed here is that the results as painted by the script (js/asset.js) are different in various browsers. Especially in Opera there is much more “green” in the painting than in Chrome

alt text

code is found here: http://litterific.com/minisite/js/asset.js

My question is:

How this is caused. Different random seeds? Different rounding or different color behavior in Opera?

Note: It is exactly the same script in both browsers, so perhaps you could have a look at it in both Chrome and Opera.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T15:51:58+00:00Added an answer on May 17, 2026 at 3:51 pm

    It’s not random numbers causing the problems, it’s “funny” pixel data. Here’s the change:

    for (i = 0, n = pixels.data.length; i < n; i += 4){
      pixels.data[i + 0] = Math.max(0, Math.min(255, Math.floor(r * f)));
      pixels.data[i + 1] = Math.max(0, Math.min(255, Math.floor(g * f)));
      pixels.data[i + 2] = 0;
      pixels.data[i + 3] = pixels.data[i + 3]; 
    }
    

    If you ensure that the pixel values are integers in the right range, Opera works fine.

    Oh also, and this is probably obvious, it goes a lot faster if you hoist those multiplications out of the loop.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I created a very simple test control that has a Rectangle on a canvas
I have created a simple test game that randomly spawns icons that move around
I'm trying to create an SDL drawing canvas inside of a simple QT4 window,
This simple code shows a green canvas on a red canvas, i would like
I have a simple page with canvas control. Inside canvas I have some SL
I have a simple drag to draw doodle style HTML5/canvas implementation which uses the
I'm making a simple JavaScript graphing library using the canvas element. I really suck
Hi I am trying to create a simple pie chart using the HTML canvas
Simple ASP.NET application. I have two drop-down controls. On the first-drop down I have
Simple as the title states: Can you use only Java commands to take a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.