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

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

Issue 9021046: Pass const gfx::Rect& as the first parameter to FillRect. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: one more fix Created 8 years, 10 months 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/file_path.h" 7 #include "base/file_path.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 colors_.push_back(color); 221 colors_.push_back(color);
222 } 222 }
223 223
224 gfx::Size paint_size() const { return paint_size_; } 224 gfx::Size paint_size() const { return paint_size_; }
225 int color_index() const { return color_index_; } 225 int color_index() const { return color_index_; }
226 226
227 // Overridden from LayerDelegate: 227 // Overridden from LayerDelegate:
228 virtual void OnPaintLayer(gfx::Canvas* canvas) OVERRIDE { 228 virtual void OnPaintLayer(gfx::Canvas* canvas) OVERRIDE {
229 SkBitmap contents = canvas->AsCanvasSkia()->ExtractBitmap(); 229 SkBitmap contents = canvas->AsCanvasSkia()->ExtractBitmap();
230 paint_size_ = gfx::Size(contents.width(), contents.height()); 230 paint_size_ = gfx::Size(contents.width(), contents.height());
231 canvas->FillRect(colors_[color_index_], 231 canvas->FillRect(gfx::Rect(gfx::Point(), paint_size_),
232 gfx::Rect(gfx::Point(), paint_size_)); 232 colors_[color_index_]);
233 color_index_ = (color_index_ + 1) % static_cast<int>(colors_.size()); 233 color_index_ = (color_index_ + 1) % static_cast<int>(colors_.size());
234 } 234 }
235 235
236 private: 236 private:
237 std::vector<SkColor> colors_; 237 std::vector<SkColor> colors_;
238 int color_index_; 238 int color_index_;
239 gfx::Size paint_size_; 239 gfx::Size paint_size_;
240 240
241 DISALLOW_COPY_AND_ASSIGN(TestLayerDelegate); 241 DISALLOW_COPY_AND_ASSIGN(TestLayerDelegate);
242 }; 242 };
(...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after
1015 EXPECT_TRUE(schedule_draw_invoked_); 1015 EXPECT_TRUE(schedule_draw_invoked_);
1016 // Because SchedulePaint() was invoked from OnPaintLayer() |child| should 1016 // Because SchedulePaint() was invoked from OnPaintLayer() |child| should
1017 // still need to be painted. 1017 // still need to be painted.
1018 DrawTree(root.get()); 1018 DrawTree(root.get());
1019 EXPECT_EQ(1, child_delegate.GetPaintCountAndClear()); 1019 EXPECT_EQ(1, child_delegate.GetPaintCountAndClear());
1020 EXPECT_TRUE(child_delegate.last_clip_rect().Contains( 1020 EXPECT_TRUE(child_delegate.last_clip_rect().Contains(
1021 gfx::Rect(10, 10, 30, 30))); 1021 gfx::Rect(10, 10, 30, 30)));
1022 } 1022 }
1023 1023
1024 } // namespace ui 1024 } // 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