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

Side by Side Diff: chrome/browser/ui/views/tabs/tab_strip.cc

Issue 2575533002: SkClipOp is an enum class now (Closed)
Patch Set: Created 4 years 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 | « chrome/browser/ui/views/tabs/tab.cc ('k') | content/browser/devtools/protocol/color_picker.cc » ('j') | 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 "chrome/browser/ui/views/tabs/tab_strip.h" 5 #include "chrome/browser/ui/views/tabs/tab_strip.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <iterator> 10 #include <iterator>
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 canvas->UndoDeviceScaleFactor(); 391 canvas->UndoDeviceScaleFactor();
392 SkPath stroke; 392 SkPath stroke;
393 GetBorderPath(0, scale, false, &stroke); 393 GetBorderPath(0, scale, false, &stroke);
394 // We want to draw a drop shadow either inside or outside the stroke, 394 // We want to draw a drop shadow either inside or outside the stroke,
395 // depending on whether we're pressed; so, either clip out what's outside 395 // depending on whether we're pressed; so, either clip out what's outside
396 // the stroke, or clip out the fill inside it. 396 // the stroke, or clip out the fill inside it.
397 if (pressed) 397 if (pressed)
398 canvas->ClipPath(stroke, true); 398 canvas->ClipPath(stroke, true);
399 Op(stroke, fill, kDifference_SkPathOp, &stroke); 399 Op(stroke, fill, kDifference_SkPathOp, &stroke);
400 if (!pressed) 400 if (!pressed)
401 canvas->sk_canvas()->clipPath(fill, kDifference_SkClipOp, true); 401 canvas->sk_canvas()->clipPath(fill, SkClipOp::kDifference, true);
402 // Now draw the stroke and shadow; the stroke will always be visible, while 402 // Now draw the stroke and shadow; the stroke will always be visible, while
403 // the shadow will be affected by the clip we set above. 403 // the shadow will be affected by the clip we set above.
404 SkPaint paint; 404 SkPaint paint;
405 paint.setAntiAlias(true); 405 paint.setAntiAlias(true);
406 const SkColor stroke_color = tab_strip_->GetToolbarTopSeparatorColor(); 406 const SkColor stroke_color = tab_strip_->GetToolbarTopSeparatorColor();
407 const float alpha = SkColorGetA(stroke_color); 407 const float alpha = SkColorGetA(stroke_color);
408 const SkAlpha shadow_alpha = 408 const SkAlpha shadow_alpha =
409 base::saturated_cast<SkAlpha>(std::round(2.1875f * alpha)); 409 base::saturated_cast<SkAlpha>(std::round(2.1875f * alpha));
410 paint.setLooper( 410 paint.setLooper(
411 CreateShadowDrawLooper(SkColorSetA(stroke_color, shadow_alpha))); 411 CreateShadowDrawLooper(SkColorSetA(stroke_color, shadow_alpha)));
(...skipping 1053 matching lines...) Expand 10 before | Expand all | Expand 10 after
1465 1465
1466 // If the active tab is being dragged, it goes last. 1466 // If the active tab is being dragged, it goes last.
1467 if (active_tab && is_dragging) 1467 if (active_tab && is_dragging)
1468 active_tab->Paint(context); 1468 active_tab->Paint(context);
1469 1469
1470 ui::PaintRecorder recorder(context, size()); 1470 ui::PaintRecorder recorder(context, size());
1471 gfx::Canvas* canvas = recorder.canvas(); 1471 gfx::Canvas* canvas = recorder.canvas();
1472 if (active_tab) { 1472 if (active_tab) {
1473 canvas->sk_canvas()->clipRect( 1473 canvas->sk_canvas()->clipRect(
1474 gfx::RectToSkRect(active_tab->GetMirroredBounds()), 1474 gfx::RectToSkRect(active_tab->GetMirroredBounds()),
1475 kDifference_SkClipOp); 1475 SkClipOp::kDifference);
1476 } 1476 }
1477 BrowserView::Paint1pxHorizontalLine(canvas, GetToolbarTopSeparatorColor(), 1477 BrowserView::Paint1pxHorizontalLine(canvas, GetToolbarTopSeparatorColor(),
1478 GetLocalBounds(), true); 1478 GetLocalBounds(), true);
1479 } 1479 }
1480 1480
1481 const char* TabStrip::GetClassName() const { 1481 const char* TabStrip::GetClassName() const {
1482 static const char kViewClassName[] = "TabStrip"; 1482 static const char kViewClassName[] = "TabStrip";
1483 return kViewClassName; 1483 return kViewClassName;
1484 } 1484 }
1485 1485
(...skipping 1314 matching lines...) Expand 10 before | Expand all | Expand 10 after
2800 ConvertPointToViewAndGetEventHandler(this, newtab_button_, point); 2800 ConvertPointToViewAndGetEventHandler(this, newtab_button_, point);
2801 if (view) 2801 if (view)
2802 return view; 2802 return view;
2803 } 2803 }
2804 Tab* tab = FindTabForEvent(point); 2804 Tab* tab = FindTabForEvent(point);
2805 if (tab) 2805 if (tab)
2806 return ConvertPointToViewAndGetEventHandler(this, tab, point); 2806 return ConvertPointToViewAndGetEventHandler(this, tab, point);
2807 } 2807 }
2808 return this; 2808 return this;
2809 } 2809 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/tabs/tab.cc ('k') | content/browser/devtools/protocol/color_picker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698