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

Side by Side Diff: ui/views/bubble/bubble_border.cc

Issue 771563003: use SkClipOps where we can, legacyClip where we need to rework Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 unified diff | Download patch
« no previous file with comments | « ui/ozone/platform/dri/dri_window_delegate_impl.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "ui/base/resource/resource_bundle.h" 10 #include "ui/base/resource/resource_bundle.h"
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 bounds.Inset(-GetBorderThickness(), -GetBorderThickness()); 204 bounds.Inset(-GetBorderThickness(), -GetBorderThickness());
205 const gfx::Rect arrow_bounds = GetArrowRect(view.GetLocalBounds()); 205 const gfx::Rect arrow_bounds = GetArrowRect(view.GetLocalBounds());
206 if (arrow_bounds.IsEmpty()) { 206 if (arrow_bounds.IsEmpty()) {
207 Painter::PaintPainterAt(canvas, images_->border_painter.get(), bounds); 207 Painter::PaintPainterAt(canvas, images_->border_painter.get(), bounds);
208 return; 208 return;
209 } 209 }
210 210
211 // Clip the arrow bounds out to avoid painting the overlapping edge area. 211 // Clip the arrow bounds out to avoid painting the overlapping edge area.
212 canvas->Save(); 212 canvas->Save();
213 SkRect arrow_rect(gfx::RectToSkRect(arrow_bounds)); 213 SkRect arrow_rect(gfx::RectToSkRect(arrow_bounds));
214 canvas->sk_canvas()->clipRect(arrow_rect, SkRegion::kDifference_Op); 214 canvas->sk_canvas()->clipRect(arrow_rect, kDifference_SkClipOp);
215 Painter::PaintPainterAt(canvas, images_->border_painter.get(), bounds); 215 Painter::PaintPainterAt(canvas, images_->border_painter.get(), bounds);
216 canvas->Restore(); 216 canvas->Restore();
217 217
218 DrawArrow(canvas, arrow_bounds); 218 DrawArrow(canvas, arrow_bounds);
219 } 219 }
220 220
221 gfx::Insets BubbleBorder::GetInsets() const { 221 gfx::Insets BubbleBorder::GetInsets() const {
222 // The insets contain the stroke and shadow pixels outside the bubble fill. 222 // The insets contain the stroke and shadow pixels outside the bubble fill.
223 const int inset = GetBorderThickness(); 223 const int inset = GetBorderThickness();
224 if ((arrow_paint_type_ == PAINT_NONE) || !has_arrow(arrow_)) 224 if ((arrow_paint_type_ == PAINT_NONE) || !has_arrow(arrow_))
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 paint.setStyle(SkPaint::kFill_Style); 348 paint.setStyle(SkPaint::kFill_Style);
349 paint.setColor(border_->background_color()); 349 paint.setColor(border_->background_color());
350 SkPath path; 350 SkPath path;
351 gfx::Rect bounds(view->GetLocalBounds()); 351 gfx::Rect bounds(view->GetLocalBounds());
352 bounds.Inset(border_->GetInsets()); 352 bounds.Inset(border_->GetInsets());
353 353
354 canvas->DrawRoundRect(bounds, border_->GetBorderCornerRadius(), paint); 354 canvas->DrawRoundRect(bounds, border_->GetBorderCornerRadius(), paint);
355 } 355 }
356 356
357 } // namespace views 357 } // namespace views
OLDNEW
« no previous file with comments | « ui/ozone/platform/dri/dri_window_delegate_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698