Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(478)

Unified Diff: ui/gfx/image/image_skia_operations.cc

Issue 2589163003: Add shadow/corner radius to notifications (toasts and in-center). (Closed)
Patch Set: sky reviews Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/gfx/image/image_skia_operations.h ('k') | ui/gfx/shadow_util.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/image/image_skia_operations.cc
diff --git a/ui/gfx/image/image_skia_operations.cc b/ui/gfx/image/image_skia_operations.cc
index 256e9b49f84e177bfc0d8c57e2486bdf4d04b65d..700a458a17a38e0eb8f3efe5e4e4d39b99d5b409 100644
--- a/ui/gfx/image/image_skia_operations.cc
+++ b/ui/gfx/image/image_skia_operations.cc
@@ -396,55 +396,6 @@ class DropShadowSource : public ImageSkiaSource {
DISALLOW_COPY_AND_ASSIGN(DropShadowSource);
};
-class ShadowNineboxSource : public CanvasImageSource {
- public:
- ShadowNineboxSource(const std::vector<ShadowValue>& shadows,
- float corner_radius)
- : CanvasImageSource(CalculateSize(shadows, corner_radius), false),
- shadows_(shadows),
- corner_radius_(corner_radius) {
- DCHECK(!shadows.empty());
- }
- ~ShadowNineboxSource() override {}
-
- // CanvasImageSource overrides:
- void Draw(Canvas* canvas) override {
- SkPaint paint;
- paint.setLooper(CreateShadowDrawLooperCorrectBlur(shadows_));
- Insets insets = -ShadowValue::GetMargin(shadows_);
- gfx::Rect bounds(size());
- bounds.Inset(insets);
- SkRRect r_rect = SkRRect::MakeRectXY(gfx::RectToSkRect(bounds),
- corner_radius_, corner_radius_);
-
- // Clip out the center so it's not painted with the shadow.
- canvas->sk_canvas()->clipRRect(r_rect, SkClipOp::kDifference, true);
- // Clipping alone is not enough --- due to anti aliasing there will still be
- // some of the fill color in the rounded corners. We must make the fill
- // color transparent.
- paint.setColor(SK_ColorTRANSPARENT);
- canvas->sk_canvas()->drawRRect(r_rect, paint);
- }
-
- private:
- static Size CalculateSize(const std::vector<ShadowValue>& shadows,
- float corner_radius) {
- // The "content" area (the middle tile in the 3x3 grid) is a single pixel.
- gfx::Rect bounds(0, 0, 1, 1);
- // We need enough space to render the full range of blur.
- bounds.Inset(-ShadowValue::GetBlurRegion(shadows));
- // We also need space for the full roundrect corner rounding.
- bounds.Inset(-gfx::Insets(corner_radius));
- return bounds.size();
- }
-
- const std::vector<ShadowValue> shadows_;
-
- const float corner_radius_;
-
- DISALLOW_COPY_AND_ASSIGN(ShadowNineboxSource);
-};
-
// An image source that is 1px wide, suitable for tiling horizontally.
class HorizontalShadowSource : public CanvasImageSource {
public:
@@ -639,13 +590,6 @@ ImageSkia ImageSkiaOperations::CreateImageWithDropShadow(
}
// static
-ImageSkia ImageSkiaOperations::CreateShadowNinebox(const ShadowValues& shadows,
- float corner_radius) {
- auto source = new ShadowNineboxSource(shadows, corner_radius);
- return ImageSkia(source, source->size());
-}
-
-// static
ImageSkia ImageSkiaOperations::CreateHorizontalShadow(
const std::vector<ShadowValue>& shadows,
bool fades_down) {
« no previous file with comments | « ui/gfx/image/image_skia_operations.h ('k') | ui/gfx/shadow_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698