OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "config.h" | 5 #include "config.h" |
6 #include "core/paint/ObjectPainter.h" | 6 #include "core/paint/ObjectPainter.h" |
7 | 7 |
8 #include "core/layout/LayoutInline.h" | 8 #include "core/layout/LayoutInline.h" |
9 #include "core/layout/LayoutObject.h" | 9 #include "core/layout/LayoutObject.h" |
10 #include "core/layout/LayoutTheme.h" | 10 #include "core/layout/LayoutTheme.h" |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 | 335 |
336 bool wasAntialiased = graphicsContext->shouldAntialias(); | 336 bool wasAntialiased = graphicsContext->shouldAntialias(); |
337 StrokeStyle oldStrokeStyle = graphicsContext->strokeStyle(); | 337 StrokeStyle oldStrokeStyle = graphicsContext->strokeStyle(); |
338 graphicsContext->setShouldAntialias(antialias); | 338 graphicsContext->setShouldAntialias(antialias); |
339 graphicsContext->setStrokeColor(color); | 339 graphicsContext->setStrokeColor(color); |
340 graphicsContext->setStrokeThickness(thickness); | 340 graphicsContext->setStrokeThickness(thickness); |
341 graphicsContext->setStrokeStyle(style == DASHED ? DashedStroke : DottedStrok
e); | 341 graphicsContext->setStrokeStyle(style == DASHED ? DashedStroke : DottedStrok
e); |
342 | 342 |
343 switch (side) { | 343 switch (side) { |
344 case BSBottom: | 344 case BSBottom: |
345 case BSTop: | 345 case BSTop: { |
346 graphicsContext->drawLine(IntPoint(x1, (y1 + y2) / 2), IntPoint(x2, (y1
+ y2) / 2)); | 346 int midY = y1 + thickness / 2; |
| 347 graphicsContext->drawLine(IntPoint(x1, midY), IntPoint(x2, midY)); |
347 break; | 348 break; |
| 349 } |
348 case BSRight: | 350 case BSRight: |
349 case BSLeft: | 351 case BSLeft: { |
350 graphicsContext->drawLine(IntPoint((x1 + x2) / 2, y1), IntPoint((x1 + x2
) / 2, y2)); | 352 int midX = x1 + thickness / 2; |
| 353 graphicsContext->drawLine(IntPoint(midX, y1), IntPoint(midX, y2)); |
351 break; | 354 break; |
352 } | 355 } |
| 356 } |
353 graphicsContext->setShouldAntialias(wasAntialiased); | 357 graphicsContext->setShouldAntialias(wasAntialiased); |
354 graphicsContext->setStrokeStyle(oldStrokeStyle); | 358 graphicsContext->setStrokeStyle(oldStrokeStyle); |
355 } | 359 } |
356 | 360 |
357 void ObjectPainter::drawDoubleBoxSide(GraphicsContext* graphicsContext, int x1,
int y1, int x2, int y2, | 361 void ObjectPainter::drawDoubleBoxSide(GraphicsContext* graphicsContext, int x1,
int y1, int x2, int y2, |
358 int length, BoxSide side, Color color, int thickness, int adjacentWidth1, in
t adjacentWidth2, bool antialias) | 362 int length, BoxSide side, Color color, int thickness, int adjacentWidth1, in
t adjacentWidth2, bool antialias) |
359 { | 363 { |
360 int thirdOfThickness = (thickness + 1) / 3; | 364 int thirdOfThickness = (thickness + 1) / 3; |
361 ASSERT(thirdOfThickness); | 365 ASSERT(thirdOfThickness); |
362 | 366 |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
514 quad[1] = FloatPoint(x1, y2 - std::max(adjacentWidth2, 0)); | 518 quad[1] = FloatPoint(x1, y2 - std::max(adjacentWidth2, 0)); |
515 quad[2] = FloatPoint(x2, y2 - std::max(-adjacentWidth2, 0)); | 519 quad[2] = FloatPoint(x2, y2 - std::max(-adjacentWidth2, 0)); |
516 quad[3] = FloatPoint(x2, y1 + std::max(-adjacentWidth1, 0)); | 520 quad[3] = FloatPoint(x2, y1 + std::max(-adjacentWidth1, 0)); |
517 break; | 521 break; |
518 } | 522 } |
519 | 523 |
520 graphicsContext->fillPolygon(4, quad, color, antialias); | 524 graphicsContext->fillPolygon(4, quad, color, antialias); |
521 } | 525 } |
522 | 526 |
523 } // namespace blink | 527 } // namespace blink |
OLD | NEW |