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 27 matching lines...) Expand all Loading... |
38 #include "sky/engine/platform/text/BidiResolver.h" | 38 #include "sky/engine/platform/text/BidiResolver.h" |
39 #include "sky/engine/platform/text/TextRunIterator.h" | 39 #include "sky/engine/platform/text/TextRunIterator.h" |
40 #include "sky/engine/platform/weborigin/KURL.h" | 40 #include "sky/engine/platform/weborigin/KURL.h" |
41 #include "sky/engine/wtf/Assertions.h" | 41 #include "sky/engine/wtf/Assertions.h" |
42 #include "sky/engine/wtf/MathExtras.h" | 42 #include "sky/engine/wtf/MathExtras.h" |
43 #include "third_party/skia/include/core/SkAnnotation.h" | 43 #include "third_party/skia/include/core/SkAnnotation.h" |
44 #include "third_party/skia/include/core/SkClipStack.h" | 44 #include "third_party/skia/include/core/SkClipStack.h" |
45 #include "third_party/skia/include/core/SkColorFilter.h" | 45 #include "third_party/skia/include/core/SkColorFilter.h" |
46 #include "third_party/skia/include/core/SkData.h" | 46 #include "third_party/skia/include/core/SkData.h" |
47 #include "third_party/skia/include/core/SkDevice.h" | 47 #include "third_party/skia/include/core/SkDevice.h" |
48 #include "third_party/skia/include/core/SkMatrixImageFilter.h" | |
49 #include "third_party/skia/include/core/SkPicture.h" | 48 #include "third_party/skia/include/core/SkPicture.h" |
50 #include "third_party/skia/include/core/SkRRect.h" | 49 #include "third_party/skia/include/core/SkRRect.h" |
51 #include "third_party/skia/include/core/SkRefCnt.h" | 50 #include "third_party/skia/include/core/SkRefCnt.h" |
52 #include "third_party/skia/include/core/SkSurface.h" | 51 #include "third_party/skia/include/core/SkSurface.h" |
53 #include "third_party/skia/include/effects/SkBlurMaskFilter.h" | 52 #include "third_party/skia/include/effects/SkBlurMaskFilter.h" |
54 #include "third_party/skia/include/effects/SkCornerPathEffect.h" | 53 #include "third_party/skia/include/effects/SkCornerPathEffect.h" |
55 #include "third_party/skia/include/effects/SkLumaColorFilter.h" | 54 #include "third_party/skia/include/effects/SkLumaColorFilter.h" |
56 #include "third_party/skia/include/effects/SkPictureImageFilter.h" | 55 #include "third_party/skia/include/effects/SkPictureImageFilter.h" |
57 #include "third_party/skia/include/gpu/GrRenderTarget.h" | 56 #include "third_party/skia/include/gpu/GrRenderTarget.h" |
58 #include "third_party/skia/include/gpu/GrTexture.h" | 57 #include "third_party/skia/include/gpu/GrTexture.h" |
(...skipping 847 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
906 return; | 905 return; |
907 | 906 |
908 SkMatrix ctm = m_canvas->getTotalMatrix(); | 907 SkMatrix ctm = m_canvas->getTotalMatrix(); |
909 SkRect deviceDest; | 908 SkRect deviceDest; |
910 ctm.mapRect(&deviceDest, dest); | 909 ctm.mapRect(&deviceDest, dest); |
911 SkRect sourceBounds = WebCoreFloatRectToSKRect(src); | 910 SkRect sourceBounds = WebCoreFloatRectToSKRect(src); |
912 | 911 |
913 RefPtr<SkPictureImageFilter> pictureFilter = adoptRef(SkPictureImageFilter::
Create(picture.get(), sourceBounds)); | 912 RefPtr<SkPictureImageFilter> pictureFilter = adoptRef(SkPictureImageFilter::
Create(picture.get(), sourceBounds)); |
914 SkMatrix layerScale; | 913 SkMatrix layerScale; |
915 layerScale.setScale(deviceDest.width() / src.width(), deviceDest.height() /
src.height()); | 914 layerScale.setScale(deviceDest.width() / src.width(), deviceDest.height() /
src.height()); |
916 RefPtr<SkMatrixImageFilter> matrixFilter = adoptRef(SkMatrixImageFilter::Cre
ate(layerScale, kLow_SkFilterQuality, pictureFilter.get())); | 915 RefPtr<SkImageFilter> matrixFilter = adoptRef(SkImageFilter::CreateMatrixFil
ter(layerScale, kLow_SkFilterQuality, pictureFilter.get())); |
917 SkPaint picturePaint; | 916 SkPaint picturePaint; |
918 picturePaint.setXfermodeMode(WebCoreCompositeToSkiaComposite(op, blendMode))
; | 917 picturePaint.setXfermodeMode(WebCoreCompositeToSkiaComposite(op, blendMode))
; |
919 picturePaint.setImageFilter(matrixFilter.get()); | 918 picturePaint.setImageFilter(matrixFilter.get()); |
920 SkRect layerBounds = SkRect::MakeWH(std::max(deviceDest.width(), sourceBound
s.width()), std::max(deviceDest.height(), sourceBounds.height())); | 919 SkRect layerBounds = SkRect::MakeWH(std::max(deviceDest.width(), sourceBound
s.width()), std::max(deviceDest.height(), sourceBounds.height())); |
921 m_canvas->save(); | 920 m_canvas->save(); |
922 m_canvas->resetMatrix(); | 921 m_canvas->resetMatrix(); |
923 m_canvas->translate(deviceDest.x(), deviceDest.y()); | 922 m_canvas->translate(deviceDest.x(), deviceDest.y()); |
924 m_canvas->saveLayer(&layerBounds, &picturePaint); | 923 m_canvas->saveLayer(&layerBounds, &picturePaint); |
925 m_canvas->restore(); | 924 m_canvas->restore(); |
926 m_canvas->restore(); | 925 m_canvas->restore(); |
(...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1721 // FIXME: This is to not break tests (it results in the filter bitmap fl
ag | 1720 // FIXME: This is to not break tests (it results in the filter bitmap fl
ag |
1722 // being set to true). We need to decide if we respect InterpolationNone | 1721 // being set to true). We need to decide if we respect InterpolationNone |
1723 // being returned from computeInterpolationQuality. | 1722 // being returned from computeInterpolationQuality. |
1724 resampling = InterpolationLow; | 1723 resampling = InterpolationLow; |
1725 } | 1724 } |
1726 resampling = limitInterpolationQuality(this, resampling); | 1725 resampling = limitInterpolationQuality(this, resampling); |
1727 paint->setFilterQuality(static_cast<SkFilterQuality>(resampling)); | 1726 paint->setFilterQuality(static_cast<SkFilterQuality>(resampling)); |
1728 } | 1727 } |
1729 | 1728 |
1730 } // namespace blink | 1729 } // namespace blink |
OLD | NEW |