| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 #include "SkBBoxRecord.h" | 9 #include "SkBBoxRecord.h" |
| 10 | 10 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 bbox.set(pts, count); | 46 bbox.set(pts, count); |
| 47 // Small min width value, just to ensure hairline point bounding boxes aren'
t empty. | 47 // Small min width value, just to ensure hairline point bounding boxes aren'
t empty. |
| 48 // Even though we know hairline primitives are drawn one pixel wide, we do n
ot use a | 48 // Even though we know hairline primitives are drawn one pixel wide, we do n
ot use a |
| 49 // minimum of 1 because the playback scale factor is unknown at record time.
Later | 49 // minimum of 1 because the playback scale factor is unknown at record time.
Later |
| 50 // outsets will take care of adding additional padding for antialiasing and
rounding out | 50 // outsets will take care of adding additional padding for antialiasing and
rounding out |
| 51 // to integer device coordinates, guaranteeing that the rasterized pixels wi
ll be included | 51 // to integer device coordinates, guaranteeing that the rasterized pixels wi
ll be included |
| 52 // in the computed bounds. | 52 // in the computed bounds. |
| 53 // Note: The device coordinate outset in SkBBoxHierarchyRecord::handleBBox i
s currently | 53 // Note: The device coordinate outset in SkBBoxHierarchyRecord::handleBBox i
s currently |
| 54 // done in the recording coordinate space, which is wrong. | 54 // done in the recording coordinate space, which is wrong. |
| 55 // http://code.google.com/p/skia/issues/detail?id=1021 | 55 // http://code.google.com/p/skia/issues/detail?id=1021 |
| 56 static const SkScalar kMinWidth = SkFloatToScalar(0.01f); | 56 static const SkScalar kMinWidth = 0.01f; |
| 57 SkScalar halfStrokeWidth = SkMaxScalar(paint.getStrokeWidth(), kMinWidth) /
2; | 57 SkScalar halfStrokeWidth = SkMaxScalar(paint.getStrokeWidth(), kMinWidth) /
2; |
| 58 bbox.outset(halfStrokeWidth, halfStrokeWidth); | 58 bbox.outset(halfStrokeWidth, halfStrokeWidth); |
| 59 if (this->transformBounds(bbox, &paint)) { | 59 if (this->transformBounds(bbox, &paint)) { |
| 60 INHERITED::drawPoints(mode, count, pts, paint); | 60 INHERITED::drawPoints(mode, count, pts, paint); |
| 61 } | 61 } |
| 62 } | 62 } |
| 63 | 63 |
| 64 void SkBBoxRecord::drawPaint(const SkPaint& paint) { | 64 void SkBBoxRecord::drawPaint(const SkPaint& paint) { |
| 65 SkRect bbox; | 65 SkRect bbox; |
| 66 if (this->getClipBounds(&bbox)) { | 66 if (this->getClipBounds(&bbox)) { |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 } | 286 } |
| 287 | 287 |
| 288 if (!outBounds.isEmpty() && !this->quickReject(outBounds)) { | 288 if (!outBounds.isEmpty() && !this->quickReject(outBounds)) { |
| 289 this->getTotalMatrix().mapRect(&outBounds); | 289 this->getTotalMatrix().mapRect(&outBounds); |
| 290 this->handleBBox(outBounds); | 290 this->handleBBox(outBounds); |
| 291 return true; | 291 return true; |
| 292 } | 292 } |
| 293 | 293 |
| 294 return false; | 294 return false; |
| 295 } | 295 } |
| OLD | NEW |