| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_filter_canvas.h" | 5 #include "skia/ext/opacity_filter_canvas.h" |
| 6 #include "third_party/skia/include/core/SkPaint.h" | 6 #include "third_party/skia/include/core/SkPaint.h" |
| 7 #include "third_party/skia/include/core/SkTLazy.h" | |
| 8 | 7 |
| 9 namespace skia { | 8 namespace skia { |
| 10 | 9 |
| 11 OpacityFilterCanvas::OpacityFilterCanvas(SkCanvas* canvas, | 10 OpacityFilterCanvas::OpacityFilterCanvas(SkCanvas* canvas, |
| 12 float opacity, | 11 float opacity, |
| 13 bool disable_image_filtering) | 12 bool disable_image_filtering) |
| 14 : INHERITED(canvas), | 13 : INHERITED(canvas), |
| 15 alpha_(SkScalarRoundToInt(opacity * 255)), | 14 alpha_(SkScalarRoundToInt(opacity * 255)), |
| 16 disable_image_filtering_(disable_image_filtering) { } | 15 disable_image_filtering_(disable_image_filtering) { } |
| 17 | 16 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 33 const SkMatrix* matrix, | 32 const SkMatrix* matrix, |
| 34 const SkPaint* paint) { | 33 const SkPaint* paint) { |
| 35 SkTCopyOnFirstWrite<SkPaint> filteredPaint(paint); | 34 SkTCopyOnFirstWrite<SkPaint> filteredPaint(paint); |
| 36 if (this->onFilter(&filteredPaint, kPicture_Type)) { | 35 if (this->onFilter(&filteredPaint, kPicture_Type)) { |
| 37 // Unfurl pictures in order to filter nested paints. | 36 // Unfurl pictures in order to filter nested paints. |
| 38 this->SkCanvas::onDrawPicture(picture, matrix, filteredPaint); | 37 this->SkCanvas::onDrawPicture(picture, matrix, filteredPaint); |
| 39 } | 38 } |
| 40 } | 39 } |
| 41 | 40 |
| 42 } // namespace skia | 41 } // namespace skia |
| OLD | NEW |