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

Side by Side Diff: Source/core/rendering/InlineTextBox.cpp

Issue 177473003: Use SkLayerDrawLooper::Builder to construct SkLayerDrawLooper. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase 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
« no previous file with comments | « Source/core/rendering/EllipsisBox.cpp ('k') | Source/core/rendering/RenderBoxModelObject.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 * (C) 1999 Lars Knoll (knoll@kde.org) 2 * (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 2000 Dirk Mueller (mueller@kde.org) 3 * (C) 2000 Dirk Mueller (mueller@kde.org)
4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved. 4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights 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 28 matching lines...) Expand all
39 #include "core/rendering/RenderBR.h" 39 #include "core/rendering/RenderBR.h"
40 #include "core/rendering/RenderBlock.h" 40 #include "core/rendering/RenderBlock.h"
41 #include "core/rendering/RenderCombineText.h" 41 #include "core/rendering/RenderCombineText.h"
42 #include "core/rendering/RenderRubyRun.h" 42 #include "core/rendering/RenderRubyRun.h"
43 #include "core/rendering/RenderRubyText.h" 43 #include "core/rendering/RenderRubyText.h"
44 #include "core/rendering/RenderTheme.h" 44 #include "core/rendering/RenderTheme.h"
45 #include "core/rendering/style/ShadowList.h" 45 #include "core/rendering/style/ShadowList.h"
46 #include "core/rendering/svg/SVGTextRunRenderingContext.h" 46 #include "core/rendering/svg/SVGTextRunRenderingContext.h"
47 #include "platform/fonts/FontCache.h" 47 #include "platform/fonts/FontCache.h"
48 #include "platform/fonts/WidthIterator.h" 48 #include "platform/fonts/WidthIterator.h"
49 #include "platform/graphics/DrawLooper.h" 49 #include "platform/graphics/DrawLooperBuilder.h"
50 #include "platform/graphics/GraphicsContextStateSaver.h" 50 #include "platform/graphics/GraphicsContextStateSaver.h"
51 #include "wtf/Vector.h" 51 #include "wtf/Vector.h"
52 #include "wtf/text/CString.h" 52 #include "wtf/text/CString.h"
53 #include "wtf/text/StringBuilder.h" 53 #include "wtf/text/StringBuilder.h"
54 54
55 using namespace std; 55 using namespace std;
56 56
57 namespace WebCore { 57 namespace WebCore {
58 58
59 struct SameSizeAsInlineTextBox : public InlineBox { 59 struct SameSizeAsInlineTextBox : public InlineBox {
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 const RenderObject& renderer, const Font& font, const TextRun& textRun, 389 const RenderObject& renderer, const Font& font, const TextRun& textRun,
390 const AtomicString& emphasisMark, int emphasisMarkOffset, 390 const AtomicString& emphasisMark, int emphasisMarkOffset,
391 int startOffset, int endOffset, int truncationPoint, 391 int startOffset, int endOffset, int truncationPoint,
392 const FloatPoint& textOrigin, const FloatRect& boxRect, 392 const FloatPoint& textOrigin, const FloatRect& boxRect,
393 const ShadowList* shadowList, bool stroked, bool horizontal) 393 const ShadowList* shadowList, bool stroked, bool horizontal)
394 { 394 {
395 // Text shadows are disabled when printing. http://crbug.com/258321 395 // Text shadows are disabled when printing. http://crbug.com/258321
396 bool hasShadow = shadowList && !context->printing(); 396 bool hasShadow = shadowList && !context->printing();
397 397
398 if (hasShadow) { 398 if (hasShadow) {
399 DrawLooper drawLooper; 399 OwnPtr<DrawLooperBuilder> drawLooperBuilder = DrawLooperBuilder::create( );
400 for (size_t i = shadowList->shadows().size(); i--; ) { 400 for (size_t i = shadowList->shadows().size(); i--; ) {
401 const ShadowData& shadow = shadowList->shadows()[i]; 401 const ShadowData& shadow = shadowList->shadows()[i];
402 float shadowX = horizontal ? shadow.x() : shadow.y(); 402 float shadowX = horizontal ? shadow.x() : shadow.y();
403 float shadowY = horizontal ? shadow.y() : -shadow.x(); 403 float shadowY = horizontal ? shadow.y() : -shadow.x();
404 FloatSize offset(shadowX, shadowY); 404 FloatSize offset(shadowX, shadowY);
405 drawLooper.addShadow(offset, shadow.blur(), shadow.color(), 405 drawLooperBuilder->addShadow(offset, shadow.blur(), shadow.color(),
406 DrawLooper::ShadowRespectsTransforms, DrawLooper::ShadowIgnoresA lpha); 406 DrawLooperBuilder::ShadowRespectsTransforms, DrawLooperBuilder:: ShadowIgnoresAlpha);
407 } 407 }
408 drawLooper.addUnmodifiedContent(); 408 drawLooperBuilder->addUnmodifiedContent();
409 context->setDrawLooper(drawLooper); 409 context->setDrawLooper(drawLooperBuilder.release());
410 } 410 }
411 411
412 TextRunPaintInfo textRunPaintInfo(textRun); 412 TextRunPaintInfo textRunPaintInfo(textRun);
413 textRunPaintInfo.bounds = boxRect; 413 textRunPaintInfo.bounds = boxRect;
414 if (startOffset <= endOffset) { 414 if (startOffset <= endOffset) {
415 textRunPaintInfo.from = startOffset; 415 textRunPaintInfo.from = startOffset;
416 textRunPaintInfo.to = endOffset; 416 textRunPaintInfo.to = endOffset;
417 if (emphasisMark.isEmpty()) 417 if (emphasisMark.isEmpty())
418 context->drawText(font, textRunPaintInfo, textOrigin); 418 context->drawText(font, textRunPaintInfo, textOrigin);
419 else 419 else
(...skipping 1145 matching lines...) Expand 10 before | Expand all | Expand 10 after
1565 printedCharacters = fprintf(stderr, "\t%s %p", obj.renderName(), &obj); 1565 printedCharacters = fprintf(stderr, "\t%s %p", obj.renderName(), &obj);
1566 const int rendererCharacterOffset = 24; 1566 const int rendererCharacterOffset = 24;
1567 for (; printedCharacters < rendererCharacterOffset; printedCharacters++) 1567 for (; printedCharacters < rendererCharacterOffset; printedCharacters++)
1568 fputc(' ', stderr); 1568 fputc(' ', stderr);
1569 fprintf(stderr, "(%d,%d) \"%s\"\n", start(), start() + len(), value.utf8().d ata()); 1569 fprintf(stderr, "(%d,%d) \"%s\"\n", start(), start() + len(), value.utf8().d ata());
1570 } 1570 }
1571 1571
1572 #endif 1572 #endif
1573 1573
1574 } // namespace WebCore 1574 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/rendering/EllipsisBox.cpp ('k') | Source/core/rendering/RenderBoxModelObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698