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

Side by Side Diff: Source/core/rendering/svg/SVGInlineTextBox.cpp

Issue 323013004: Clean up transform methods in GraphicsContext. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2nd Attempt Mac build fix Created 6 years, 6 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) 2007 Rob Buis <buis@kde.org> 2 * Copyright (C) 2007 Rob Buis <buis@kde.org>
3 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> 3 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org>
4 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 4 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after
589 589
590 FloatPoint decorationOrigin(fragment.x, fragment.y); 590 FloatPoint decorationOrigin(fragment.x, fragment.y);
591 float width = fragment.width; 591 float width = fragment.width;
592 const FontMetrics& scaledFontMetrics = scaledFont.fontMetrics(); 592 const FontMetrics& scaledFontMetrics = scaledFont.fontMetrics();
593 593
594 GraphicsContextStateSaver stateSaver(*context, false); 594 GraphicsContextStateSaver stateSaver(*context, false);
595 if (scalingFactor != 1) { 595 if (scalingFactor != 1) {
596 stateSaver.save(); 596 stateSaver.save();
597 width *= scalingFactor; 597 width *= scalingFactor;
598 decorationOrigin.scale(scalingFactor, scalingFactor); 598 decorationOrigin.scale(scalingFactor, scalingFactor);
599 context->scale(FloatSize(1 / scalingFactor, 1 / scalingFactor)); 599 context->scale(1 / scalingFactor, 1 / scalingFactor);
600 } 600 }
601 601
602 decorationOrigin.move(0, -scaledFontMetrics.floatAscent() + positionOffsetFo rDecoration(decoration, scaledFontMetrics, thickness)); 602 decorationOrigin.move(0, -scaledFontMetrics.floatAscent() + positionOffsetFo rDecoration(decoration, scaledFontMetrics, thickness));
603 603
604 Path path; 604 Path path;
605 path.addRect(FloatRect(decorationOrigin, FloatSize(width, thickness))); 605 path.addRect(FloatRect(decorationOrigin, FloatSize(width, thickness)));
606 606
607 // acquirePaintingResource also modifies state if the scalingFactor is non-i dentity. 607 // acquirePaintingResource also modifies state if the scalingFactor is non-i dentity.
608 // Above we have saved the state for this case. 608 // Above we have saved the state for this case.
609 if (acquirePaintingResource(context, scalingFactor, decorationRenderer, deco rationStyle, resourceMode)) 609 if (acquirePaintingResource(context, scalingFactor, decorationRenderer, deco rationStyle, resourceMode))
(...skipping 15 matching lines...) Expand all
625 // Text shadows are disabled when printing. http://crbug.com/258321 625 // Text shadows are disabled when printing. http://crbug.com/258321
626 bool hasShadow = shadowList && !context->printing(); 626 bool hasShadow = shadowList && !context->printing();
627 627
628 FloatPoint textOrigin(fragment.x, fragment.y); 628 FloatPoint textOrigin(fragment.x, fragment.y);
629 FloatSize textSize(fragment.width, fragment.height); 629 FloatSize textSize(fragment.width, fragment.height);
630 630
631 if (scalingFactor != 1) { 631 if (scalingFactor != 1) {
632 textOrigin.scale(scalingFactor, scalingFactor); 632 textOrigin.scale(scalingFactor, scalingFactor);
633 textSize.scale(scalingFactor); 633 textSize.scale(scalingFactor);
634 context->save(); 634 context->save();
635 context->scale(FloatSize(1 / scalingFactor, 1 / scalingFactor)); 635 context->scale(1 / scalingFactor, 1 / scalingFactor);
636 } 636 }
637 637
638 if (hasShadow) { 638 if (hasShadow) {
639 OwnPtr<DrawLooperBuilder> drawLooperBuilder = DrawLooperBuilder::create( ); 639 OwnPtr<DrawLooperBuilder> drawLooperBuilder = DrawLooperBuilder::create( );
640 for (size_t i = shadowList->shadows().size(); i--; ) { 640 for (size_t i = shadowList->shadows().size(); i--; ) {
641 const ShadowData& shadow = shadowList->shadows()[i]; 641 const ShadowData& shadow = shadowList->shadows()[i];
642 FloatSize offset(shadow.x(), shadow.y()); 642 FloatSize offset(shadow.x(), shadow.y());
643 drawLooperBuilder->addShadow(offset, shadow.blur(), shadow.color(), 643 drawLooperBuilder->addShadow(offset, shadow.blur(), shadow.color(),
644 DrawLooperBuilder::ShadowRespectsTransforms, DrawLooperBuilder:: ShadowRespectsAlpha); 644 DrawLooperBuilder::ShadowRespectsTransforms, DrawLooperBuilder:: ShadowRespectsAlpha);
645 } 645 }
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
810 renderer().updateHitTestResult(result, locationInContainer.point () - toLayoutSize(accumulatedOffset)); 810 renderer().updateHitTestResult(result, locationInContainer.point () - toLayoutSize(accumulatedOffset));
811 if (!result.addNodeToRectBasedTestResult(renderer().node(), requ est, locationInContainer, rect)) 811 if (!result.addNodeToRectBasedTestResult(renderer().node(), requ est, locationInContainer, rect))
812 return true; 812 return true;
813 } 813 }
814 } 814 }
815 } 815 }
816 return false; 816 return false;
817 } 817 }
818 818
819 } // namespace WebCore 819 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/rendering/svg/RenderSVGResourcePattern.cpp ('k') | Source/core/rendering/svg/SVGRenderingContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698