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

Unified Diff: third_party/WebKit/WebCore/platform/graphics/skia/PlatformContextSkia.cpp

Issue 46097: WebKit merge 41660:41709 (WebKit side).... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/WebCore/platform/graphics/skia/PlatformContextSkia.cpp
===================================================================
--- third_party/WebKit/WebCore/platform/graphics/skia/PlatformContextSkia.cpp (revision 11711)
+++ third_party/WebKit/WebCore/platform/graphics/skia/PlatformContextSkia.cpp (working copy)
@@ -272,12 +272,21 @@
if (m_state->m_strokeStyle != WebCore::NoStroke &&
(m_state->m_strokeColor & 0xFF000000)) {
- if (fillcolorNotTransparent) {
- // This call is expensive so don't call it unnecessarily.
- paint.reset();
- }
- setupPaintForStroking(&paint, &rect, 0);
- canvas()->drawRect(rect, paint);
+ // We do a fill of four rects to simulate the stroke of a border.
+ SkColor oldFillColor = m_state->m_fillColor;
+ if (oldFillColor != m_state->m_strokeColor)
+ setFillColor(m_state->m_strokeColor);
+ setupPaintForFilling(&paint);
+ SkRect topBorder = { rect.fLeft, rect.fTop, rect.width(), 1};
+ canvas()->drawRect(topBorder, paint);
+ SkRect bottomBorder = { rect.fLeft, rect.fBottom - 1, rect.width(), 1 };
+ canvas()->drawRect(bottomBorder, paint);
+ SkRect leftBorder = { rect.fLeft, rect.fTop + 1, 1, rect.height() - 2 };
+ canvas()->drawRect(leftBorder, paint);
+ SkRect rightBorder = { rect.fRight - 1, rect.fTop + 1, 1, rect.height() - 2 };
+ canvas()->drawRect(rightBorder, paint);
+ if (oldFillColor != m_state->m_strokeColor)
+ setFillColor(oldFillColor);
}
}
@@ -311,10 +320,6 @@
setupPaintCommon(paint);
float width = m_state->m_strokeThickness;
- // This allows dashing and dotting to work properly for hairline strokes.
- if (width == 0)
- width = 1;
-
paint->setColor(m_state->applyAlpha(m_state->m_strokeColor));
paint->setStyle(SkPaint::kStroke_Style);
paint->setStrokeWidth(SkFloatToScalar(width));
@@ -322,9 +327,6 @@
paint->setStrokeJoin(m_state->m_lineJoin);
paint->setStrokeMiter(SkFloatToScalar(m_state->m_miterLimit));
- if (rect != 0 && (static_cast<int>(roundf(width)) & 1))
- rect->inset(-SK_ScalarHalf, -SK_ScalarHalf);
-
if (m_state->m_dash)
paint->setPathEffect(m_state->m_dash);
else {
@@ -339,7 +341,8 @@
SkScalar dashLength;
if (length) {
// Determine about how many dashes or dots we should have.
- int numDashes = length / roundf(width);
+ float roundedWidth = roundf(width);
+ int numDashes = roundedWidth ? (length / roundedWidth) : length;
if (!(numDashes & 1))
numDashes++; // Make it odd so we end on a dash/dot.
// Use the number of dashes to determine the length of a

Powered by Google App Engine
This is Rietveld 408576698