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

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

Issue 630903003: Move common GC state update code out of paint-server application (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 2 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
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 532 matching lines...) Expand 10 before | Expand all | Expand 10 after
543 return; 543 return;
544 544
545 float decorationOffset = baselineOffsetForDecoration(decoration, scaledFont. fontMetrics(), thickness); 545 float decorationOffset = baselineOffsetForDecoration(decoration, scaledFont. fontMetrics(), thickness);
546 FloatPoint decorationOrigin(fragment.x, fragment.y - decorationOffset / scal ingFactor); 546 FloatPoint decorationOrigin(fragment.x, fragment.y - decorationOffset / scal ingFactor);
547 547
548 Path path; 548 Path path;
549 path.addRect(FloatRect(decorationOrigin, FloatSize(fragment.width, thickness / scalingFactor))); 549 path.addRect(FloatRect(decorationOrigin, FloatSize(fragment.width, thickness / scalingFactor)));
550 550
551 PaintingResourceScope resourceScope(*decorationRenderer); 551 PaintingResourceScope resourceScope(*decorationRenderer);
552 if (resourceScope.acquirePaintingResource(context, decorationStyle, resource Mode)) { 552 if (resourceScope.acquirePaintingResource(context, decorationStyle, resource Mode)) {
553 SVGRenderSupport::updateGraphicsContext(context, decorationStyle, *decor ationRenderer, resourceMode);
553 SVGRenderSupport::fillOrStrokePath(context, resourceMode, path); 554 SVGRenderSupport::fillOrStrokePath(context, resourceMode, path);
554 resourceScope.releasePaintingResource(context); 555 resourceScope.releasePaintingResource(context);
555 } 556 }
556 } 557 }
557 558
558 void SVGInlineTextBox::paintTextWithShadows(GraphicsContext* context, RenderStyl e* style, 559 void SVGInlineTextBox::paintTextWithShadows(GraphicsContext* context, RenderStyl e* style,
559 TextRun& textRun, const SVGTextFragment& fragment, int startPosition, int en dPosition, 560 TextRun& textRun, const SVGTextFragment& fragment, int startPosition, int en dPosition,
560 RenderSVGResourceModeFlags resourceMode) 561 RenderSVGResourceModeFlags resourceMode)
561 { 562 {
562 RenderSVGInlineText& textRenderer = toRenderSVGInlineText(this->renderer()); 563 RenderSVGInlineText& textRenderer = toRenderSVGInlineText(this->renderer());
(...skipping 15 matching lines...) Expand all
578 textSize.scale(scalingFactor); 579 textSize.scale(scalingFactor);
579 context->save(); 580 context->save();
580 context->scale(1 / scalingFactor, 1 / scalingFactor); 581 context->scale(1 / scalingFactor, 1 / scalingFactor);
581 } 582 }
582 583
583 if (hasShadow) 584 if (hasShadow)
584 context->setDrawLooper(shadowList->createDrawLooper(DrawLooperBuilder::S hadowRespectsAlpha)); 585 context->setDrawLooper(shadowList->createDrawLooper(DrawLooperBuilder::S hadowRespectsAlpha));
585 586
586 PaintingResourceScope resourceScope(parent()->renderer()); 587 PaintingResourceScope resourceScope(parent()->renderer());
587 if (resourceScope.acquirePaintingResource(context, style, resourceMode)) { 588 if (resourceScope.acquirePaintingResource(context, style, resourceMode)) {
589 SVGRenderSupport::updateGraphicsContext(context, style, parent()->render er(), resourceMode);
590
588 if (scalingFactor != 1 && resourceMode & ApplyToStrokeMode) 591 if (scalingFactor != 1 && resourceMode & ApplyToStrokeMode)
589 context->setStrokeThickness(context->strokeThickness() * scalingFact or); 592 context->setStrokeThickness(context->strokeThickness() * scalingFact or);
590 593
591 TextRunPaintInfo textRunPaintInfo(textRun); 594 TextRunPaintInfo textRunPaintInfo(textRun);
592 textRunPaintInfo.from = startPosition; 595 textRunPaintInfo.from = startPosition;
593 textRunPaintInfo.to = endPosition; 596 textRunPaintInfo.to = endPosition;
594 597
595 float baseline = scaledFont.fontMetrics().floatAscent(); 598 float baseline = scaledFont.fontMetrics().floatAscent();
596 textRunPaintInfo.bounds = FloatRect(textOrigin.x(), textOrigin.y() - bas eline, 599 textRunPaintInfo.bounds = FloatRect(textOrigin.x(), textOrigin.y() - bas eline,
597 textSize.width(), textSize.height()); 600 textSize.width(), textSize.height());
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
754 renderer().updateHitTestResult(result, locationInContainer.point () - toLayoutSize(accumulatedOffset)); 757 renderer().updateHitTestResult(result, locationInContainer.point () - toLayoutSize(accumulatedOffset));
755 if (!result.addNodeToRectBasedTestResult(renderer().node(), requ est, locationInContainer, rect)) 758 if (!result.addNodeToRectBasedTestResult(renderer().node(), requ est, locationInContainer, rect))
756 return true; 759 return true;
757 } 760 }
758 } 761 }
759 } 762 }
760 return false; 763 return false;
761 } 764 }
762 765
763 } // namespace blink 766 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698