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

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

Issue 1269123002: Preparation for combining paths of focus rings and outlines (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Remove debug from fast/css/focus-ring-recursive-continuations.html Created 5 years, 4 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 | Annotate | Revision Log
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 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 void GraphicsContext::drawFocusRing(const Vector<IntRect>& rects, int width, int offset, const Color& color) 479 void GraphicsContext::drawFocusRing(const Vector<IntRect>& rects, int width, int offset, const Color& color)
480 { 480 {
481 if (contextDisabled()) 481 if (contextDisabled())
482 return; 482 return;
483 483
484 unsigned rectCount = rects.size(); 484 unsigned rectCount = rects.size();
485 if (!rectCount) 485 if (!rectCount)
486 return; 486 return;
487 487
488 SkRegion focusRingRegion; 488 SkRegion focusRingRegion;
489 const int outset = focusRingOutset(offset); 489 offset = focusRingOffset(offset);
490 for (unsigned i = 0; i < rectCount; i++) { 490 for (unsigned i = 0; i < rectCount; i++) {
491 SkIRect r = rects[i]; 491 SkIRect r = rects[i];
492 r.inset(-outset, -outset); 492 r.inset(-offset, -offset);
493 focusRingRegion.op(r, SkRegion::kUnion_Op); 493 focusRingRegion.op(r, SkRegion::kUnion_Op);
494 } 494 }
495 495
496 if (focusRingRegion.isRect()) { 496 if (focusRingRegion.isRect()) {
497 drawFocusRingRect(SkRect::Make(focusRingRegion.getBounds()), color, widt h); 497 drawFocusRingRect(SkRect::Make(focusRingRegion.getBounds()), color, widt h);
498 } else { 498 } else {
499 SkPath path; 499 SkPath path;
500 if (focusRingRegion.getBoundaryPath(&path)) 500 if (focusRingRegion.getBoundaryPath(&path))
501 drawFocusRingPath(path, color, width); 501 drawFocusRingPath(path, color, width);
502 } 502 }
(...skipping 976 matching lines...) Expand 10 before | Expand all | Expand 10 after
1479 static const SkPMColor colors[] = { 1479 static const SkPMColor colors[] = {
1480 SkPreMultiplyARGB(0x60, 0xFF, 0x00, 0x00), // More transparent red 1480 SkPreMultiplyARGB(0x60, 0xFF, 0x00, 0x00), // More transparent red
1481 SkPreMultiplyARGB(0x60, 0xC0, 0xC0, 0xC0) // More transparent gray 1481 SkPreMultiplyARGB(0x60, 0xC0, 0xC0, 0xC0) // More transparent gray
1482 }; 1482 };
1483 1483
1484 return colors[index]; 1484 return colors[index];
1485 } 1485 }
1486 #endif 1486 #endif
1487 1487
1488 } // namespace blink 1488 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698