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

Side by Side Diff: ui/views/painter.cc

Issue 9332006: ui/gfx: Make the first version of Canvas::TileImageInt take a gfx::Rect. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: put back the Peter's nits 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/views/controls/scrollbar/bitmap_scroll_bar.cc ('k') | ui/views/window/custom_frame_view.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) 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 "ui/views/painter.h" 5 #include "ui/views/painter.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "third_party/skia/include/core/SkBitmap.h" 8 #include "third_party/skia/include/core/SkBitmap.h"
9 #include "third_party/skia/include/effects/SkGradientShader.h" 9 #include "third_party/skia/include/effects/SkGradientShader.h"
10 #include "ui/base/resource/resource_bundle.h" 10 #include "ui/base/resource/resource_bundle.h"
11 #include "ui/gfx/canvas.h" 11 #include "ui/gfx/canvas.h"
12 #include "ui/gfx/canvas_skia.h" 12 #include "ui/gfx/canvas_skia.h"
13 #include "ui/gfx/insets.h" 13 #include "ui/gfx/insets.h"
14 #include "ui/gfx/point.h" 14 #include "ui/gfx/point.h"
15 #include "ui/gfx/rect.h"
15 16
16 namespace views { 17 namespace views {
17 18
18 namespace { 19 namespace {
19 20
20 class GradientPainter : public Painter { 21 class GradientPainter : public Painter {
21 public: 22 public:
22 GradientPainter(bool horizontal, const SkColor& top, const SkColor& bottom) 23 GradientPainter(bool horizontal, const SkColor& top, const SkColor& bottom)
23 : horizontal_(horizontal) { 24 : horizontal_(horizontal) {
24 colors_[0] = top; 25 colors_[0] = top;
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 } 183 }
183 184
184 void HorizontalPainter::Paint(int w, int h, gfx::Canvas* canvas) { 185 void HorizontalPainter::Paint(int w, int h, gfx::Canvas* canvas) {
185 if (w < (images_[LEFT]->width() + images_[CENTER]->width() + 186 if (w < (images_[LEFT]->width() + images_[CENTER]->width() +
186 images_[RIGHT]->width())) { 187 images_[RIGHT]->width())) {
187 // No room to paint. 188 // No room to paint.
188 return; 189 return;
189 } 190 }
190 canvas->DrawBitmapInt(*images_[LEFT], 0, 0); 191 canvas->DrawBitmapInt(*images_[LEFT], 0, 0);
191 canvas->DrawBitmapInt(*images_[RIGHT], w - images_[RIGHT]->width(), 0); 192 canvas->DrawBitmapInt(*images_[RIGHT], w - images_[RIGHT]->width(), 0);
192 canvas->TileImageInt(*images_[CENTER], 193 canvas->TileImage(*images_[CENTER], gfx::Rect(images_[LEFT]->width(), 0,
193 images_[LEFT]->width(), 194 w - images_[LEFT]->width() - images_[RIGHT]->width(), height_));
194 0,
195 w - images_[LEFT]->width() - images_[RIGHT]->width(),
196 height_);
197 } 195 }
198 196
199 } // namespace views 197 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/scrollbar/bitmap_scroll_bar.cc ('k') | ui/views/window/custom_frame_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698