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

Side by Side Diff: ui/gfx/image/image_skia_operations.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 | « ui/gfx/canvas.cc ('k') | ui/views/animation/ink_drop_painted_layer_delegates.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 "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 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 void Draw(Canvas* canvas) override { 411 void Draw(Canvas* canvas) override {
412 SkPaint paint; 412 SkPaint paint;
413 paint.setLooper(CreateShadowDrawLooperCorrectBlur(shadows_)); 413 paint.setLooper(CreateShadowDrawLooperCorrectBlur(shadows_));
414 Insets insets = -ShadowValue::GetMargin(shadows_); 414 Insets insets = -ShadowValue::GetMargin(shadows_);
415 gfx::Rect bounds(size()); 415 gfx::Rect bounds(size());
416 bounds.Inset(insets); 416 bounds.Inset(insets);
417 SkRRect r_rect = SkRRect::MakeRectXY(gfx::RectToSkRect(bounds), 417 SkRRect r_rect = SkRRect::MakeRectXY(gfx::RectToSkRect(bounds),
418 corner_radius_, corner_radius_); 418 corner_radius_, corner_radius_);
419 419
420 // Clip out the center so it's not painted with the shadow. 420 // Clip out the center so it's not painted with the shadow.
421 canvas->sk_canvas()->clipRRect(r_rect, kDifference_SkClipOp, true); 421 canvas->sk_canvas()->clipRRect(r_rect, SkClipOp::kDifference, true);
422 // Clipping alone is not enough --- due to anti aliasing there will still be 422 // Clipping alone is not enough --- due to anti aliasing there will still be
423 // some of the fill color in the rounded corners. We must make the fill 423 // some of the fill color in the rounded corners. We must make the fill
424 // color transparent. 424 // color transparent.
425 paint.setColor(SK_ColorTRANSPARENT); 425 paint.setColor(SK_ColorTRANSPARENT);
426 canvas->sk_canvas()->drawRRect(r_rect, paint); 426 canvas->sk_canvas()->drawRRect(r_rect, paint);
427 } 427 }
428 428
429 private: 429 private:
430 static Size CalculateSize(const std::vector<ShadowValue>& shadows, 430 static Size CalculateSize(const std::vector<ShadowValue>& shadows,
431 float corner_radius) { 431 float corner_radius) {
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
673 if (icon.isNull()) 673 if (icon.isNull())
674 return ImageSkia(); 674 return ImageSkia();
675 675
676 if (badge.isNull()) 676 if (badge.isNull())
677 return icon; 677 return icon;
678 678
679 return ImageSkia(new IconWithBadgeSource(icon, badge), icon.size()); 679 return ImageSkia(new IconWithBadgeSource(icon, badge), icon.size());
680 } 680 }
681 681
682 } // namespace gfx 682 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/canvas.cc ('k') | ui/views/animation/ink_drop_painted_layer_delegates.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698