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

Side by Side Diff: Source/core/html/canvas/CanvasRenderingContext2D.cpp

Issue 169283008: Maintain SkPaint in GraphicsContextState. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: A couple more optimizations. Created 6 years, 9 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
« no previous file with comments | « no previous file | Source/core/rendering/RenderEmbeddedObject.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
3 * Copyright (C) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies)
4 * Copyright (C) 2007 Alp Toker <alp@atoker.com> 4 * Copyright (C) 2007 Alp Toker <alp@atoker.com>
5 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> 5 * Copyright (C) 2008 Eric Seidel <eric@webkit.org>
6 * Copyright (C) 2008 Dirk Schulze <krit@webkit.org> 6 * Copyright (C) 2008 Dirk Schulze <krit@webkit.org>
7 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. 7 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved.
8 * Copyright (C) 2012, 2013 Intel Corporation. All rights reserved. 8 * Copyright (C) 2012, 2013 Intel Corporation. All rights reserved.
9 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. 9 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved.
10 * 10 *
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 { 541 {
542 if (!(alpha >= 0 && alpha <= 1)) 542 if (!(alpha >= 0 && alpha <= 1))
543 return; 543 return;
544 if (state().m_globalAlpha == alpha) 544 if (state().m_globalAlpha == alpha)
545 return; 545 return;
546 realizeSaves(); 546 realizeSaves();
547 modifiableState().m_globalAlpha = alpha; 547 modifiableState().m_globalAlpha = alpha;
548 GraphicsContext* c = drawingContext(); 548 GraphicsContext* c = drawingContext();
549 if (!c) 549 if (!c)
550 return; 550 return;
551 c->setAlpha(alpha); 551 c->setAlphaAsFloat(alpha);
552 } 552 }
553 553
554 String CanvasRenderingContext2D::globalCompositeOperation() const 554 String CanvasRenderingContext2D::globalCompositeOperation() const
555 { 555 {
556 return compositeOperatorName(state().m_globalComposite, state().m_globalBlen d); 556 return compositeOperatorName(state().m_globalComposite, state().m_globalBlen d);
557 } 557 }
558 558
559 void CanvasRenderingContext2D::setGlobalCompositeOperation(const String& operati on) 559 void CanvasRenderingContext2D::setGlobalCompositeOperation(const String& operati on)
560 { 560 {
561 CompositeOperator op = CompositeSourceOver; 561 CompositeOperator op = CompositeSourceOver;
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after
1093 if (shouldDrawShadows()) { 1093 if (shouldDrawShadows()) {
1094 context->save(); 1094 context->save();
1095 saved = true; 1095 saved = true;
1096 context->clearShadow(); 1096 context->clearShadow();
1097 } 1097 }
1098 if (state().m_globalAlpha != 1) { 1098 if (state().m_globalAlpha != 1) {
1099 if (!saved) { 1099 if (!saved) {
1100 context->save(); 1100 context->save();
1101 saved = true; 1101 saved = true;
1102 } 1102 }
1103 context->setAlpha(1); 1103 context->setAlphaAsFloat(1);
1104 } 1104 }
1105 if (state().m_globalComposite != CompositeSourceOver) { 1105 if (state().m_globalComposite != CompositeSourceOver) {
1106 if (!saved) { 1106 if (!saved) {
1107 context->save(); 1107 context->save();
1108 saved = true; 1108 saved = true;
1109 } 1109 }
1110 context->setCompositeOperation(CompositeSourceOver); 1110 context->setCompositeOperation(CompositeSourceOver);
1111 } 1111 }
1112 context->clearRect(rect); 1112 context->clearRect(rect);
1113 if (saved) 1113 if (saved)
(...skipping 1352 matching lines...) Expand 10 before | Expand all | Expand 10 after
2466 { 2466 {
2467 GraphicsContext* c = drawingContext(); 2467 GraphicsContext* c = drawingContext();
2468 if (!c) 2468 if (!c)
2469 return; 2469 return;
2470 2470
2471 FloatRect dirtyRect; 2471 FloatRect dirtyRect;
2472 if (!computeDirtyRect(path.boundingRect(), &dirtyRect)) 2472 if (!computeDirtyRect(path.boundingRect(), &dirtyRect))
2473 return; 2473 return;
2474 2474
2475 c->save(); 2475 c->save();
2476 c->setAlpha(1.0); 2476 c->setAlphaAsFloat(1.0);
2477 c->clearShadow(); 2477 c->clearShadow();
2478 c->setCompositeOperation(CompositeSourceOver, blink::WebBlendModeNormal); 2478 c->setCompositeOperation(CompositeSourceOver, blink::WebBlendModeNormal);
2479 2479
2480 // These should match the style defined in html.css. 2480 // These should match the style defined in html.css.
2481 Color focusRingColor = RenderTheme::theme().focusRingColor(); 2481 Color focusRingColor = RenderTheme::theme().focusRingColor();
2482 const int focusRingWidth = 5; 2482 const int focusRingWidth = 5;
2483 const int focusRingOutline = 0; 2483 const int focusRingOutline = 0;
2484 c->drawFocusRing(path, focusRingWidth, focusRingOutline, focusRingColor); 2484 c->drawFocusRing(path, focusRingWidth, focusRingOutline, focusRingColor);
2485 2485
2486 c->restore(); 2486 c->restore();
2487 2487
2488 didDraw(dirtyRect); 2488 didDraw(dirtyRect);
2489 } 2489 }
2490 2490
2491 } // namespace WebCore 2491 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | Source/core/rendering/RenderEmbeddedObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698