diff options
author | danakj <danakj@chromium.org> | 2015-04-09 12:43:50 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-04-09 19:45:20 +0000 |
commit | fe53e50cf943cf2fa352e41e5343ea1a1d331570 (patch) | |
tree | 6de2835d09106e25279e1d5f6419d000af6235f7 /cc/blink | |
parent | 00194e78d7abbe83af8aab3e23c49e90d767126f (diff) | |
download | chromium_src-fe53e50cf943cf2fa352e41e5343ea1a1d331570.zip chromium_src-fe53e50cf943cf2fa352e41e5343ea1a1d331570.tar.gz chromium_src-fe53e50cf943cf2fa352e41e5343ea1a1d331570.tar.bz2 |
ui: Add --ui-enable-slimming-paint and DisplayItem-backed PaintContext.
With the new flag enabled, ui::Layer will paint by emiting a
cc::DisplayItemList instead of painting into a gfx::Canvas supplied
by the compositor.
This patch adds a constructor to PaintContext that takes a
cc::DisplayItemList instead of a gfx::Canvas, and updates the various
Recorder classes to support emitting cc::DisplayItems if there is no
Canvas present in the PaintContext.
With this the UI paints correctly via the display-item backend (though
without caching to make it speedy).
R=piman@chromium.org, senorblanco@chromium.org, ajuma
BUG=466426
Review URL: https://codereview.chromium.org/1073603003
Cr-Commit-Position: refs/heads/master@{#324489}
Diffstat (limited to 'cc/blink')
-rw-r--r-- | cc/blink/web_display_item_list_impl.cc | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/cc/blink/web_display_item_list_impl.cc b/cc/blink/web_display_item_list_impl.cc index f9afded..a253beb 100644 --- a/cc/blink/web_display_item_list_impl.cc +++ b/cc/blink/web_display_item_list_impl.cc @@ -20,6 +20,7 @@ #include "third_party/skia/include/core/SkColorFilter.h" #include "third_party/skia/include/core/SkPicture.h" #include "third_party/skia/include/utils/SkMatrix44.h" +#include "ui/gfx/geometry/safe_integer_conversions.h" #include "ui/gfx/transform.h" namespace cc_blink { @@ -87,8 +88,13 @@ void WebDisplayItemListImpl::appendCompositingItem( SkXfermode::Mode xfermode, SkRect* bounds, SkColorFilter* color_filter) { + DCHECK_GE(opacity, 0.f); + DCHECK_LE(opacity, 1.f); + // TODO(ajuma): This should really be rounding instead of flooring the alpha + // value, but that breaks slimming paint reftests. display_item_list_->AppendItem(cc::CompositingDisplayItem::Create( - opacity, xfermode, bounds, skia::SharePtr(color_filter))); + static_cast<uint8_t>(gfx::ToFlooredInt(255 * opacity)), xfermode, bounds, + skia::SharePtr(color_filter))); } void WebDisplayItemListImpl::appendEndCompositingItem() { |