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 8199687
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T06:13:19+00:00 2026-06-07T06:13:19+00:00

I am attempting to use canvas to make an android game, which I know

  • 0

I am attempting to use canvas to make an android game, which I know is bad because opengl is better, but I didn’t really think about it then and now I am almost done with it and I just want to get it done and convert it to opengl later.

So, at the beginning of my onDraw, I draw a bitmap with the following code:

Log.d("Start Time", System.nanoTime()/1000000 + "");
        canvas.drawBitmap(bitmaps.Background(), null, bg, paint);
        Log.d("After drawColor", System.nanoTime()/1000000 + "");

So, as you can see I draw the bitmap based on a rectangle, so it is stretched and drawn. Using the logs to see how long it took to do this, I saw that it is taking about 15 to 20 milliseconds just to draw this one bitmap!

Does anyone know why this is happening? Also, if anyone knows an easy way to switch from canvas to opengl that would be awesome :p

William

  • 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-06-07T06:13:20+00:00Added an answer on June 7, 2026 at 6:13 am

    Is bg a Rect? If so, the bitmap may have to be scaled before being drawn, which would consume time. See if you can pre-scale the bitmap.

    Secondly, do you really need the paint in the drawBitmap call? You can pass null instead, if you’re not doing transformations.

    Also why not use System.currentTimeMillis() instead of dividing nanoseconds to get millis?

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

Sidebar

Related Questions

I am attempting to use the data sources pluigin for rubymine 4.0.3 but I
I'm attempting to use a large number of short sound samples in a game
I am attempting to use double buffering with a canvas, something I've never done
I'm attempting to use the rest-client gem to post something, but for some reason,
I am attempting to develop a game with canvas element. Right now, I am
I'm attempting to use a class extending view to add a canvas and then
I'm attempting to use inet's tftp, but I'm doing something incorrectly. This simple example
Attempting to use the data series from this example no longer passes the JSONLint
Attempting to use XStream's JavaBeanConverter and running into an issue. Most likely I'm missng
When attempting to use HttpWebRequest to retrieve a page from my dev server, I

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.