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

Side by Side Diff: chrome/browser/ui/app_list/extension_app_item.cc

Issue 2717943002: Fix cc/paint skia type mismatches (Closed)
Patch Set: Rebase Created 3 years, 9 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
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/app_list/extension_app_item.h" 5 #include "chrome/browser/ui/app_list/extension_app_item.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 void Draw(gfx::Canvas* canvas) override { 80 void Draw(gfx::Canvas* canvas) override {
81 // The radius used to round the app icon. 81 // The radius used to round the app icon.
82 const size_t kRoundingRadius = 2; 82 const size_t kRoundingRadius = 2;
83 83
84 canvas->DrawImageInt(icon_, 0, 0); 84 canvas->DrawImageInt(icon_, 0, 0);
85 85
86 std::unique_ptr<gfx::Canvas> masking_canvas( 86 std::unique_ptr<gfx::Canvas> masking_canvas(
87 new gfx::Canvas(gfx::Size(icon_.width(), icon_.height()), 1.0f, false)); 87 new gfx::Canvas(gfx::Size(icon_.width(), icon_.height()), 1.0f, false));
88 DCHECK(masking_canvas); 88 DCHECK(masking_canvas);
89 89
90 SkPaint opaque_paint; 90 cc::PaintFlags opaque_flags;
91 opaque_paint.setColor(SK_ColorWHITE); 91 opaque_flags.setAntiAlias(true);
92 opaque_paint.setFlags(SkPaint::kAntiAlias_Flag); 92 opaque_flags.setColor(SK_ColorWHITE);
93 masking_canvas->DrawRoundRect( 93 masking_canvas->DrawRoundRect(gfx::Rect(icon_.width(), icon_.height()),
94 gfx::Rect(icon_.width(), icon_.height()), 94 kRoundingRadius, opaque_flags);
95 kRoundingRadius, opaque_paint);
96 95
97 SkPaint masking_paint; 96 cc::PaintFlags masking_flags;
98 masking_paint.setBlendMode(SkBlendMode::kDstIn); 97 masking_flags.setBlendMode(SkBlendMode::kDstIn);
99 canvas->DrawImageInt( 98 canvas->DrawImageInt(gfx::ImageSkia(masking_canvas->ExtractImageRep()), 0,
100 gfx::ImageSkia(masking_canvas->ExtractImageRep()), 0, 0, masking_paint); 99 0, masking_flags);
101 } 100 }
102 101
103 gfx::ImageSkia icon_; 102 gfx::ImageSkia icon_;
104 103
105 DISALLOW_COPY_AND_ASSIGN(RoundedCornersImageSource); 104 DISALLOW_COPY_AND_ASSIGN(RoundedCornersImageSource);
106 }; 105 };
107 106
108 } // namespace 107 } // namespace
109 108
110 ExtensionAppItem::ExtensionAppItem( 109 ExtensionAppItem::ExtensionAppItem(
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 // static 306 // static
308 const char ExtensionAppItem::kItemType[] = "ExtensionAppItem"; 307 const char ExtensionAppItem::kItemType[] = "ExtensionAppItem";
309 308
310 const char* ExtensionAppItem::GetItemType() const { 309 const char* ExtensionAppItem::GetItemType() const {
311 return ExtensionAppItem::kItemType; 310 return ExtensionAppItem::kItemType;
312 } 311 }
313 312
314 void ExtensionAppItem::ExecuteLaunchCommand(int event_flags) { 313 void ExtensionAppItem::ExecuteLaunchCommand(int event_flags) {
315 Launch(event_flags); 314 Launch(event_flags);
316 } 315 }
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/ui/kiosk_external_update_notification.cc ('k') | chrome/browser/ui/libgtkui/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698