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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/GraphicsContext.cpp

Issue 2386033002: Scale focus outline thickness with zoom level. (Closed)
Patch Set: return if outline width is 0 Created 4 years, 2 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) 2003, 2004, 2005, 2006, 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2003, 2004, 2005, 2006, 2009 Apple Inc. All rights reserved.
3 * Copyright (C) 2013 Google Inc. All rights reserved. 3 * Copyright (C) 2013 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 picturePaint.setImageFilter(SkPictureImageFilter::MakeForLocalSpace( 321 picturePaint.setImageFilter(SkPictureImageFilter::MakeForLocalSpace(
322 std::move(picture), sourceBounds, 322 std::move(picture), sourceBounds,
323 static_cast<SkFilterQuality>(imageInterpolationQuality()))); 323 static_cast<SkFilterQuality>(imageInterpolationQuality())));
324 m_canvas->saveLayer(&sourceBounds, &picturePaint); 324 m_canvas->saveLayer(&sourceBounds, &picturePaint);
325 m_canvas->restore(); 325 m_canvas->restore();
326 m_canvas->restore(); 326 m_canvas->restore();
327 } 327 }
328 328
329 void GraphicsContext::drawFocusRingPath(const SkPath& path, 329 void GraphicsContext::drawFocusRingPath(const SkPath& path,
330 const Color& color, 330 const Color& color,
331 int width) { 331 float width) {
332 drawPlatformFocusRing(path, m_canvas, color.rgb(), width); 332 drawPlatformFocusRing(path, m_canvas, color.rgb(), width);
333 } 333 }
334 334
335 void GraphicsContext::drawFocusRingRect(const SkRect& rect, 335 void GraphicsContext::drawFocusRingRect(const SkRect& rect,
336 const Color& color, 336 const Color& color,
337 int width) { 337 float width) {
338 drawPlatformFocusRing(rect, m_canvas, color.rgb(), width); 338 drawPlatformFocusRing(rect, m_canvas, color.rgb(), width);
339 } 339 }
340 340
341 void GraphicsContext::drawFocusRing(const Path& focusRingPath, 341 void GraphicsContext::drawFocusRing(const Path& focusRingPath,
342 int width, 342 float width,
343 int offset, 343 int offset,
344 const Color& color) { 344 const Color& color) {
345 // FIXME: Implement support for offset. 345 // FIXME: Implement support for offset.
346 if (contextDisabled()) 346 if (contextDisabled())
347 return; 347 return;
348 348
349 drawFocusRingPath(focusRingPath.getSkPath(), color, width); 349 drawFocusRingPath(focusRingPath.getSkPath(), color, width);
350 } 350 }
351 351
352 void GraphicsContext::drawFocusRing(const Vector<IntRect>& rects, 352 void GraphicsContext::drawFocusRing(const Vector<IntRect>& rects,
353 int width, 353 float width,
354 int offset, 354 int offset,
355 const Color& color) { 355 const Color& color) {
356 if (contextDisabled()) 356 if (contextDisabled())
357 return; 357 return;
358 358
359 unsigned rectCount = rects.size(); 359 unsigned rectCount = rects.size();
360 if (!rectCount) 360 if (!rectCount)
361 return; 361 return;
362 362
363 SkRegion focusRingRegion; 363 SkRegion focusRingRegion;
(...skipping 1041 matching lines...) Expand 10 before | Expand all | Expand 10 after
1405 static const SkPMColor colors[] = { 1405 static const SkPMColor colors[] = {
1406 SkPreMultiplyARGB(0x60, 0xFF, 0x00, 0x00), // More transparent red 1406 SkPreMultiplyARGB(0x60, 0xFF, 0x00, 0x00), // More transparent red
1407 SkPreMultiplyARGB(0x60, 0xC0, 0xC0, 0xC0) // More transparent gray 1407 SkPreMultiplyARGB(0x60, 0xC0, 0xC0, 0xC0) // More transparent gray
1408 }; 1408 };
1409 1409
1410 return colors[index]; 1410 return colors[index];
1411 } 1411 }
1412 #endif 1412 #endif
1413 1413
1414 } // namespace blink 1414 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698