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 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 | 284 |
285 if (clipLabelString) | 285 if (clipLabelString) |
286 label = StringTruncator::rightTruncate( | 286 label = StringTruncator::rightTruncate( |
287 label, imageSize.width() - (kDragLabelBorderX * 2.0f), labelFont); | 287 label, imageSize.width() - (kDragLabelBorderX * 2.0f), labelFont); |
288 | 288 |
289 bool hasStrongDirectionality; | 289 bool hasStrongDirectionality; |
290 TextRun textRun = textRunWithDirectionality(label, &hasStrongDirectionality); | 290 TextRun textRun = textRunWithDirectionality(label, &hasStrongDirectionality); |
291 IntPoint textPos( | 291 IntPoint textPos( |
292 kDragLabelBorderX, | 292 kDragLabelBorderX, |
293 kDragLabelBorderY + labelFont.getFontDescription().computedPixelSize()); | 293 kDragLabelBorderY + labelFont.getFontDescription().computedPixelSize()); |
294 if (hasStrongDirectionality && textRun.direction() == TextDirection::Rtl) { | 294 if (hasStrongDirectionality && textRun.direction() == TextDirection::kRtl) { |
295 float textWidth = labelFont.width(textRun); | 295 float textWidth = labelFont.width(textRun); |
296 int availableWidth = imageSize.width() - kDragLabelBorderX * 2; | 296 int availableWidth = imageSize.width() - kDragLabelBorderX * 2; |
297 textPos.setX(availableWidth - ceilf(textWidth)); | 297 textPos.setX(availableWidth - ceilf(textWidth)); |
298 } | 298 } |
299 labelFont.drawBidiText(buffer->canvas(), TextRunPaintInfo(textRun), | 299 labelFont.drawBidiText(buffer->canvas(), TextRunPaintInfo(textRun), |
300 FloatPoint(textPos), Font::DoNotPaintIfFontNotReady, | 300 FloatPoint(textPos), Font::DoNotPaintIfFontNotReady, |
301 deviceScaleFactor, textPaint); | 301 deviceScaleFactor, textPaint); |
302 | 302 |
303 RefPtr<Image> image = buffer->newImageSnapshot(); | 303 RefPtr<Image> image = buffer->newImageSnapshot(); |
304 return DragImage::create(image.get(), DoNotRespectImageOrientation, | 304 return DragImage::create(image.get(), DoNotRespectImageOrientation, |
(...skipping 14 matching lines...) Expand all Loading... |
319 m_interpolationQuality == InterpolationNone | 319 m_interpolationQuality == InterpolationNone |
320 ? skia::ImageOperations::RESIZE_BOX | 320 ? skia::ImageOperations::RESIZE_BOX |
321 : skia::ImageOperations::RESIZE_LANCZOS3; | 321 : skia::ImageOperations::RESIZE_LANCZOS3; |
322 int imageWidth = scaleX * m_bitmap.width(); | 322 int imageWidth = scaleX * m_bitmap.width(); |
323 int imageHeight = scaleY * m_bitmap.height(); | 323 int imageHeight = scaleY * m_bitmap.height(); |
324 m_bitmap = skia::ImageOperations::Resize(m_bitmap, resizeMethod, imageWidth, | 324 m_bitmap = skia::ImageOperations::Resize(m_bitmap, resizeMethod, imageWidth, |
325 imageHeight); | 325 imageHeight); |
326 } | 326 } |
327 | 327 |
328 } // namespace blink | 328 } // namespace blink |
OLD | NEW |