CN

Android Performance Patterns: Understanding Overdraw

Word count: 1.1kReading time: 6 min
2015/04/19
loading

Series Catalog:

  1. Overview of Android Performance Patterns
  2. Android Performance Patterns: Render Performance
  3. Android Performance Patterns: Understanding Overdraw
  4. Android Performance Patterns: Understanding VSYNC
  5. Android Performance Patterns: Profile GPU Rendering

Technical review (2026-10-13): The excerpts and diagrams are from the 2015 video. Overdraw remains a useful concept; the text now adds versioned color mappings, transparency exceptions, and conditions for removing backgrounds. Lighter overlay colors alone are not evidence of a performance gain.

Original video introduction:

One of the most problematic performance problems on Android is the easiest to create; thankfully, it’s also easy to fix.

OVERDRAW is a term used to describe how many times a pixel has been re-drawn in a single frame of rendering. It’s a troublesome issue, because in most cases, pixels that are overdrawn do not end up contributing to the final rendered image. As such, it amounts to wasted work for your GPU and CPU.

Fixing overdraw has everything to do with using the available on-device tools, like Show GPU Overdraw, and then adjusting your view hierarchy in order to reduce areas where it may be occurring.

What is Overdraw?

At the beginning of the video, the author uses a house painter as an analogy: painting a wall is hard work, and if you have to repaint it because you don’t like the color, the first layer was a waste of effort. Similarly, some drawing beneath a fully opaque region may make no contribution to the final image. When you try to balance high performance with perfect design, you often run into a common performance issue: Overdraw!

Overdraw means drawing the same pixel more than once within a frame. In the stacked-card example below, work beneath a fully opaque card may be unnecessary. Overlap is not always waste: translucent content, shadows, and antialiased edges still need the underlying color for blending. Removing that content would change the image. Clipping and renderer optimizations also affect the work performed. See the official explanation.

Overdraw is distinct from View inflation, measurement, and layout. A complex hierarchy may add CPU work, but a parent that draws no background does not necessarily increase pixel coverage. Compose recomposition counts cannot be converted into overdraw counts either.

Overdraw Concept

Stacked layouts can be a double-edged sword: they look good, but may add repeated drawing. Start with redundant drawing that can be removed without changing the image, then measure whether it was a bottleneck.

Performance vs Interface

Tracking Overdraw

In Developer options, find Debug GPU Overdraw and select the option that shows overdraw areas. The old screenshot calls it Show GPU Overdraw. Availability and labels vary by system and vendor. It mainly covers HWUI drawing paths; it is not a complete counter for every independent Surface or custom OpenGL/Vulkan renderer.

Show GPU Overdraw Tool

The default palette distinguishes extra draws from total draws, as shown in Android 4.4.4 OpenGLRenderer and Caches. The overlay blends with the original image, so its visible shade also depends on the underlying color:

  • Blue: 1x overdraw (pixel drawn 2 times)
  • Green: 2x overdraw (pixel drawn 3 times)
  • Light Red: 3x overdraw (pixel drawn 4 times)
  • Dark Red: 4x or more overdraw (pixel drawn 5 or more times)

Overdraw Color Codes

Original colors mean no additional debug tint, not that the GPU did no work. Android 16 SkiaPipeline retains the default blue/green/light-red/dark-red mapping and provides an alternate palette for color-vision needs. It creates its count image by replaying drawing commands, rather than reading how many times GPU hardware actually shaded each pixel.

Reducing large, unnecessary red areas while preserving the image helps narrow the investigation. Blue is not a mandatory target, and red alone does not prove jank; transparency can legitimately require repeated drawing.

Good vs Bad Overdraw

Root Causes of Overdraw

While overdraw often comes from overlapping views, developers should pay special attention to unnecessary backgrounds.

Inefficient Overdraw Example

If the Window, root layout, and child layouts all draw the same background color, they may repeatedly cover large regions. The historical comparison below shows fewer green and red areas after redundant backgrounds were removed. The right-hand image still has tinted text and image regions; it is not zero overdraw, nor does it provide measured frame-time gains.

Removing Unnecessary Backgrounds

The original call replaces the Window background with a transparent color Drawable:

1
getWindow().setBackgroundDrawableResource(android.R.color.transparent);

That does not remove the Drawable, and it is not a universal optimization switch. First use Layout Inspector to establish which elements draw backgrounds. Often you can retain one background for the page and remove redundant backgrounds that are fully covered. Do not remove every source of the page’s base color.

If the content fully and opaquely covers the Window’s background area in every relevant state, you can evaluate removing the Window background itself from the Activity. Window.setBackgroundDrawable has existed since API 1:

1
2
// Inside the Activity, only when content fully and opaquely covers the background.
getWindow().setBackgroundDrawable(null);

null does not configure a transparent window; it differs from a transparent ColorDrawable. See the Window API contract. Check the first frame, loading and empty states, transitions, resizing, and areas near system bars for exposed backgrounds, color changes, or flashes. On Android 12 / API 31+, the splash screen has its own configuration; this runtime call does not replace the launch theme.

Turn off overdraw tinting and other debug overlays before measuring again on the same device and scenario. On Android 12 / API 31+, compare affected frames with Perfetto FrameTimeline and correlate the captured thread, GPU, and SurfaceFlinger evidence. On older systems, use the trace data available. Less background drawing in the app does not automatically reduce SurfaceFlinger’s composition time.

Perf Matters

Keep calm, profile your code, and always remember, Perf Matters.

Appendix

For more in-depth reading on overdraw and its optimization, check out these two articles on my blog:

About Me && Blog

Below is my personal intro and related links. I look forward to exchanging ideas with fellow professionals. “When three walk together, one can always be my teacher!”

  1. Blogger Intro
  2. Blog Content Navigation: A guide for my blog content.
  3. Curated Excellent Blog Articles - Android Performance Optimization Must-Knows
  4. Android Performance Optimization Knowledge Planet: The paid community stopped operating in 2026 and no longer accepts new members; this link preserves its history.

One walks faster alone, but a group walks further together.

Scan WeChat QR Code

CATALOG
  1. 1. What is Overdraw?
  2. 2. Tracking Overdraw
  3. 3. Root Causes of Overdraw
  4. 4. Perf Matters
  5. 5. Appendix
  • About Me && Blog