Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(185)

Side by Side Diff: third_party/WebKit/Source/platform/DragImage.cpp

Issue 2640983002: Rename paint data structures (Closed)
Patch Set: Rebase Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 scaledImageSize.scale(deviceScaleFactor); 252 scaledImageSize.scale(deviceScaleFactor);
253 std::unique_ptr<ImageBuffer> buffer(ImageBuffer::create(scaledImageSize)); 253 std::unique_ptr<ImageBuffer> buffer(ImageBuffer::create(scaledImageSize));
254 if (!buffer) 254 if (!buffer)
255 return nullptr; 255 return nullptr;
256 256
257 buffer->canvas()->scale(deviceScaleFactor, deviceScaleFactor); 257 buffer->canvas()->scale(deviceScaleFactor, deviceScaleFactor);
258 258
259 const float DragLabelRadius = 5; 259 const float DragLabelRadius = 5;
260 260
261 IntRect rect(IntPoint(), imageSize); 261 IntRect rect(IntPoint(), imageSize);
262 SkPaint backgroundPaint; 262 PaintFlags backgroundPaint;
263 backgroundPaint.setColor(SkColorSetRGB(140, 140, 140)); 263 backgroundPaint.setColor(SkColorSetRGB(140, 140, 140));
264 backgroundPaint.setAntiAlias(true); 264 backgroundPaint.setAntiAlias(true);
265 SkRRect rrect; 265 SkRRect rrect;
266 rrect.setRectXY(SkRect::MakeWH(imageSize.width(), imageSize.height()), 266 rrect.setRectXY(SkRect::MakeWH(imageSize.width(), imageSize.height()),
267 DragLabelRadius, DragLabelRadius); 267 DragLabelRadius, DragLabelRadius);
268 buffer->canvas()->drawRRect(rrect, backgroundPaint); 268 buffer->canvas()->drawRRect(rrect, backgroundPaint);
269 269
270 // Draw the text 270 // Draw the text
271 SkPaint textPaint; 271 PaintFlags textPaint;
272 if (drawURLString) { 272 if (drawURLString) {
273 if (clipURLString) 273 if (clipURLString)
274 urlString = StringTruncator::centerTruncate( 274 urlString = StringTruncator::centerTruncate(
275 urlString, imageSize.width() - (kDragLabelBorderX * 2.0f), urlFont); 275 urlString, imageSize.width() - (kDragLabelBorderX * 2.0f), urlFont);
276 IntPoint textPos( 276 IntPoint textPos(
277 kDragLabelBorderX, 277 kDragLabelBorderX,
278 imageSize.height() - 278 imageSize.height() -
279 (kLabelBorderYOffset + urlFontData->getFontMetrics().descent())); 279 (kLabelBorderYOffset + urlFontData->getFontMetrics().descent()));
280 TextRun textRun(urlString); 280 TextRun textRun(urlString);
281 urlFont.drawText(buffer->canvas(), TextRunPaintInfo(textRun), textPos, 281 urlFont.drawText(buffer->canvas(), TextRunPaintInfo(textRun), textPos,
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698