| 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 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 scaledImageSize.scale(deviceScaleFactor); | 248 scaledImageSize.scale(deviceScaleFactor); |
| 249 std::unique_ptr<ImageBuffer> buffer(ImageBuffer::create(scaledImageSize)); | 249 std::unique_ptr<ImageBuffer> buffer(ImageBuffer::create(scaledImageSize)); |
| 250 if (!buffer) | 250 if (!buffer) |
| 251 return nullptr; | 251 return nullptr; |
| 252 | 252 |
| 253 buffer->canvas()->scale(deviceScaleFactor, deviceScaleFactor); | 253 buffer->canvas()->scale(deviceScaleFactor, deviceScaleFactor); |
| 254 | 254 |
| 255 const float DragLabelRadius = 5; | 255 const float DragLabelRadius = 5; |
| 256 | 256 |
| 257 IntRect rect(IntPoint(), imageSize); | 257 IntRect rect(IntPoint(), imageSize); |
| 258 SkPaint backgroundPaint; | 258 CdlPaint backgroundPaint; |
| 259 backgroundPaint.setColor(SkColorSetRGB(140, 140, 140)); | 259 backgroundPaint.setColor(SkColorSetRGB(140, 140, 140)); |
| 260 backgroundPaint.setAntiAlias(true); | 260 backgroundPaint.setAntiAlias(true); |
| 261 SkRRect rrect; | 261 SkRRect rrect; |
| 262 rrect.setRectXY(SkRect::MakeWH(imageSize.width(), imageSize.height()), | 262 rrect.setRectXY(SkRect::MakeWH(imageSize.width(), imageSize.height()), |
| 263 DragLabelRadius, DragLabelRadius); | 263 DragLabelRadius, DragLabelRadius); |
| 264 buffer->canvas()->drawRRect(rrect, backgroundPaint); | 264 buffer->canvas()->drawRRect(rrect, backgroundPaint); |
| 265 | 265 |
| 266 // Draw the text | 266 // Draw the text |
| 267 SkPaint textPaint; | 267 CdlPaint textPaint; |
| 268 if (drawURLString) { | 268 if (drawURLString) { |
| 269 if (clipURLString) | 269 if (clipURLString) |
| 270 urlString = StringTruncator::centerTruncate( | 270 urlString = StringTruncator::centerTruncate( |
| 271 urlString, imageSize.width() - (kDragLabelBorderX * 2.0f), urlFont); | 271 urlString, imageSize.width() - (kDragLabelBorderX * 2.0f), urlFont); |
| 272 IntPoint textPos( | 272 IntPoint textPos( |
| 273 kDragLabelBorderX, | 273 kDragLabelBorderX, |
| 274 imageSize.height() - | 274 imageSize.height() - |
| 275 (kLabelBorderYOffset + urlFontData->getFontMetrics().descent())); | 275 (kLabelBorderYOffset + urlFontData->getFontMetrics().descent())); |
| 276 TextRun textRun(urlString); | 276 TextRun textRun(urlString); |
| 277 urlFont.drawText(buffer->canvas(), TextRunPaintInfo(textRun), textPos, | 277 urlFont.drawText(buffer->canvas(), TextRunPaintInfo(textRun), textPos, |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 m_interpolationQuality == InterpolationNone | 315 m_interpolationQuality == InterpolationNone |
| 316 ? skia::ImageOperations::RESIZE_BOX | 316 ? skia::ImageOperations::RESIZE_BOX |
| 317 : skia::ImageOperations::RESIZE_LANCZOS3; | 317 : skia::ImageOperations::RESIZE_LANCZOS3; |
| 318 int imageWidth = scaleX * m_bitmap.width(); | 318 int imageWidth = scaleX * m_bitmap.width(); |
| 319 int imageHeight = scaleY * m_bitmap.height(); | 319 int imageHeight = scaleY * m_bitmap.height(); |
| 320 m_bitmap = skia::ImageOperations::Resize(m_bitmap, resizeMethod, imageWidth, | 320 m_bitmap = skia::ImageOperations::Resize(m_bitmap, resizeMethod, imageWidth, |
| 321 imageHeight); | 321 imageHeight); |
| 322 } | 322 } |
| 323 | 323 |
| 324 } // namespace blink | 324 } // namespace blink |
| OLD | NEW |