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

Side by Side Diff: chrome/common/extensions/icon_transform.cc

Issue 10703090: Turn pageAction.show -> browserAction.sensibleThing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: views (incomplete) Created 8 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « chrome/common/extensions/icon_transform.h ('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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/common/extensions/icon_transform.h"
6
7 #include "base/logging.h"
8 #include "third_party/skia/include/core/SkBitmap.h"
9 #include "third_party/skia/include/core/SkCanvas.h"
10 #include "third_party/skia/include/core/SkDevice.h"
11 #include "third_party/skia/include/core/SkPaint.h"
12
13 namespace extensions {
14
15 IconTransform::IconTransform() : alpha_(0) {
16 }
17
18 IconTransform::~IconTransform() {
19 }
20
21 const SkBitmap& IconTransform::RenderIcon(const SkBitmap& icon) {
22 DCHECK_GT(icon.width(), 0);
23 DCHECK_GT(icon.height(), 0);
24
25 if (!device_.get() ||
26 (device_->width() != icon.width()) ||
27 (device_->height() != icon.height())) {
28 device_.reset(new SkDevice(
29 SkBitmap::kARGB_8888_Config, icon.width(), icon.height(), true));
30 }
31
32 SkCanvas canvas(device_.get());
33 canvas.clear(0);
34 SkPaint paint;
35 paint.setAlpha(alpha_);
36 canvas.drawBitmap(icon, 0, 0, &paint);
37 return device_->accessBitmap(false);
38 }
39
40 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/common/extensions/icon_transform.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698