Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2013 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 "skia/ext/opacity_draw_filter.h" | |
| 6 #include "third_party/skia/include/core/SkPaint.h" | |
| 7 | |
| 8 namespace skia { | |
| 9 | |
| 10 OpacityDrawFilter::OpacityDrawFilter(float opacity, bool disable_image_filtering ) | |
| 11 : opacity_(opacity), disable_image_filtering_(disable_image_filtering) {} | |
| 12 | |
| 13 OpacityDrawFilter::~OpacityDrawFilter() {} | |
| 14 | |
| 15 bool OpacityDrawFilter::filter(SkPaint* paint, Type type) { | |
| 16 if (opacity_ != 1.f) | |
| 17 paint->setAlpha(SkScalarRound(opacity_ * 255)); | |
|
tomhudson
2013/08/28 14:55:18
(Maybe arguing against my comment in the header)
aelias_OOO_until_Jul13
2013/08/28 18:50:35
There's an argument for multiplying, but for now I
| |
| 18 if (disable_image_filtering_) | |
| 19 paint->setFilterLevel(SkPaint::kNone_FilterLevel); | |
| 20 return true; | |
| 21 } | |
| 22 | |
| 23 } // namespace skia | |
| 24 | |
| 25 | |
| OLD | NEW |