| 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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 | 211 |
| 212 return shape.release(); | 212 return shape.release(); |
| 213 } | 213 } |
| 214 | 214 |
| 215 PassOwnPtr<Shape> Shape::createShape(const StyleImage* styleImage, float thresho
ld, const LayoutSize&, WritingMode writingMode, Length margin, Length padding) | 215 PassOwnPtr<Shape> Shape::createShape(const StyleImage* styleImage, float thresho
ld, const LayoutSize&, WritingMode writingMode, Length margin, Length padding) |
| 216 { | 216 { |
| 217 ASSERT(styleImage && styleImage->isImageResource() && styleImage->cachedImag
e() && styleImage->cachedImage()->image()); | 217 ASSERT(styleImage && styleImage->isImageResource() && styleImage->cachedImag
e() && styleImage->cachedImage()->image()); |
| 218 | 218 |
| 219 Image* image = styleImage->cachedImage()->image(); | 219 Image* image = styleImage->cachedImage()->image(); |
| 220 const IntSize& imageSize = image->size(); | 220 const IntSize& imageSize = image->size(); |
| 221 OwnPtr<RasterShapeIntervals> intervals = adoptPtr(new RasterShapeIntervals(i
mageSize.height())); |
| 221 OwnPtr<ImageBuffer> imageBuffer = ImageBuffer::create(imageSize); | 222 OwnPtr<ImageBuffer> imageBuffer = ImageBuffer::create(imageSize); |
| 222 | |
| 223 OwnPtr<RasterShapeIntervals> intervals = adoptPtr(new RasterShapeIntervals(i
mageSize.height())); | |
| 224 | |
| 225 if (imageBuffer) { | 223 if (imageBuffer) { |
| 226 GraphicsContext* graphicsContext = imageBuffer->context(); | 224 GraphicsContext* graphicsContext = imageBuffer->context(); |
| 227 graphicsContext->drawImage(image, IntPoint()); | 225 graphicsContext->drawImage(image, IntPoint()); |
| 228 | 226 |
| 229 RefPtr<Uint8ClampedArray> pixelArray = imageBuffer->getUnmultipliedImage
Data(IntRect(IntPoint(), imageSize)); | 227 RefPtr<Uint8ClampedArray> pixelArray = imageBuffer->getUnmultipliedImage
Data(IntRect(IntPoint(), imageSize)); |
| 230 unsigned pixelArrayLength = pixelArray->length(); | 228 unsigned pixelArrayLength = pixelArray->length(); |
| 231 unsigned pixelArrayOffset = 3; // Each pixel is four bytes: RGBA. | 229 unsigned pixelArrayOffset = 3; // Each pixel is four bytes: RGBA. |
| 232 uint8_t alphaPixelThreshold = threshold * 255; | 230 uint8_t alphaPixelThreshold = threshold * 255; |
| 233 | 231 |
| 234 ASSERT(static_cast<unsigned>(imageSize.width() * imageSize.height() * 4)
== pixelArrayLength); | 232 ASSERT(static_cast<unsigned>(imageSize.width() * imageSize.height() * 4)
== pixelArrayLength); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 264 | 262 |
| 265 OwnPtr<Shape> shape = createBoxShape(bounds, shapeMargin, shapePadding); | 263 OwnPtr<Shape> shape = createBoxShape(bounds, shapeMargin, shapePadding); |
| 266 shape->m_writingMode = writingMode; | 264 shape->m_writingMode = writingMode; |
| 267 shape->m_margin = shapeMargin; | 265 shape->m_margin = shapeMargin; |
| 268 shape->m_padding = shapePadding; | 266 shape->m_padding = shapePadding; |
| 269 | 267 |
| 270 return shape.release(); | 268 return shape.release(); |
| 271 } | 269 } |
| 272 | 270 |
| 273 } // namespace WebCore | 271 } // namespace WebCore |
| OLD | NEW |