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

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

Issue 840733004: Replace setCompositeOperation(CompositeOperator, WebBlendMode) with setCompositeOperation(SkXfermod… (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 11 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 427 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 return m_isCertainlyOpaque && m_shouldSmoothFonts; 438 return m_isCertainlyOpaque && m_shouldSmoothFonts;
439 } 439 }
440 440
441 void GraphicsContext::setCompositeOperation(SkXfermode::Mode xferMode) 441 void GraphicsContext::setCompositeOperation(SkXfermode::Mode xferMode)
442 { 442 {
443 if (contextDisabled()) 443 if (contextDisabled())
444 return; 444 return;
445 mutableState()->setCompositeOperation(xferMode); 445 mutableState()->setCompositeOperation(xferMode);
446 } 446 }
447 447
448 void GraphicsContext::setCompositeOperation(CompositeOperator compositeOperation , WebBlendMode blendMode) 448 SkXfermode::Mode GraphicsContext::compositeOperation() const
449 { 449 {
450 SkXfermode::Mode xferMode = WebCoreCompositeToSkiaComposite(compositeOperati on, blendMode); 450 return immutableState()->compositeOperation();
451 setCompositeOperation(xferMode);
452 } 451 }
453 452
454 CompositeOperator GraphicsContext::compositeOperation() const 453 CompositeOperator GraphicsContext::compositeOperator() const
455 { 454 {
456 return compositeOperatorFromSkia(immutableState()->compositeOperation()); 455 return compositeOperatorFromSkia(immutableState()->compositeOperation());
457 } 456 }
458 457
459 WebBlendMode GraphicsContext::blendModeOperation() const 458 WebBlendMode GraphicsContext::blendModeOperation() const
460 { 459 {
461 return blendModeFromSkia(immutableState()->compositeOperation()); 460 return blendModeFromSkia(immutableState()->compositeOperation());
462 } 461 }
463 462
464 SkColorFilter* GraphicsContext::colorFilter() const 463 SkColorFilter* GraphicsContext::colorFilter() const
(...skipping 1225 matching lines...) Expand 10 before | Expand all | Expand 10 after
1690 SkScalarToDouble(m.getScaleY()), 1689 SkScalarToDouble(m.getScaleY()),
1691 SkScalarToDouble(m.getTranslateX()), 1690 SkScalarToDouble(m.getTranslateX()),
1692 SkScalarToDouble(m.getTranslateY())); 1691 SkScalarToDouble(m.getTranslateY()));
1693 } 1692 }
1694 1693
1695 void GraphicsContext::fillRect(const FloatRect& rect, const Color& color, Compos iteOperator op) 1694 void GraphicsContext::fillRect(const FloatRect& rect, const Color& color, Compos iteOperator op)
1696 { 1695 {
1697 if (contextDisabled()) 1696 if (contextDisabled())
1698 return; 1697 return;
1699 1698
1700 CompositeOperator previousOperator = compositeOperation(); 1699 SkXfermode::Mode previousOperation = compositeOperation();
1701 setCompositeOperation(op); 1700 setCompositeOperation(WebCoreCompositeToSkiaComposite(op));
1702 fillRect(rect, color); 1701 fillRect(rect, color);
1703 setCompositeOperation(previousOperator); 1702 setCompositeOperation(previousOperation);
1704 } 1703 }
1705 1704
1706 void GraphicsContext::fillRoundedRect(const FloatRoundedRect& rect, const Color& color) 1705 void GraphicsContext::fillRoundedRect(const FloatRoundedRect& rect, const Color& color)
1707 { 1706 {
1708 if (contextDisabled()) 1707 if (contextDisabled())
1709 return; 1708 return;
1710 1709
1711 if (rect.isRounded()) 1710 if (rect.isRounded())
1712 fillRoundedRect(rect.rect(), rect.radii().topLeft(), rect.radii().topRig ht(), rect.radii().bottomLeft(), rect.radii().bottomRight(), color); 1711 fillRoundedRect(rect.rect(), rect.radii().topLeft(), rect.radii().topRig ht(), rect.radii().bottomLeft(), rect.radii().bottomRight(), color);
1713 else 1712 else
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
1993 // being returned from computeInterpolationQuality. 1992 // being returned from computeInterpolationQuality.
1994 resampling = InterpolationLow; 1993 resampling = InterpolationLow;
1995 } 1994 }
1996 resampling = limitInterpolationQuality(this, resampling); 1995 resampling = limitInterpolationQuality(this, resampling);
1997 paint->setFilterLevel(static_cast<SkPaint::FilterLevel>(resampling)); 1996 paint->setFilterLevel(static_cast<SkPaint::FilterLevel>(resampling));
1998 1997
1999 return initialSaveCount; 1998 return initialSaveCount;
2000 } 1999 }
2001 2000
2002 } // namespace blink 2001 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698