| 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 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 public: | 403 public: |
| 404 HorizontalShadowSource(const std::vector<ShadowValue>& shadows, | 404 HorizontalShadowSource(const std::vector<ShadowValue>& shadows, |
| 405 bool fades_down) | 405 bool fades_down) |
| 406 : CanvasImageSource(Size(1, GetHeightForShadows(shadows)), false), | 406 : CanvasImageSource(Size(1, GetHeightForShadows(shadows)), false), |
| 407 shadows_(shadows), | 407 shadows_(shadows), |
| 408 fades_down_(fades_down) {} | 408 fades_down_(fades_down) {} |
| 409 ~HorizontalShadowSource() override {} | 409 ~HorizontalShadowSource() override {} |
| 410 | 410 |
| 411 // CanvasImageSource overrides: | 411 // CanvasImageSource overrides: |
| 412 void Draw(Canvas* canvas) override { | 412 void Draw(Canvas* canvas) override { |
| 413 SkPaint paint; | 413 CdlPaint paint; |
| 414 paint.setLooper(CreateShadowDrawLooperCorrectBlur(shadows_)); | 414 paint.setLooper(CreateShadowDrawLooperCorrectBlur(shadows_)); |
| 415 canvas->DrawRect(RectF(0, fades_down_ ? -1 : size().height(), 1, 1), paint); | 415 canvas->DrawRect(RectF(0, fades_down_ ? -1 : size().height(), 1, 1), paint); |
| 416 } | 416 } |
| 417 | 417 |
| 418 private: | 418 private: |
| 419 static int GetHeightForShadows(const std::vector<ShadowValue>& shadows) { | 419 static int GetHeightForShadows(const std::vector<ShadowValue>& shadows) { |
| 420 int height = 0; | 420 int height = 0; |
| 421 for (const auto& shadow : shadows) { | 421 for (const auto& shadow : shadows) { |
| 422 height = std::max(height, shadow.y() + ToCeiledInt(shadow.blur() / 2)); | 422 height = std::max(height, shadow.y() + ToCeiledInt(shadow.blur() / 2)); |
| 423 } | 423 } |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 620 if (icon.isNull()) | 620 if (icon.isNull()) |
| 621 return ImageSkia(); | 621 return ImageSkia(); |
| 622 | 622 |
| 623 if (badge.isNull()) | 623 if (badge.isNull()) |
| 624 return icon; | 624 return icon; |
| 625 | 625 |
| 626 return ImageSkia(new IconWithBadgeSource(icon, badge), icon.size()); | 626 return ImageSkia(new IconWithBadgeSource(icon, badge), icon.size()); |
| 627 } | 627 } |
| 628 | 628 |
| 629 } // namespace gfx | 629 } // namespace gfx |
| OLD | NEW |