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

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

Issue 2471533004: Antialias the dragged-link rounded rect (Closed)
Patch Set: Created 4 years, 1 month 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 SkPaint backgroundPaint;
259 backgroundPaint.setColor(SkColorSetRGB(140, 140, 140)); 259 backgroundPaint.setColor(SkColorSetRGB(140, 140, 140));
260 backgroundPaint.setAntiAlias(true);
260 SkRRect rrect; 261 SkRRect rrect;
261 rrect.setRectXY(SkRect::MakeWH(imageSize.width(), imageSize.height()), 262 rrect.setRectXY(SkRect::MakeWH(imageSize.width(), imageSize.height()),
262 DragLabelRadius, DragLabelRadius); 263 DragLabelRadius, DragLabelRadius);
263 buffer->canvas()->drawRRect(rrect, backgroundPaint); 264 buffer->canvas()->drawRRect(rrect, backgroundPaint);
264 265
265 // Draw the text 266 // Draw the text
266 SkPaint textPaint; 267 SkPaint textPaint;
267 if (drawURLString) { 268 if (drawURLString) {
268 if (clipURLString) 269 if (clipURLString)
269 urlString = StringTruncator::centerTruncate( 270 urlString = StringTruncator::centerTruncate(
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 m_interpolationQuality == InterpolationNone 315 m_interpolationQuality == InterpolationNone
315 ? skia::ImageOperations::RESIZE_BOX 316 ? skia::ImageOperations::RESIZE_BOX
316 : skia::ImageOperations::RESIZE_LANCZOS3; 317 : skia::ImageOperations::RESIZE_LANCZOS3;
317 int imageWidth = scaleX * m_bitmap.width(); 318 int imageWidth = scaleX * m_bitmap.width();
318 int imageHeight = scaleY * m_bitmap.height(); 319 int imageHeight = scaleY * m_bitmap.height();
319 m_bitmap = skia::ImageOperations::Resize(m_bitmap, resizeMethod, imageWidth, 320 m_bitmap = skia::ImageOperations::Resize(m_bitmap, resizeMethod, imageWidth,
320 imageHeight); 321 imageHeight);
321 } 322 }
322 323
323 } // namespace blink 324 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698