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 | 11 |
11 SkBBoxRecord::~SkBBoxRecord() { | 12 SkBBoxRecord::~SkBBoxRecord() { |
12 fSaveStack.deleteAll(); | 13 fSaveStack.deleteAll(); |
13 } | 14 } |
14 | 15 |
15 void SkBBoxRecord::drawOval(const SkRect& rect, const SkPaint& paint) { | 16 void SkBBoxRecord::drawOval(const SkRect& rect, const SkPaint& paint) { |
16 if (this->transformBounds(rect, &paint)) { | 17 if (this->transformBounds(rect, &paint)) { |
17 INHERITED::drawOval(rect, paint); | 18 INHERITED::drawOval(rect, paint); |
18 } | 19 } |
19 } | 20 } |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 const uint16_t indices[], int indexCount, | 278 const uint16_t indices[], int indexCount, |
278 const SkPaint& paint) { | 279 const SkPaint& paint) { |
279 SkRect bbox; | 280 SkRect bbox; |
280 bbox.set(vertices, vertexCount); | 281 bbox.set(vertices, vertexCount); |
281 if (this->transformBounds(bbox, &paint)) { | 282 if (this->transformBounds(bbox, &paint)) { |
282 INHERITED::drawVertices(mode, vertexCount, vertices, texs, | 283 INHERITED::drawVertices(mode, vertexCount, vertices, texs, |
283 colors, xfer, indices, indexCount, paint); | 284 colors, xfer, indices, indexCount, paint); |
284 } | 285 } |
285 } | 286 } |
286 | 287 |
287 void SkBBoxRecord::drawPatch(const SkPatch& patch, const SkPaint& paint) { | 288 void SkBBoxRecord::onDrawPatch(const SkPoint cubics[12], const SkColor colors[4]
, |
288 const SkPoint* points = patch.getControlPoints(); | 289 const SkPoint texCoords[4], SkXfermode* xmode, |
| 290 const SkPaint& paint) { |
289 SkRect bbox; | 291 SkRect bbox; |
290 bbox.set(points, SkPatch::kNumCtrlPts); | 292 bbox.set(cubics, SkPatchUtils::kNumCtrlPts); |
291 if (this->transformBounds(bbox, &paint)) { | 293 if (this->transformBounds(bbox, &paint)) { |
292 INHERITED::drawPatch(patch, paint); | 294 INHERITED::onDrawPatch(cubics, colors, texCoords, xmode, paint); |
293 } | 295 } |
294 } | 296 } |
295 | 297 |
296 void SkBBoxRecord::onDrawPicture(const SkPicture* picture, const SkMatrix* matri
x, | 298 void SkBBoxRecord::onDrawPicture(const SkPicture* picture, const SkMatrix* matri
x, |
297 const SkPaint* paint) { | 299 const SkPaint* paint) { |
298 SkRect bounds = SkRect::MakeWH(SkIntToScalar(picture->width()), | 300 SkRect bounds = SkRect::MakeWH(SkIntToScalar(picture->width()), |
299 SkIntToScalar(picture->height())); | 301 SkIntToScalar(picture->height())); |
300 // todo: wonder if we should allow passing an optional matrix to transformBo
unds so we don't | 302 // todo: wonder if we should allow passing an optional matrix to transformBo
unds so we don't |
301 // end up transforming the rect twice. | 303 // end up transforming the rect twice. |
302 if (matrix) { | 304 if (matrix) { |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 } | 356 } |
355 | 357 |
356 if (!outBounds.isEmpty() && !this->quickReject(outBounds)) { | 358 if (!outBounds.isEmpty() && !this->quickReject(outBounds)) { |
357 this->getTotalMatrix().mapRect(&outBounds); | 359 this->getTotalMatrix().mapRect(&outBounds); |
358 this->handleBBox(outBounds); | 360 this->handleBBox(outBounds); |
359 return true; | 361 return true; |
360 } | 362 } |
361 | 363 |
362 return false; | 364 return false; |
363 } | 365 } |
OLD | NEW |