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