| 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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 const Vector<Length>& values = polygon->values(); | 135 const Vector<Length>& values = polygon->values(); |
| 136 size_t valuesSize = values.size(); | 136 size_t valuesSize = values.size(); |
| 137 ASSERT(!(valuesSize % 2)); | 137 ASSERT(!(valuesSize % 2)); |
| 138 OwnPtr<Vector<FloatPoint>> vertices = adoptPtr(new Vector<FloatPoint>(va
luesSize / 2)); | 138 OwnPtr<Vector<FloatPoint>> vertices = adoptPtr(new Vector<FloatPoint>(va
luesSize / 2)); |
| 139 for (unsigned i = 0; i < valuesSize; i += 2) { | 139 for (unsigned i = 0; i < valuesSize; i += 2) { |
| 140 FloatPoint vertex( | 140 FloatPoint vertex( |
| 141 floatValueForLength(values.at(i), boxWidth), | 141 floatValueForLength(values.at(i), boxWidth), |
| 142 floatValueForLength(values.at(i + 1), boxHeight)); | 142 floatValueForLength(values.at(i + 1), boxHeight)); |
| 143 (*vertices)[i / 2] = physicalPointToLogical(vertex, logicalBoxSize.h
eight().toFloat(), writingMode); | 143 (*vertices)[i / 2] = physicalPointToLogical(vertex, logicalBoxSize.h
eight().toFloat(), writingMode); |
| 144 } | 144 } |
| 145 shape = createPolygonShape(vertices.release(), polygon->getWindRule()); | 145 shape = createPolygonShape(std::move(vertices), polygon->getWindRule()); |
| 146 break; | 146 break; |
| 147 } | 147 } |
| 148 | 148 |
| 149 case BasicShape::BasicShapeInsetType: { | 149 case BasicShape::BasicShapeInsetType: { |
| 150 const BasicShapeInset& inset = *toBasicShapeInset(basicShape); | 150 const BasicShapeInset& inset = *toBasicShapeInset(basicShape); |
| 151 float left = floatValueForLength(inset.left(), boxWidth); | 151 float left = floatValueForLength(inset.left(), boxWidth); |
| 152 float top = floatValueForLength(inset.top(), boxHeight); | 152 float top = floatValueForLength(inset.top(), boxHeight); |
| 153 float right = floatValueForLength(inset.right(), boxWidth); | 153 float right = floatValueForLength(inset.right(), boxWidth); |
| 154 float bottom = floatValueForLength(inset.bottom(), boxHeight); | 154 float bottom = floatValueForLength(inset.bottom(), boxHeight); |
| 155 FloatRect rect(left, top, std::max<float>(boxWidth - left - right, 0), s
td::max<float>(boxHeight - top - bottom, 0)); | 155 FloatRect rect(left, top, std::max<float>(boxWidth - left - right, 0), s
td::max<float>(boxHeight - top - bottom, 0)); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 169 break; | 169 break; |
| 170 } | 170 } |
| 171 | 171 |
| 172 default: | 172 default: |
| 173 ASSERT_NOT_REACHED(); | 173 ASSERT_NOT_REACHED(); |
| 174 } | 174 } |
| 175 | 175 |
| 176 shape->m_writingMode = writingMode; | 176 shape->m_writingMode = writingMode; |
| 177 shape->m_margin = margin; | 177 shape->m_margin = margin; |
| 178 | 178 |
| 179 return shape.release(); | 179 return shape; |
| 180 } | 180 } |
| 181 | 181 |
| 182 PassOwnPtr<Shape> Shape::createEmptyRasterShape(WritingMode writingMode, float m
argin) | 182 PassOwnPtr<Shape> Shape::createEmptyRasterShape(WritingMode writingMode, float m
argin) |
| 183 { | 183 { |
| 184 OwnPtr<RasterShapeIntervals> intervals = adoptPtr(new RasterShapeIntervals(0
, 0)); | 184 OwnPtr<RasterShapeIntervals> intervals = adoptPtr(new RasterShapeIntervals(0
, 0)); |
| 185 OwnPtr<RasterShape> rasterShape = adoptPtr(new RasterShape(intervals.release
(), IntSize())); | 185 OwnPtr<RasterShape> rasterShape = adoptPtr(new RasterShape(std::move(interva
ls), IntSize())); |
| 186 rasterShape->m_writingMode = writingMode; | 186 rasterShape->m_writingMode = writingMode; |
| 187 rasterShape->m_margin = margin; | 187 rasterShape->m_margin = margin; |
| 188 return rasterShape.release(); | 188 return std::move(rasterShape); |
| 189 } | 189 } |
| 190 | 190 |
| 191 PassOwnPtr<Shape> Shape::createRasterShape(Image* image, float threshold, const
LayoutRect& imageR, const LayoutRect& marginR, WritingMode writingMode, float ma
rgin) | 191 PassOwnPtr<Shape> Shape::createRasterShape(Image* image, float threshold, const
LayoutRect& imageR, const LayoutRect& marginR, WritingMode writingMode, float ma
rgin) |
| 192 { | 192 { |
| 193 IntRect imageRect = pixelSnappedIntRect(imageR); | 193 IntRect imageRect = pixelSnappedIntRect(imageR); |
| 194 IntRect marginRect = pixelSnappedIntRect(marginR); | 194 IntRect marginRect = pixelSnappedIntRect(marginR); |
| 195 | 195 |
| 196 OwnPtr<RasterShapeIntervals> intervals = adoptPtr(new RasterShapeIntervals(m
arginRect.height(), -marginRect.y())); | 196 OwnPtr<RasterShapeIntervals> intervals = adoptPtr(new RasterShapeIntervals(m
arginRect.height(), -marginRect.y())); |
| 197 OwnPtr<ImageBuffer> imageBuffer = ImageBuffer::create(imageRect.size()); | 197 OwnPtr<ImageBuffer> imageBuffer = ImageBuffer::create(imageRect.size()); |
| 198 | 198 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 227 startX = x; | 227 startX = x; |
| 228 } else if (startX != -1 && (!alphaAboveThreshold || x == imageRe
ct.width() - 1)) { | 228 } else if (startX != -1 && (!alphaAboveThreshold || x == imageRe
ct.width() - 1)) { |
| 229 int endX = alphaAboveThreshold ? x + 1 : x; | 229 int endX = alphaAboveThreshold ? x + 1 : x; |
| 230 intervals->intervalAt(y + imageRect.y()).unite(IntShapeInter
val(startX + imageRect.x(), endX + imageRect.x())); | 230 intervals->intervalAt(y + imageRect.y()).unite(IntShapeInter
val(startX + imageRect.x(), endX + imageRect.x())); |
| 231 startX = -1; | 231 startX = -1; |
| 232 } | 232 } |
| 233 } | 233 } |
| 234 } | 234 } |
| 235 } | 235 } |
| 236 | 236 |
| 237 OwnPtr<RasterShape> rasterShape = adoptPtr(new RasterShape(intervals.release
(), marginRect.size())); | 237 OwnPtr<RasterShape> rasterShape = adoptPtr(new RasterShape(std::move(interva
ls), marginRect.size())); |
| 238 rasterShape->m_writingMode = writingMode; | 238 rasterShape->m_writingMode = writingMode; |
| 239 rasterShape->m_margin = margin; | 239 rasterShape->m_margin = margin; |
| 240 return rasterShape.release(); | 240 return std::move(rasterShape); |
| 241 } | 241 } |
| 242 | 242 |
| 243 PassOwnPtr<Shape> Shape::createLayoutBoxShape(const FloatRoundedRect& roundedRec
t, WritingMode writingMode, float margin) | 243 PassOwnPtr<Shape> Shape::createLayoutBoxShape(const FloatRoundedRect& roundedRec
t, WritingMode writingMode, float margin) |
| 244 { | 244 { |
| 245 FloatRect rect(0, 0, roundedRect.rect().width(), roundedRect.rect().height()
); | 245 FloatRect rect(0, 0, roundedRect.rect().width(), roundedRect.rect().height()
); |
| 246 FloatRoundedRect bounds(rect, roundedRect.getRadii()); | 246 FloatRoundedRect bounds(rect, roundedRect.getRadii()); |
| 247 OwnPtr<Shape> shape = createInsetShape(bounds); | 247 OwnPtr<Shape> shape = createInsetShape(bounds); |
| 248 shape->m_writingMode = writingMode; | 248 shape->m_writingMode = writingMode; |
| 249 shape->m_margin = margin; | 249 shape->m_margin = margin; |
| 250 | 250 |
| 251 return shape.release(); | 251 return shape; |
| 252 } | 252 } |
| 253 | 253 |
| 254 } // namespace blink | 254 } // namespace blink |
| OLD | NEW |