OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007 Apple Inc. 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 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 imageSize.setWidth(std::max(labelSize.width(), urlStringSize.width()
) + kDragLabelBorderX * 2); | 158 imageSize.setWidth(std::max(labelSize.width(), urlStringSize.width()
) + kDragLabelBorderX * 2); |
159 } | 159 } |
160 | 160 |
161 // We now know how big the image needs to be, so we create and | 161 // We now know how big the image needs to be, so we create and |
162 // fill the background | 162 // fill the background |
163 IntSize scaledImageSize = imageSize; | 163 IntSize scaledImageSize = imageSize; |
164 scaledImageSize.scale(deviceScaleFactor); | 164 scaledImageSize.scale(deviceScaleFactor); |
165 OwnPtr<ImageBuffer> buffer(ImageBuffer::create(scaledImageSize)); | 165 OwnPtr<ImageBuffer> buffer(ImageBuffer::create(scaledImageSize)); |
166 if (!buffer) | 166 if (!buffer) |
167 return nullptr; | 167 return nullptr; |
168 buffer->context()->scale(FloatSize(deviceScaleFactor, deviceScaleFactor)); | 168 buffer->context()->scale(deviceScaleFactor, deviceScaleFactor); |
169 | 169 |
170 const float DragLabelRadius = 5; | 170 const float DragLabelRadius = 5; |
171 const IntSize radii(DragLabelRadius, DragLabelRadius); | 171 const IntSize radii(DragLabelRadius, DragLabelRadius); |
172 IntRect rect(IntPoint(), imageSize); | 172 IntRect rect(IntPoint(), imageSize); |
173 const Color backgroundColor(140, 140, 140); | 173 const Color backgroundColor(140, 140, 140); |
174 buffer->context()->fillRoundedRect(rect, radii, radii, radii, radii, backgro
undColor); | 174 buffer->context()->fillRoundedRect(rect, radii, radii, radii, radii, backgro
undColor); |
175 | 175 |
176 // Draw the text | 176 // Draw the text |
177 if (drawURLString) { | 177 if (drawURLString) { |
178 if (clipURLString) | 178 if (clipURLString) |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 *pixel = SkPreMultiplyARGB( | 263 *pixel = SkPreMultiplyARGB( |
264 SkColorGetA(*pixel) * fraction, | 264 SkColorGetA(*pixel) * fraction, |
265 SkColorGetR(*pixel), | 265 SkColorGetR(*pixel), |
266 SkColorGetG(*pixel), | 266 SkColorGetG(*pixel), |
267 SkColorGetB(*pixel)); | 267 SkColorGetB(*pixel)); |
268 } | 268 } |
269 } | 269 } |
270 } | 270 } |
271 | 271 |
272 } // namespace WebCore | 272 } // namespace WebCore |
OLD | NEW |