OLD | NEW |
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 "ui/views/painter.h" | 5 #include "ui/views/painter.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.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" |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 }; | 164 }; |
165 | 165 |
166 } // namespace | 166 } // namespace |
167 | 167 |
168 // static | 168 // static |
169 void Painter::PaintPainterAt(gfx::Canvas* canvas, | 169 void Painter::PaintPainterAt(gfx::Canvas* canvas, |
170 Painter* painter, | 170 Painter* painter, |
171 const gfx::Rect& rect) { | 171 const gfx::Rect& rect) { |
172 DCHECK(canvas && painter); | 172 DCHECK(canvas && painter); |
173 canvas->Save(); | 173 canvas->Save(); |
174 canvas->Translate(rect.origin()); | 174 canvas->Translate(rect.DistanceFromOrigin()); |
175 painter->Paint(canvas, rect.size()); | 175 painter->Paint(canvas, rect.size()); |
176 canvas->Restore(); | 176 canvas->Restore(); |
177 } | 177 } |
178 | 178 |
179 // static | 179 // static |
180 Painter* Painter::CreateHorizontalGradient(SkColor c1, SkColor c2) { | 180 Painter* Painter::CreateHorizontalGradient(SkColor c1, SkColor c2) { |
181 SkColor colors[2]; | 181 SkColor colors[2]; |
182 colors[0] = c1; | 182 colors[0] = c1; |
183 colors[1] = c2; | 183 colors[1] = c2; |
184 SkScalar pos[] = {0, 1}; | 184 SkScalar pos[] = {0, 1}; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 return; | 224 return; |
225 } | 225 } |
226 canvas->DrawImageInt(*images_[LEFT], 0, 0); | 226 canvas->DrawImageInt(*images_[LEFT], 0, 0); |
227 canvas->DrawImageInt(*images_[RIGHT], | 227 canvas->DrawImageInt(*images_[RIGHT], |
228 size.width() - images_[RIGHT]->width(), 0); | 228 size.width() - images_[RIGHT]->width(), 0); |
229 canvas->TileImageInt(*images_[CENTER], images_[LEFT]->width(), 0, | 229 canvas->TileImageInt(*images_[CENTER], images_[LEFT]->width(), 0, |
230 size.width() - images_[LEFT]->width() - images_[RIGHT]->width(), height_); | 230 size.width() - images_[LEFT]->width() - images_[RIGHT]->width(), height_); |
231 } | 231 } |
232 | 232 |
233 } // namespace views | 233 } // namespace views |
OLD | NEW |