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

Side by Side Diff: Source/WebCore/platform/graphics/skia/ImageSkia.cpp

Issue 13637006: Add canvas blending modes under a runtime flag (Closed) Base URL: http://src.chromium.org/blink/trunk/
Patch Set: Created 7 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) 2008, Google Inc. All rights reserved. 2 * Copyright (c) 2008, Google 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * 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 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after
610 m_isSolidColor = true; 610 m_isSolidColor = true;
611 m_solidColor = Color(frame->bitmap().getColor(0, 0)); 611 m_solidColor = Color(frame->bitmap().getColor(0, 0));
612 } 612 }
613 } 613 }
614 614
615 void BitmapImage::draw(GraphicsContext* ctxt, const FloatRect& dstRect, const Fl oatRect& srcRect, ColorSpace colorSpace, CompositeOperator compositeOp, BlendMod e blendMode) 615 void BitmapImage::draw(GraphicsContext* ctxt, const FloatRect& dstRect, const Fl oatRect& srcRect, ColorSpace colorSpace, CompositeOperator compositeOp, BlendMod e blendMode)
616 { 616 {
617 draw(ctxt, dstRect, srcRect, colorSpace, compositeOp, blendMode, DoNotRespec tImageOrientation); 617 draw(ctxt, dstRect, srcRect, colorSpace, compositeOp, blendMode, DoNotRespec tImageOrientation);
618 } 618 }
619 619
620 void BitmapImage::draw(GraphicsContext* ctxt, const FloatRect& dstRect, const Fl oatRect& srcRect, ColorSpace colorSpace, CompositeOperator compositeOp, BlendMod e, RespectImageOrientationEnum shouldRespectImageOrientation) 620 void BitmapImage::draw(GraphicsContext* ctxt, const FloatRect& dstRect, const Fl oatRect& srcRect, ColorSpace colorSpace, CompositeOperator compositeOp, BlendMod e blendMode, RespectImageOrientationEnum shouldRespectImageOrientation)
621 { 621 {
622 // Spin the animation to the correct frame before we try to draw it, so we 622 // Spin the animation to the correct frame before we try to draw it, so we
623 // don't draw an old frame and then immediately need to draw a newer one, 623 // don't draw an old frame and then immediately need to draw a newer one,
624 // causing flicker and wasting CPU. 624 // causing flicker and wasting CPU.
625 startAnimation(); 625 startAnimation();
626 626
627 RefPtr<NativeImageSkia> bm = nativeImageForCurrentFrame(); 627 RefPtr<NativeImageSkia> bm = nativeImageForCurrentFrame();
628 if (!bm) 628 if (!bm)
629 return; // It's too early and we don't have an image yet. 629 return; // It's too early and we don't have an image yet.
630 630
(...skipping 22 matching lines...) Expand all
653 // The destination rect will have it's width and height already reve rsed for the orientation of 653 // The destination rect will have it's width and height already reve rsed for the orientation of
654 // the image, as it was needed for page layout, so we need to revers e it back here. 654 // the image, as it was needed for page layout, so we need to revers e it back here.
655 normDstRect = FloatRect(normDstRect.x(), normDstRect.y(), normDstRec t.height(), normDstRect.width()); 655 normDstRect = FloatRect(normDstRect.x(), normDstRect.y(), normDstRec t.height(), normDstRect.width());
656 } 656 }
657 } 657 }
658 658
659 paintSkBitmap(ctxt->platformContext(), 659 paintSkBitmap(ctxt->platformContext(),
660 *bm, 660 *bm,
661 normSrcRect, 661 normSrcRect,
662 normDstRect, 662 normDstRect,
663 WebCoreCompositeToSkiaComposite(compositeOp)); 663 WebCoreCompositeToSkiaComposite(compositeOp, blendMode));
664 664
665 if (ImageObserver* observer = imageObserver()) 665 if (ImageObserver* observer = imageObserver())
666 observer->didDraw(this); 666 observer->didDraw(this);
667 } 667 }
668 668
669 } // namespace WebCore 669 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698