| 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 #include "SkPatchUtils.h" | 10 #include "SkPatchUtils.h" |
| 11 | 11 |
| 12 #include "SkTextBlob.h" |
| 13 |
| 12 SkBBoxRecord::~SkBBoxRecord() { | 14 SkBBoxRecord::~SkBBoxRecord() { |
| 13 fSaveStack.deleteAll(); | 15 fSaveStack.deleteAll(); |
| 14 } | 16 } |
| 15 | 17 |
| 16 void SkBBoxRecord::drawOval(const SkRect& rect, const SkPaint& paint) { | 18 void SkBBoxRecord::drawOval(const SkRect& rect, const SkPaint& paint) { |
| 17 if (this->transformBounds(rect, &paint)) { | 19 if (this->transformBounds(rect, &paint)) { |
| 18 INHERITED::drawOval(rect, paint); | 20 INHERITED::drawOval(rect, paint); |
| 19 } | 21 } |
| 20 } | 22 } |
| 21 | 23 |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 bbox.fLeft += pad; | 267 bbox.fLeft += pad; |
| 266 bbox.fRight -= pad; | 268 bbox.fRight -= pad; |
| 267 bbox.fTop += pad; | 269 bbox.fTop += pad; |
| 268 bbox.fBottom -= pad; | 270 bbox.fBottom -= pad; |
| 269 | 271 |
| 270 if (this->transformBounds(bbox, &paint)) { | 272 if (this->transformBounds(bbox, &paint)) { |
| 271 INHERITED::onDrawTextOnPath(text, byteLength, path, matrix, paint); | 273 INHERITED::onDrawTextOnPath(text, byteLength, path, matrix, paint); |
| 272 } | 274 } |
| 273 } | 275 } |
| 274 | 276 |
| 277 void SkBBoxRecord::onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y
, |
| 278 const SkPaint& paint) { |
| 279 SkRect bbox = blob->bounds(); |
| 280 bbox.offset(x, y); |
| 281 // FIXME: implement implicit blob bounds! |
| 282 if (bbox.isEmpty()) { |
| 283 this->getClipBounds(&bbox); |
| 284 } |
| 285 |
| 286 if (this->transformBounds(bbox, &paint)) { |
| 287 INHERITED::onDrawTextBlob(blob, x, y, paint); |
| 288 } |
| 289 } |
| 290 |
| 275 void SkBBoxRecord::drawVertices(VertexMode mode, int vertexCount, | 291 void SkBBoxRecord::drawVertices(VertexMode mode, int vertexCount, |
| 276 const SkPoint vertices[], const SkPoint texs[], | 292 const SkPoint vertices[], const SkPoint texs[], |
| 277 const SkColor colors[], SkXfermode* xfer, | 293 const SkColor colors[], SkXfermode* xfer, |
| 278 const uint16_t indices[], int indexCount, | 294 const uint16_t indices[], int indexCount, |
| 279 const SkPaint& paint) { | 295 const SkPaint& paint) { |
| 280 SkRect bbox; | 296 SkRect bbox; |
| 281 bbox.set(vertices, vertexCount); | 297 bbox.set(vertices, vertexCount); |
| 282 if (this->transformBounds(bbox, &paint)) { | 298 if (this->transformBounds(bbox, &paint)) { |
| 283 INHERITED::drawVertices(mode, vertexCount, vertices, texs, | 299 INHERITED::drawVertices(mode, vertexCount, vertices, texs, |
| 284 colors, xfer, indices, indexCount, paint); | 300 colors, xfer, indices, indexCount, paint); |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 } | 372 } |
| 357 | 373 |
| 358 if (!outBounds.isEmpty() && !this->quickReject(outBounds)) { | 374 if (!outBounds.isEmpty() && !this->quickReject(outBounds)) { |
| 359 this->getTotalMatrix().mapRect(&outBounds); | 375 this->getTotalMatrix().mapRect(&outBounds); |
| 360 this->handleBBox(outBounds); | 376 this->handleBBox(outBounds); |
| 361 return true; | 377 return true; |
| 362 } | 378 } |
| 363 | 379 |
| 364 return false; | 380 return false; |
| 365 } | 381 } |
| OLD | NEW |