OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2003, 2004, 2005, 2006, 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2003, 2004, 2005, 2006, 2009 Apple Inc. All rights reserved. |
3 * Copyright (C) 2013 Google Inc. All rights reserved. | 3 * Copyright (C) 2013 Google Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 962 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
973 return; | 973 return; |
974 | 974 |
975 SkMatrix ctm = m_canvas->getTotalMatrix(); | 975 SkMatrix ctm = m_canvas->getTotalMatrix(); |
976 SkRect deviceDest; | 976 SkRect deviceDest; |
977 ctm.mapRect(&deviceDest, dest); | 977 ctm.mapRect(&deviceDest, dest); |
978 SkRect sourceBounds = WebCoreFloatRectToSKRect(src); | 978 SkRect sourceBounds = WebCoreFloatRectToSKRect(src); |
979 | 979 |
980 RefPtr<SkPictureImageFilter> pictureFilter = adoptRef(SkPictureImageFilter::
Create(picture.get(), sourceBounds)); | 980 RefPtr<SkPictureImageFilter> pictureFilter = adoptRef(SkPictureImageFilter::
Create(picture.get(), sourceBounds)); |
981 SkMatrix layerScale; | 981 SkMatrix layerScale; |
982 layerScale.setScale(deviceDest.width() / src.width(), deviceDest.height() /
src.height()); | 982 layerScale.setScale(deviceDest.width() / src.width(), deviceDest.height() /
src.height()); |
983 RefPtr<SkMatrixImageFilter> matrixFilter = adoptRef(SkMatrixImageFilter::Cre
ate(layerScale, SkPaint::kLow_FilterLevel, pictureFilter.get())); | 983 RefPtr<SkMatrixImageFilter> matrixFilter = adoptRef(SkMatrixImageFilter::Cre
ate(layerScale, kLow_SkFilterQuality, pictureFilter.get())); |
984 SkPaint picturePaint; | 984 SkPaint picturePaint; |
985 picturePaint.setXfermodeMode(WebCoreCompositeToSkiaComposite(op, blendMode))
; | 985 picturePaint.setXfermodeMode(WebCoreCompositeToSkiaComposite(op, blendMode))
; |
986 picturePaint.setImageFilter(matrixFilter.get()); | 986 picturePaint.setImageFilter(matrixFilter.get()); |
987 SkRect layerBounds = SkRect::MakeWH(std::max(deviceDest.width(), sourceBound
s.width()), std::max(deviceDest.height(), sourceBounds.height())); | 987 SkRect layerBounds = SkRect::MakeWH(std::max(deviceDest.width(), sourceBound
s.width()), std::max(deviceDest.height(), sourceBounds.height())); |
988 m_canvas->save(); | 988 m_canvas->save(); |
989 m_canvas->resetMatrix(); | 989 m_canvas->resetMatrix(); |
990 m_canvas->translate(deviceDest.x(), deviceDest.y()); | 990 m_canvas->translate(deviceDest.x(), deviceDest.y()); |
991 m_canvas->saveLayer(&layerBounds, &picturePaint); | 991 m_canvas->saveLayer(&layerBounds, &picturePaint); |
992 m_canvas->restore(); | 992 m_canvas->restore(); |
993 m_canvas->restore(); | 993 m_canvas->restore(); |
(...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1784 isDataComplete); | 1784 isDataComplete); |
1785 } | 1785 } |
1786 | 1786 |
1787 if (resampling == InterpolationNone) { | 1787 if (resampling == InterpolationNone) { |
1788 // FIXME: This is to not break tests (it results in the filter bitmap fl
ag | 1788 // FIXME: This is to not break tests (it results in the filter bitmap fl
ag |
1789 // being set to true). We need to decide if we respect InterpolationNone | 1789 // being set to true). We need to decide if we respect InterpolationNone |
1790 // being returned from computeInterpolationQuality. | 1790 // being returned from computeInterpolationQuality. |
1791 resampling = InterpolationLow; | 1791 resampling = InterpolationLow; |
1792 } | 1792 } |
1793 resampling = limitInterpolationQuality(this, resampling); | 1793 resampling = limitInterpolationQuality(this, resampling); |
1794 paint->setFilterLevel(static_cast<SkPaint::FilterLevel>(resampling)); | 1794 paint->setFilterQuality(static_cast<SkFilterQuality>(resampling)); |
1795 } | 1795 } |
1796 | 1796 |
1797 } // namespace blink | 1797 } // namespace blink |
OLD | NEW |