Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(397)

Side by Side Diff: ui/gfx/compositor/layer_unittest.cc

Issue 8405002: ui/gfx: Convert Canvas::FillRectInt() to use gfx::Rect. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: save some vertical space, interactive_ui_tests are fixed by Peter's fix Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/gfx/canvas_skia_linux.cc ('k') | ui/gfx/render_text.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/compiler_specific.h" 6 #include "base/compiler_specific.h"
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 #include "ui/gfx/canvas_skia.h" 9 #include "ui/gfx/canvas_skia.h"
10 #include "ui/gfx/compositor/compositor_observer.h" 10 #include "ui/gfx/compositor/compositor_observer.h"
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 colors_.push_back(color); 120 colors_.push_back(color);
121 } 121 }
122 122
123 gfx::Size paint_size() const { return paint_size_; } 123 gfx::Size paint_size() const { return paint_size_; }
124 int color_index() const { return color_index_; } 124 int color_index() const { return color_index_; }
125 125
126 // Overridden from LayerDelegate: 126 // Overridden from LayerDelegate:
127 virtual void OnPaintLayer(gfx::Canvas* canvas) OVERRIDE { 127 virtual void OnPaintLayer(gfx::Canvas* canvas) OVERRIDE {
128 SkBitmap contents = canvas->AsCanvasSkia()->ExtractBitmap(); 128 SkBitmap contents = canvas->AsCanvasSkia()->ExtractBitmap();
129 paint_size_ = gfx::Size(contents.width(), contents.height()); 129 paint_size_ = gfx::Size(contents.width(), contents.height());
130 canvas->FillRectInt(colors_.at(color_index_), 0, 0, 130 canvas->FillRect(colors_[color_index_],
131 contents.width(), 131 gfx::Rect(gfx::Point(), paint_size_));
132 contents.height());
133 color_index_ = (color_index_ + 1) % static_cast<int>(colors_.size()); 132 color_index_ = (color_index_ + 1) % static_cast<int>(colors_.size());
134 } 133 }
135 virtual void OnLayerAnimationEnded(const ui::Animation* animation) OVERRIDE { 134 virtual void OnLayerAnimationEnded(const ui::Animation* animation) OVERRIDE {
136 } 135 }
137 136
138 private: 137 private:
139 std::vector<SkColor> colors_; 138 std::vector<SkColor> colors_;
140 int color_index_; 139 int color_index_;
141 gfx::Size paint_size_; 140 gfx::Size paint_size_;
142 141
(...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after
882 EXPECT_FALSE(l2->IsDrawn()); 881 EXPECT_FALSE(l2->IsDrawn());
883 EXPECT_FALSE(l3->IsDrawn()); 882 EXPECT_FALSE(l3->IsDrawn());
884 883
885 l1->SetVisible(true); 884 l1->SetVisible(true);
886 EXPECT_TRUE(l1->IsDrawn()); 885 EXPECT_TRUE(l1->IsDrawn());
887 EXPECT_TRUE(l2->IsDrawn()); 886 EXPECT_TRUE(l2->IsDrawn());
888 EXPECT_FALSE(l3->IsDrawn()); 887 EXPECT_FALSE(l3->IsDrawn());
889 } 888 }
890 889
891 } // namespace ui 890 } // namespace ui
OLDNEW
« no previous file with comments | « ui/gfx/canvas_skia_linux.cc ('k') | ui/gfx/render_text.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698