OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. | 2 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above | 8 * 1. Redistributions of source code must retain the above |
9 * copyright notice, this list of conditions and the following | 9 * copyright notice, this list of conditions and the following |
10 * disclaimer. | 10 * disclaimer. |
(...skipping 25 matching lines...) Expand all Loading... |
36 #include "core/layout/shapes/PolygonShape.h" | 36 #include "core/layout/shapes/PolygonShape.h" |
37 #include "core/layout/shapes/RasterShape.h" | 37 #include "core/layout/shapes/RasterShape.h" |
38 #include "core/layout/shapes/RectangleShape.h" | 38 #include "core/layout/shapes/RectangleShape.h" |
39 #include "core/style/ComputedStyle.h" | 39 #include "core/style/ComputedStyle.h" |
40 #include "core/svg/graphics/SVGImage.h" | 40 #include "core/svg/graphics/SVGImage.h" |
41 #include "platform/LengthFunctions.h" | 41 #include "platform/LengthFunctions.h" |
42 #include "platform/geometry/FloatRoundedRect.h" | 42 #include "platform/geometry/FloatRoundedRect.h" |
43 #include "platform/geometry/FloatSize.h" | 43 #include "platform/geometry/FloatSize.h" |
44 #include "platform/graphics/GraphicsTypes.h" | 44 #include "platform/graphics/GraphicsTypes.h" |
45 #include "platform/graphics/ImageBuffer.h" | 45 #include "platform/graphics/ImageBuffer.h" |
| 46 #include "platform/graphics/paint/PaintFlags.h" |
46 #include "wtf/MathExtras.h" | 47 #include "wtf/MathExtras.h" |
47 #include "wtf/PtrUtil.h" | 48 #include "wtf/PtrUtil.h" |
48 #include "wtf/typed_arrays/ArrayBufferContents.h" | 49 #include "wtf/typed_arrays/ArrayBufferContents.h" |
49 #include <memory> | 50 #include <memory> |
50 | 51 |
51 namespace blink { | 52 namespace blink { |
52 | 53 |
53 static std::unique_ptr<Shape> createInsetShape(const FloatRoundedRect& bounds) { | 54 static std::unique_ptr<Shape> createInsetShape(const FloatRoundedRect& bounds) { |
54 ASSERT(bounds.rect().width() >= 0 && bounds.rect().height() >= 0); | 55 ASSERT(bounds.rect().width() >= 0 && bounds.rect().height() >= 0); |
55 return WTF::makeUnique<BoxShape>(bounds); | 56 return WTF::makeUnique<BoxShape>(bounds); |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 std::unique_ptr<RasterShapeIntervals> intervals = WTF::wrapUnique( | 233 std::unique_ptr<RasterShapeIntervals> intervals = WTF::wrapUnique( |
233 new RasterShapeIntervals(marginRect.height(), -marginRect.y())); | 234 new RasterShapeIntervals(marginRect.height(), -marginRect.y())); |
234 std::unique_ptr<ImageBuffer> imageBuffer = | 235 std::unique_ptr<ImageBuffer> imageBuffer = |
235 ImageBuffer::create(imageRect.size()); | 236 ImageBuffer::create(imageRect.size()); |
236 | 237 |
237 if (image && imageBuffer) { | 238 if (image && imageBuffer) { |
238 // FIXME: This is not totally correct but it is needed to prevent shapes | 239 // FIXME: This is not totally correct but it is needed to prevent shapes |
239 // that loads SVG Images during paint invalidations to mark layoutObjects | 240 // that loads SVG Images during paint invalidations to mark layoutObjects |
240 // for layout, which is not allowed. See https://crbug.com/429346 | 241 // for layout, which is not allowed. See https://crbug.com/429346 |
241 ImageObserverDisabler disabler(image); | 242 ImageObserverDisabler disabler(image); |
242 SkPaint paint; | 243 PaintFlags paint; |
243 IntRect imageSourceRect(IntPoint(), image->size()); | 244 IntRect imageSourceRect(IntPoint(), image->size()); |
244 IntRect imageDestRect(IntPoint(), imageRect.size()); | 245 IntRect imageDestRect(IntPoint(), imageRect.size()); |
245 // TODO(ccameron): No color conversion is required here. | 246 // TODO(ccameron): No color conversion is required here. |
246 image->draw(imageBuffer->canvas(), paint, imageDestRect, imageSourceRect, | 247 image->draw(imageBuffer->canvas(), paint, imageDestRect, imageSourceRect, |
247 DoNotRespectImageOrientation, | 248 DoNotRespectImageOrientation, |
248 Image::DoNotClampImageToSourceRect, | 249 Image::DoNotClampImageToSourceRect, |
249 ColorBehavior::transformToGlobalTarget()); | 250 ColorBehavior::transformToGlobalTarget()); |
250 | 251 |
251 WTF::ArrayBufferContents contents; | 252 WTF::ArrayBufferContents contents; |
252 imageBuffer->getImageData(Unmultiplied, | 253 imageBuffer->getImageData(Unmultiplied, |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 FloatRect rect(0, 0, roundedRect.rect().width(), roundedRect.rect().height()); | 298 FloatRect rect(0, 0, roundedRect.rect().width(), roundedRect.rect().height()); |
298 FloatRoundedRect bounds(rect, roundedRect.getRadii()); | 299 FloatRoundedRect bounds(rect, roundedRect.getRadii()); |
299 std::unique_ptr<Shape> shape = createInsetShape(bounds); | 300 std::unique_ptr<Shape> shape = createInsetShape(bounds); |
300 shape->m_writingMode = writingMode; | 301 shape->m_writingMode = writingMode; |
301 shape->m_margin = margin; | 302 shape->m_margin = margin; |
302 | 303 |
303 return shape; | 304 return shape; |
304 } | 305 } |
305 | 306 |
306 } // namespace blink | 307 } // namespace blink |
OLD | NEW |