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

Side by Side Diff: skia/ext/opacity_draw_filter.cc

Issue 1013463003: Update from https://crrev.com/320931 (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "skia/ext/opacity_draw_filter.h" 5 #include "skia/ext/opacity_draw_filter.h"
6 #include "third_party/skia/include/core/SkPaint.h" 6 #include "third_party/skia/include/core/SkPaint.h"
7 7
8 namespace skia { 8 namespace skia {
9 9
10 OpacityDrawFilter::OpacityDrawFilter(float opacity, 10 OpacityDrawFilter::OpacityDrawFilter(float opacity,
11 bool disable_image_filtering) 11 bool disable_image_filtering)
12 : alpha_(SkScalarRoundToInt(opacity * 255)), 12 : alpha_(SkScalarRoundToInt(opacity * 255)),
13 disable_image_filtering_(disable_image_filtering) {} 13 disable_image_filtering_(disable_image_filtering) {}
14 14
15 OpacityDrawFilter::~OpacityDrawFilter() {} 15 OpacityDrawFilter::~OpacityDrawFilter() {}
16 16
17 bool OpacityDrawFilter::filter(SkPaint* paint, Type type) { 17 bool OpacityDrawFilter::filter(SkPaint* paint, Type type) {
18 if (alpha_ < 255) 18 if (alpha_ < 255)
19 paint->setAlpha(alpha_); 19 paint->setAlpha(alpha_);
20 if (disable_image_filtering_) 20 if (disable_image_filtering_)
21 paint->setFilterLevel(SkPaint::kNone_FilterLevel); 21 paint->setFilterQuality(kNone_SkFilterQuality);
22 return true; 22 return true;
23 } 23 }
24 24
25 } // namespace skia 25 } // namespace skia
26 26
27 27
OLDNEW
« no previous file with comments | « skia/ext/bitmap_platform_device_win.cc ('k') | sky/engine/platform/graphics/GraphicsContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698