diff options
author | wjmaclean@chromium.org <wjmaclean@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-10 16:43:27 +0000 |
---|---|---|
committer | wjmaclean@chromium.org <wjmaclean@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-10 16:43:27 +0000 |
commit | c3870f4f8eb28a1e1685426368758e2cd8754e03 (patch) | |
tree | 251094ddb06d759955749a30b9cb271feff0a581 /views | |
parent | 9a7a1f3ff43d10f7b8f5071fdd0d903691bd72ec (diff) | |
download | chromium_src-c3870f4f8eb28a1e1685426368758e2cd8754e03.zip chromium_src-c3870f4f8eb28a1e1685426368758e2cd8754e03.tar.gz chromium_src-c3870f4f8eb28a1e1685426368758e2cd8754e03.tar.bz2 |
Remove COMPOSITOR_2 flag, old compositor code.
BUG=none
TEST=compiles, run manually
Review URL: http://codereview.chromium.org/6975051
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@88671 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views')
-rw-r--r-- | views/run_all_unittests.cc | 4 | ||||
-rw-r--r-- | views/view.cc | 73 | ||||
-rw-r--r-- | views/view.h | 19 | ||||
-rw-r--r-- | views/view_unittest.cc | 2 | ||||
-rw-r--r-- | views/widget/root_view.cc | 2 | ||||
-rw-r--r-- | views/widget/root_view.h | 2 | ||||
-rw-r--r-- | views/widget/widget.cc | 11 |
7 files changed, 6 insertions, 107 deletions
diff --git a/views/run_all_unittests.cc b/views/run_all_unittests.cc index 3a0e106..9d68e16 100644 --- a/views/run_all_unittests.cc +++ b/views/run_all_unittests.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -19,7 +19,7 @@ class ViewTestSuite : public base::TestSuite { base::TestSuite::Initialize(); ResourceBundle::InitSharedInstance("en-US"); -#if defined(TOUCH_UI) +#if defined(OS_LINUX) // Disable GPU browser compositor during unit tests. views::View::set_use_acceleration_when_possible(false); #endif diff --git a/views/view.cc b/views/view.cc index 7ed2ac8..807316d 100644 --- a/views/view.cc +++ b/views/view.cc @@ -106,9 +106,6 @@ View::View() clip_y_(0.0), needs_layout_(true), flip_canvas_on_paint_for_rtl_ui_(false), -#if !defined(COMPOSITOR_2) - texture_id_(0), // TODO(sadrul): 0 can be a valid texture id. -#endif texture_needs_updating_(true), paint_to_texture_(false), accelerator_registration_delayed_(false), @@ -177,9 +174,8 @@ void View::AddChildViewAt(View* view, int index) { if (layout_manager_.get()) layout_manager_->ViewAdded(this, view); -#if defined(COMPOSITOR_2) + view->MarkTextureDirty(); -#endif } void View::RemoveChildView(View* view) { @@ -402,16 +398,13 @@ void View::SetTransform(const ui::Transform& transform) { if (!transform_.get()) return; transform_.reset(NULL); -#if !defined(COMPOSITOR_2) - canvas_.reset(); -#else + if (!paint_to_texture_) texture_.reset(); -#endif + SchedulePaint(); } else { transform_.reset(new ui::Transform(transform)); -#if defined(COMPOSITOR_2) if (!texture_.get()) { // We don't yet have a texture. SchedulePaint so one is created. SchedulePaint(); @@ -426,19 +419,16 @@ void View::SetTransform(const ui::Transform& transform) { if (widget) widget->SchedulePaintInRect(widget->GetRootView()->bounds()); } -#endif } } void View::SetPaintToTexture(bool value) { -#if defined(COMPOSITOR_2) if (value == paint_to_texture_) return; paint_to_texture_ = value; if (!ShouldPaintToTexture()) texture_.reset(); -#endif } // RTL positioning ------------------------------------------------------------- @@ -630,18 +620,8 @@ void View::SchedulePaintInRect(const gfx::Rect& rect) { if (!IsVisible()) return; -#if defined(COMPOSITOR_2) MarkTextureDirty(); SchedulePaintInternal(rect); -#else - if (parent_) { - // Translate the requested paint rect to the parent's coordinate system - // then pass this notification up to the parent. - gfx::Rect paint_rect = ConvertRectToParent(rect); - paint_rect.Offset(GetMirroredPosition()); - parent_->SchedulePaintInRect(paint_rect); - } -#endif } void View::Paint(gfx::Canvas* canvas) { @@ -652,13 +632,6 @@ void View::Paint(gfx::Canvas* canvas) { scoped_ptr<gfx::Canvas> texture_canvas; gfx::Rect texture_rect; -#if !defined(COMPOSITOR_2) - if (use_acceleration_when_possible && - transform_.get() && transform_->HasChange()) { - // This view has a transformation. So this maintains its own canvas. - if (!canvas_.get()) - canvas_.reset(gfx::Canvas::CreateCanvas(width(), height(), false)); -#else if (ShouldPaintToTexture()) { gfx::Rect dirty_rect; if (!texture_clip_rect_.IsEmpty()) { @@ -689,7 +662,6 @@ void View::Paint(gfx::Canvas* canvas) { texture_canvas->TranslateInt(-dirty_rect.x(), -dirty_rect.y()); canvas = texture_canvas.get(); texture_rect = dirty_rect; -#endif } else { // We're going to modify the canvas, save its state first. scoped_canvas.SetCanvas(canvas); @@ -732,13 +704,6 @@ void View::Paint(gfx::Canvas* canvas) { PaintChildren(canvas); -#if !defined(COMPOSITOR_2) - if (canvas == canvas_.get()) { - texture_id_ = canvas->GetTextureID(); - - // TODO(sadrul): Make sure the Widget's compositor tree updates itself? - } -#else if (texture_canvas.get()) { texture_->SetBitmap( texture_canvas->AsCanvasSkia()->getDevice()->accessBitmap(false), @@ -746,7 +711,6 @@ void View::Paint(gfx::Canvas* canvas) { size()); texture_needs_updating_ = false; } -#endif } ThemeProvider* View::GetThemeProvider() const { @@ -1155,22 +1119,6 @@ void View::OnPaintFocusBorder(gfx::Canvas* canvas) { // Accelerated Painting -------------------------------------------------------- -#if !defined(COMPOSITOR_2) -void View::PaintComposite(ui::Compositor* compositor) { - compositor->SaveTransform(); - - // TODO(sad): Push a transform matrix for the offset and bounds of the view? - if (texture_id_) - compositor->DrawTextureWithTransform(texture_id_, GetTransform()); - - for (int i = 0, count = child_count(); i < count; ++i) { - View* child = GetChildViewAt(i); - child->PaintComposite(compositor); - } - - compositor->RestoreTransform(); -} -#else void View::PaintComposite() { if (!IsVisible()) return; @@ -1230,8 +1178,6 @@ void View::PaintToTexture(const gfx::Rect& dirty_region) { void View::OnWillCompositeTexture() { } -#endif - bool View::ShouldPaintToTexture() const { return use_acceleration_when_possible && (paint_to_texture_ || (transform_.get() && transform_->HasChange())) && @@ -1447,11 +1393,6 @@ void View::VisibilityChangedImpl(View* starting_from, bool is_visible) { } void View::BoundsChanged(const gfx::Rect& previous_bounds) { -#if !defined(COMPOSITOR_2) - if (canvas_.get()) - canvas_.reset(gfx::Canvas::CreateCanvas(width(), height(), false)); -#endif - if (IsVisible()) { if (parent_) { // Paint the old bounds. @@ -1616,7 +1557,6 @@ bool View::ConvertPointFromAncestor(const View* ancestor, // Accelerated painting -------------------------------------------------------- -#if defined(COMPOSITOR_2) void View::MarkTextureDirty() { View* owner = this; while (!((owner->transform_.get() && owner->transform_->HasChange()) || @@ -1624,14 +1564,11 @@ void View::MarkTextureDirty() { owner = owner->parent(); owner->texture_needs_updating_ = true; } -#endif void View::ResetTexture() { -#if defined(COMPOSITOR_2) texture_.reset(); for (int i = child_count() - 1; i >= 0; --i) GetChildViewAt(i)->ResetTexture(); -#endif } // Input ----------------------------------------------------------------------- @@ -1876,11 +1813,7 @@ std::string View::PrintViewGraph(bool first) { result.append("\""); if (!parent()) result.append(", shape=box"); -#if defined(COMPOSITOR_2) if (texture_.get()) -#else - if (canvas_.get()) -#endif result.append(", color=green"); result.append("]\n"); diff --git a/views/view.h b/views/view.h index 84fd459..d5df2b9 100644 --- a/views/view.h +++ b/views/view.h @@ -1002,12 +1002,6 @@ class View : public AcceleratorTarget { // Accelerated painting ------------------------------------------------------ -#if !defined(COMPOSITOR_2) - - // Performs accelerated painting using the compositor. - virtual void PaintComposite(ui::Compositor* compositor); -#else - // Invoked from SchedulePaintInRect. Invokes SchedulePaintInternal on the // parent. This does not mark the texture as dirty. It's assumed the caller // has done this. You should not need to invoke this, use SchedulePaint or @@ -1030,7 +1024,6 @@ class View : public AcceleratorTarget { // Invoked from |PaintComposite| if this view has a texture and before the // texture is rendered by the compositor. virtual void OnWillCompositeTexture(); -#endif // Returns true if this view should paint using a texture. virtual bool ShouldPaintToTexture() const; @@ -1229,10 +1222,8 @@ class View : public AcceleratorTarget { // Accelerated painting ------------------------------------------------------ -#if defined(COMPOSITOR_2) // Marks the texture this view draws into as dirty. void MarkTextureDirty(); -#endif // Releases the texture of this and recurses through all children. void ResetTexture(); @@ -1384,22 +1375,12 @@ class View : public AcceleratorTarget { // Accelerated painting ------------------------------------------------------ -#if !defined(COMPOSITOR_2) - // Each transformed view will maintain its own canvas. - scoped_ptr<gfx::Canvas> canvas_; - - // Texture ID used for accelerated painting. - // TODO(sadrul): This will eventually be replaced by an abstract texture - // object. - ui::TextureID texture_id_; -#else scoped_ptr<ui::Texture> texture_; // If not empty and Paint() is invoked, the canvas is created with the // specified size. // TODO(sky): this should be passed in. gfx::Rect texture_clip_rect_; -#endif // Is the texture out of date? bool texture_needs_updating_; diff --git a/views/view_unittest.cc b/views/view_unittest.cc index d880080..7cb8266 100644 --- a/views/view_unittest.cc +++ b/views/view_unittest.cc @@ -1585,7 +1585,7 @@ class TransformPaintView : public TestView { gfx::Rect scheduled_paint_rect() const { return scheduled_paint_rect_; } // Overridden from View: - virtual void SchedulePaintInRect(const gfx::Rect& rect) { + virtual void SchedulePaintInternal(const gfx::Rect& rect) { gfx::Rect xrect = ConvertRectToParent(rect); scheduled_paint_rect_ = scheduled_paint_rect_.Union(xrect); } diff --git a/views/widget/root_view.cc b/views/widget/root_view.cc index cdc44a8..ce9cc7a 100644 --- a/views/widget/root_view.cc +++ b/views/widget/root_view.cc @@ -157,13 +157,11 @@ std::string RootView::GetClassName() const { } void RootView::SchedulePaintInRect(const gfx::Rect& rect) { -#if defined(COMPOSITOR_2) MarkTextureDirty(); SchedulePaintInternal(rect); } void RootView::SchedulePaintInternal(const gfx::Rect& rect) { -#endif gfx::Rect xrect = ConvertRectToParent(rect); gfx::Rect invalid_rect = GetLocalBounds().Intersect(xrect); if (!invalid_rect.IsEmpty()) diff --git a/views/widget/root_view.h b/views/widget/root_view.h index 6bb9795..67c9e40 100644 --- a/views/widget/root_view.h +++ b/views/widget/root_view.h @@ -102,9 +102,7 @@ class RootView : public View, virtual bool IsVisibleInRootView() const OVERRIDE; virtual std::string GetClassName() const OVERRIDE; virtual void SchedulePaintInRect(const gfx::Rect& rect) OVERRIDE; -#if defined(COMPOSITOR_2) virtual void SchedulePaintInternal(const gfx::Rect& rect) OVERRIDE; -#endif virtual bool OnMousePressed(const MouseEvent& event) OVERRIDE; virtual bool OnMouseDragged(const MouseEvent& event) OVERRIDE; virtual void OnMouseReleased(const MouseEvent& event) OVERRIDE; diff --git a/views/widget/widget.cc b/views/widget/widget.cc index 94eabd5..8638f7d 100644 --- a/views/widget/widget.cc +++ b/views/widget/widget.cc @@ -651,9 +651,6 @@ bool Widget::HasFocusManager() const { } bool Widget::OnNativeWidgetPaintAccelerated(const gfx::Rect& dirty_region) { -#if !defined(COMPOSITOR_2) - return false; -#else if (!compositor_.get()) return false; @@ -662,18 +659,10 @@ bool Widget::OnNativeWidgetPaintAccelerated(const gfx::Rect& dirty_region) { GetRootView()->PaintComposite(); compositor_->NotifyEnd(); return true; -#endif } void Widget::OnNativeWidgetPaint(gfx::Canvas* canvas) { GetRootView()->Paint(canvas); -#if !defined(COMPOSITOR_2) - if (compositor_.get()) { - compositor_->NotifyStart(); - root_view_->PaintComposite(compositor_.get()); - compositor_->NotifyEnd(); - } -#endif } int Widget::GetNonClientComponent(const gfx::Point& point) { |