6

In a custom view I have, I'm using Canvas.drawBitmap with a source Bitmap that is wider than 2048px. This of course causes problems when Hardware Acceleration is enabled, with the LogCat spewing out "W/OpenGLRenderer(4968): Bitmap too large to be uploaded into a texture" each time drawBitmap is called.

So to work around this I tried calling setLayerType(View.LAYER_TYPE_SOFTWARE, null) on my view. The only problem is that it doesn't seem to help. When I try to run my app, LogCat will still give the warnings, and nothing ends up being drawn.

I cannot understand why is this so. This article on the Android site clearly states:

You can disable hardware acceleration for an individual view at runtime with the following code:

myView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);

Is there something I'm doing wrong? Why is Android not respecting the setLayerType call?


[in case it matters: I'm performing my testing on a Samsung Galaxy Tab 10.1 running Android 3.2]

Community
  • 1
  • 1
yydl
  • 24,284
  • 16
  • 65
  • 104

1 Answers1

0

Try to resize the bitmap first. Use createBitmap.

Trine
  • 255
  • 1
  • 10