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

Side by Side Diff: third_party/WebKit/Source/core/paint/MediaControlsPainter.cpp

Issue 2785203002: Split Gradient impl into separate classes (Closed)
Patch Set: review Created 3 years, 8 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) 2009 Apple Inc. 2 * Copyright (C) 2009 Apple Inc.
3 * Copyright (C) 2009 Google Inc. 3 * Copyright (C) 2009 Google Inc.
4 * All rights reserved. 4 * All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 highlightRect.setWidth(rangeWidth); 247 highlightRect.setWidth(rangeWidth);
248 248
249 // Don't bother drawing an empty area. 249 // Don't bother drawing an empty area.
250 if (highlightRect.isEmpty()) 250 if (highlightRect.isEmpty())
251 return; 251 return;
252 252
253 // Calculate white-grey gradient. 253 // Calculate white-grey gradient.
254 FloatPoint sliderTopLeft = highlightRect.location(); 254 FloatPoint sliderTopLeft = highlightRect.location();
255 FloatPoint sliderBottomLeft = sliderTopLeft; 255 FloatPoint sliderBottomLeft = sliderTopLeft;
256 sliderBottomLeft.move(0, highlightRect.height()); 256 sliderBottomLeft.move(0, highlightRect.height());
257 RefPtr<Gradient> gradient = Gradient::create(sliderTopLeft, sliderBottomLeft); 257 RefPtr<Gradient> gradient =
258 Gradient::createLinear(sliderTopLeft, sliderBottomLeft);
258 gradient->addColorStop(0.0, startColor); 259 gradient->addColorStop(0.0, startColor);
259 gradient->addColorStop(1.0, endColor); 260 gradient->addColorStop(1.0, endColor);
260 261
261 // Fill highlight rectangle with gradient, potentially rounded if on left or 262 // Fill highlight rectangle with gradient, potentially rounded if on left or
262 // right edge. 263 // right edge.
263 PaintFlags gradientFlags(context.fillFlags()); 264 PaintFlags gradientFlags(context.fillFlags());
264 gradient->applyToFlags(gradientFlags, SkMatrix::I()); 265 gradient->applyToFlags(gradientFlags, SkMatrix::I());
265 266
266 if (startOffset < borderRadius && endOffset < borderRadius) { 267 if (startOffset < borderRadius && endOffset < borderRadius) {
267 context.drawRRect( 268 context.drawRRect(
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
603 void MediaControlsPainter::adjustMediaSliderThumbSize(ComputedStyle& style) { 604 void MediaControlsPainter::adjustMediaSliderThumbSize(ComputedStyle& style) {
604 const float zoomLevel = style.effectiveZoom(); 605 const float zoomLevel = style.effectiveZoom();
605 606
606 style.setWidth( 607 style.setWidth(
607 Length(static_cast<int>(mediaSliderThumbTouchWidth * zoomLevel), Fixed)); 608 Length(static_cast<int>(mediaSliderThumbTouchWidth * zoomLevel), Fixed));
608 style.setHeight( 609 style.setHeight(
609 Length(static_cast<int>(mediaSliderThumbTouchHeight * zoomLevel), Fixed)); 610 Length(static_cast<int>(mediaSliderThumbTouchHeight * zoomLevel), Fixed));
610 } 611 }
611 612
612 } // namespace blink 613 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698