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

Side by Side Diff: Source/core/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, 7 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 591 matching lines...) Expand 10 before | Expand all | Expand 10 after
602 m_isSolidColor = true; 602 m_isSolidColor = true;
603 m_solidColor = Color(frame->bitmap().getColor(0, 0)); 603 m_solidColor = Color(frame->bitmap().getColor(0, 0));
604 } 604 }
605 } 605 }
606 606
607 void BitmapImage::draw(GraphicsContext* ctxt, const FloatRect& dstRect, const Fl oatRect& srcRect, ColorSpace colorSpace, CompositeOperator compositeOp, BlendMod e blendMode) 607 void BitmapImage::draw(GraphicsContext* ctxt, const FloatRect& dstRect, const Fl oatRect& srcRect, ColorSpace colorSpace, CompositeOperator compositeOp, BlendMod e blendMode)
608 { 608 {
609 draw(ctxt, dstRect, srcRect, colorSpace, compositeOp, blendMode, DoNotRespec tImageOrientation); 609 draw(ctxt, dstRect, srcRect, colorSpace, compositeOp, blendMode, DoNotRespec tImageOrientation);
610 } 610 }
611 611
612 void BitmapImage::draw(GraphicsContext* ctxt, const FloatRect& dstRect, const Fl oatRect& srcRect, ColorSpace colorSpace, CompositeOperator compositeOp, BlendMod e, RespectImageOrientationEnum shouldRespectImageOrientation) 612 void BitmapImage::draw(GraphicsContext* ctxt, const FloatRect& dstRect, const Fl oatRect& srcRect, ColorSpace colorSpace, CompositeOperator compositeOp, BlendMod e blendMode, RespectImageOrientationEnum shouldRespectImageOrientation)
613 { 613 {
614 // Spin the animation to the correct frame before we try to draw it, so we 614 // Spin the animation to the correct frame before we try to draw it, so we
615 // don't draw an old frame and then immediately need to draw a newer one, 615 // don't draw an old frame and then immediately need to draw a newer one,
616 // causing flicker and wasting CPU. 616 // causing flicker and wasting CPU.
617 startAnimation(); 617 startAnimation();
618 618
619 RefPtr<NativeImageSkia> bm = nativeImageForCurrentFrame(); 619 RefPtr<NativeImageSkia> bm = nativeImageForCurrentFrame();
620 if (!bm) 620 if (!bm)
621 return; // It's too early and we don't have an image yet. 621 return; // It's too early and we don't have an image yet.
622 622
(...skipping 18 matching lines...) Expand all
641 641
642 ctxt->concatCTM(orientation.transformFromDefault(normDstRect.size())); 642 ctxt->concatCTM(orientation.transformFromDefault(normDstRect.size()));
643 643
644 if (orientation.usesWidthAsHeight()) { 644 if (orientation.usesWidthAsHeight()) {
645 // The destination rect will have it's width and height already reve rsed for the orientation of 645 // The destination rect will have it's width and height already reve rsed for the orientation of
646 // the image, as it was needed for page layout, so we need to revers e it back here. 646 // the image, as it was needed for page layout, so we need to revers e it back here.
647 normDstRect = FloatRect(normDstRect.x(), normDstRect.y(), normDstRec t.height(), normDstRect.width()); 647 normDstRect = FloatRect(normDstRect.x(), normDstRect.y(), normDstRec t.height(), normDstRect.width());
648 } 648 }
649 } 649 }
650 650
651 paintSkBitmap(ctxt, *bm, normSrcRect, normDstRect, WebCoreCompositeToSkiaCom posite(compositeOp)); 651 paintSkBitmap(ctxt, *bm, normSrcRect, normDstRect, WebCoreCompositeToSkiaCom posite(compositeOp, blendMode));
652 652
653 if (ImageObserver* observer = imageObserver()) 653 if (ImageObserver* observer = imageObserver())
654 observer->didDraw(this); 654 observer->didDraw(this);
655 } 655 }
656 656
657 } // namespace WebCore 657 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698