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/bubble/bubble_border.h" | 5 #include "ui/views/bubble/bubble_border.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
532 | 532 |
533 cc::PaintFlags flags; | 533 cc::PaintFlags flags; |
534 std::vector<gfx::ShadowValue> shadows; | 534 std::vector<gfx::ShadowValue> shadows; |
535 // gfx::ShadowValue counts blur pixels both inside and outside the shape, | 535 // gfx::ShadowValue counts blur pixels both inside and outside the shape, |
536 // whereas these blur values only describe the outside portion, hence they | 536 // whereas these blur values only describe the outside portion, hence they |
537 // must be doubled. | 537 // must be doubled. |
538 shadows.emplace_back(gfx::Vector2d(0, kSmallShadowVerticalOffset), | 538 shadows.emplace_back(gfx::Vector2d(0, kSmallShadowVerticalOffset), |
539 2 * kSmallShadowBlur, kSmallShadowColor); | 539 2 * kSmallShadowBlur, kSmallShadowColor); |
540 shadows.emplace_back(gfx::Vector2d(0, kLargeShadowVerticalOffset), | 540 shadows.emplace_back(gfx::Vector2d(0, kLargeShadowVerticalOffset), |
541 2 * kLargeShadowBlur, kLargeShadowColor); | 541 2 * kLargeShadowBlur, kLargeShadowColor); |
542 flags.setLooper(gfx::CreateShadowDrawLooperCorrectBlur(shadows)); | 542 flags.setLooper(gfx::CreateShadowDrawLooper(shadows)); |
543 flags.setColor(SkColorSetA(SK_ColorBLACK, 0x26)); | 543 flags.setColor(SkColorSetA(SK_ColorBLACK, 0x26)); |
544 flags.setAntiAlias(true); | 544 flags.setAntiAlias(true); |
545 | 545 |
546 SkRRect r_rect = GetClientRect(view); | 546 SkRRect r_rect = GetClientRect(view); |
547 canvas->sk_canvas()->clipRRect(r_rect, SkClipOp::kDifference, | 547 canvas->sk_canvas()->clipRRect(r_rect, SkClipOp::kDifference, |
548 true /*doAntiAlias*/); | 548 true /*doAntiAlias*/); |
549 | 549 |
550 // The border is drawn outside the content area. | 550 // The border is drawn outside the content area. |
551 const SkScalar one_pixel = | 551 const SkScalar one_pixel = |
552 SkFloatToScalar(kBorderStrokeThicknessPx / canvas->image_scale()); | 552 SkFloatToScalar(kBorderStrokeThicknessPx / canvas->image_scale()); |
(...skipping 22 matching lines...) Expand all Loading... |
575 flags.setStyle(cc::PaintFlags::kFill_Style); | 575 flags.setStyle(cc::PaintFlags::kFill_Style); |
576 flags.setColor(border_->background_color()); | 576 flags.setColor(border_->background_color()); |
577 SkPath path; | 577 SkPath path; |
578 gfx::RectF bounds(view->GetLocalBounds()); | 578 gfx::RectF bounds(view->GetLocalBounds()); |
579 bounds.Inset(gfx::InsetsF(border_->GetInsets())); | 579 bounds.Inset(gfx::InsetsF(border_->GetInsets())); |
580 | 580 |
581 canvas->DrawRoundRect(bounds, border_->GetBorderCornerRadius(), flags); | 581 canvas->DrawRoundRect(bounds, border_->GetBorderCornerRadius(), flags); |
582 } | 582 } |
583 | 583 |
584 } // namespace views | 584 } // namespace views |
OLD | NEW |