| 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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 imageSize.setWidth(kMaxDragLabelWidth); | 156 imageSize.setWidth(kMaxDragLabelWidth); |
| 157 clipURLString = true; | 157 clipURLString = true; |
| 158 } else | 158 } else |
| 159 imageSize.setWidth(std::max(labelSize.width(), urlStringSize.width()
) + kDragLabelBorderX * 2); | 159 imageSize.setWidth(std::max(labelSize.width(), urlStringSize.width()
) + kDragLabelBorderX * 2); |
| 160 } | 160 } |
| 161 | 161 |
| 162 // We now know how big the image needs to be, so we create and | 162 // We now know how big the image needs to be, so we create and |
| 163 // fill the background | 163 // fill the background |
| 164 IntSize scaledImageSize = imageSize; | 164 IntSize scaledImageSize = imageSize; |
| 165 scaledImageSize.scale(deviceScaleFactor); | 165 scaledImageSize.scale(deviceScaleFactor); |
| 166 OwnPtr<ImageBuffer> buffer(ImageBuffer::create(scaledImageSize, deviceScaleF
actor)); | 166 OwnPtr<ImageBuffer> buffer(ImageBuffer::create(scaledImageSize)); |
| 167 if (!buffer) | 167 if (!buffer) |
| 168 return nullptr; | 168 return nullptr; |
| 169 buffer->context()->scale(FloatSize(deviceScaleFactor, deviceScaleFactor)); |
| 169 | 170 |
| 170 const float DragLabelRadius = 5; | 171 const float DragLabelRadius = 5; |
| 171 const IntSize radii(DragLabelRadius, DragLabelRadius); | 172 const IntSize radii(DragLabelRadius, DragLabelRadius); |
| 172 IntRect rect(IntPoint(), imageSize); | 173 IntRect rect(IntPoint(), imageSize); |
| 173 const Color backgroundColor(140, 140, 140); | 174 const Color backgroundColor(140, 140, 140); |
| 174 buffer->context()->fillRoundedRect(rect, radii, radii, radii, radii, backgro
undColor); | 175 buffer->context()->fillRoundedRect(rect, radii, radii, radii, radii, backgro
undColor); |
| 175 | 176 |
| 176 // Draw the text | 177 // Draw the text |
| 177 if (drawURLString) { | 178 if (drawURLString) { |
| 178 if (clipURLString) | 179 if (clipURLString) |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 *pixel = SkPreMultiplyARGB( | 258 *pixel = SkPreMultiplyARGB( |
| 258 SkColorGetA(*pixel) * fraction, | 259 SkColorGetA(*pixel) * fraction, |
| 259 SkColorGetR(*pixel), | 260 SkColorGetR(*pixel), |
| 260 SkColorGetG(*pixel), | 261 SkColorGetG(*pixel), |
| 261 SkColorGetB(*pixel)); | 262 SkColorGetB(*pixel)); |
| 262 } | 263 } |
| 263 } | 264 } |
| 264 } | 265 } |
| 265 | 266 |
| 266 } // namespace WebCore | 267 } // namespace WebCore |
| OLD | NEW |