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

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

Issue 23102018: Refactoring DrawLooper so that it can apply shadow effects as skia image filters (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Adding missing adoptRefs Created 7 years, 3 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 | « 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 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 const AtomicString& emphasisMark, int emphasisMarkOffset, 389 const AtomicString& emphasisMark, int emphasisMarkOffset,
390 int startOffset, int endOffset, int truncationPoint, 390 int startOffset, int endOffset, int truncationPoint,
391 const FloatPoint& textOrigin, const FloatRect& boxRect, 391 const FloatPoint& textOrigin, const FloatRect& boxRect,
392 const ShadowData* shadow, bool stroked, bool horizontal) 392 const ShadowData* shadow, bool stroked, bool horizontal)
393 { 393 {
394 // Text shadows are disabled when printing. http://crbug.com/258321 394 // Text shadows are disabled when printing. http://crbug.com/258321
395 bool hasShadow = shadow && !context->printing(); 395 bool hasShadow = shadow && !context->printing();
396 Color fillColor = context->fillColor(); 396 Color fillColor = context->fillColor();
397 397
398 if (hasShadow) { 398 if (hasShadow) {
399 DrawLooper drawLooper; 399 RefPtr<DrawLooper> drawLooper = adoptRef(new DrawLooper);
400 do { 400 do {
401 int shadowX = horizontal ? shadow->x() : shadow->y(); 401 int shadowX = horizontal ? shadow->x() : shadow->y();
402 int shadowY = horizontal ? shadow->y() : -shadow->x(); 402 int shadowY = horizontal ? shadow->y() : -shadow->x();
403 FloatSize offset(shadowX, shadowY); 403 FloatSize offset(shadowX, shadowY);
404 drawLooper.addShadow(offset, shadow->blur(), 404 drawLooper->addShadow(offset, shadow->blur(),
405 renderer->resolveColor(shadow->color(), Color::stdShadowColor), 405 renderer->resolveColor(shadow->color(), Color::stdShadowColor),
406 DrawLooper::ShadowRespectsTransforms, DrawLooper::ShadowIgnoresA lpha); 406 DrawLooper::ShadowRespectsTransforms, DrawLooper::ShadowIgnoresA lpha);
407 } while ((shadow = shadow->next())); 407 } while ((shadow = shadow->next()));
408 drawLooper.addUnmodifiedContent(); 408 drawLooper->addUnmodifiedContent();
409 context->setDrawLooper(drawLooper); 409 context->setDrawLooper(drawLooper.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 1139 matching lines...) Expand 10 before | Expand all | Expand 10 after
1559 printedCharacters = fprintf(stderr, "\t%s %p", obj->renderName(), obj); 1559 printedCharacters = fprintf(stderr, "\t%s %p", obj->renderName(), obj);
1560 const int rendererCharacterOffset = 24; 1560 const int rendererCharacterOffset = 24;
1561 for (; printedCharacters < rendererCharacterOffset; printedCharacters++) 1561 for (; printedCharacters < rendererCharacterOffset; printedCharacters++)
1562 fputc(' ', stderr); 1562 fputc(' ', stderr);
1563 fprintf(stderr, "(%d,%d) \"%s\"\n", start(), start() + len(), value.utf8().d ata()); 1563 fprintf(stderr, "(%d,%d) \"%s\"\n", start(), start() + len(), value.utf8().d ata());
1564 } 1564 }
1565 1565
1566 #endif 1566 #endif
1567 1567
1568 } // namespace WebCore 1568 } // 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