• danakj's avatar
    Fix theme background to always be opaque. · 8f007b92
    danakj authored
    We introduced a mistake where if the image was not opaque, the
    background color was no longer drawn behind it, so on chromeos the
    chrome header ui could be seen through. This fixes the issue by
    rearranging the painting some, and improving some performance corner
    cases while we're here.
    
    First, we only need to use SaveLayerWithFlags() when we are blending
    together 2+ things *that are not opaque*, then want to apply alpha to
    them together. This is only needed when alpha is < 255, or when we have
    both |frame_image| and |frame_overlay_image|. Otherwise the background
    color is opaque, so drawing it first then blending one image into it is
    equivalent.
    
    Then, in both this and the other case, we draw the background color
    first, then draw the images above it, in order to ensure the bar is
    opaque.
    
    Note also that we use kPlus blending mode when alpha < 255 so that
    between the active and inactive background colors, they add up to
    255 alpha, giving us something opaque.
    
    R=estade@chromium.org
    
    Bug: 836023
    Change-Id: Ibc6b7a3dbec0d9d63b0b07f70a4c17405a3eeec2
    Reviewed-on: https://chromium-review.googlesource.com/1050690Reviewed-by: default avatarJames Cook <jamescook@chromium.org>
    Reviewed-by: default avatarEvan Stade <estade@chromium.org>
    Commit-Queue: danakj <danakj@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#557265}
    8f007b92
custom_frame_header.cc 12.7 KB