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/gfx/image/image_skia_operations.h" | 5 #include "ui/gfx/image/image_skia_operations.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 public: | 401 public: |
402 HorizontalShadowSource(const std::vector<ShadowValue>& shadows, | 402 HorizontalShadowSource(const std::vector<ShadowValue>& shadows, |
403 bool fades_down) | 403 bool fades_down) |
404 : CanvasImageSource(Size(1, GetHeightForShadows(shadows)), false), | 404 : CanvasImageSource(Size(1, GetHeightForShadows(shadows)), false), |
405 shadows_(shadows), | 405 shadows_(shadows), |
406 fades_down_(fades_down) {} | 406 fades_down_(fades_down) {} |
407 ~HorizontalShadowSource() override {} | 407 ~HorizontalShadowSource() override {} |
408 | 408 |
409 // CanvasImageSource overrides: | 409 // CanvasImageSource overrides: |
410 void Draw(Canvas* canvas) override { | 410 void Draw(Canvas* canvas) override { |
411 SkPaint paint; | 411 cc::PaintFlags paint; |
412 paint.setLooper(CreateShadowDrawLooperCorrectBlur(shadows_)); | 412 paint.setLooper(CreateShadowDrawLooperCorrectBlur(shadows_)); |
413 canvas->DrawRect(RectF(0, fades_down_ ? -1 : size().height(), 1, 1), paint); | 413 canvas->DrawRect(RectF(0, fades_down_ ? -1 : size().height(), 1, 1), paint); |
414 } | 414 } |
415 | 415 |
416 private: | 416 private: |
417 static int GetHeightForShadows(const std::vector<ShadowValue>& shadows) { | 417 static int GetHeightForShadows(const std::vector<ShadowValue>& shadows) { |
418 int height = 0; | 418 int height = 0; |
419 for (const auto& shadow : shadows) { | 419 for (const auto& shadow : shadows) { |
420 height = std::max(height, shadow.y() + ToCeiledInt(shadow.blur() / 2)); | 420 height = std::max(height, shadow.y() + ToCeiledInt(shadow.blur() / 2)); |
421 } | 421 } |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
617 if (icon.isNull()) | 617 if (icon.isNull()) |
618 return ImageSkia(); | 618 return ImageSkia(); |
619 | 619 |
620 if (badge.isNull()) | 620 if (badge.isNull()) |
621 return icon; | 621 return icon; |
622 | 622 |
623 return ImageSkia(new IconWithBadgeSource(icon, badge), icon.size()); | 623 return ImageSkia(new IconWithBadgeSource(icon, badge), icon.size()); |
624 } | 624 } |
625 | 625 |
626 } // namespace gfx | 626 } // namespace gfx |
OLD | NEW |