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 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 | 286 |
287 void SkBBoxRecord::drawPatch(const SkPatch& patch, const SkPaint& paint) { | 287 void SkBBoxRecord::drawPatch(const SkPatch& patch, const SkPaint& paint) { |
288 const SkPoint* points = patch.getControlPoints(); | 288 const SkPoint* points = patch.getControlPoints(); |
289 SkRect bbox; | 289 SkRect bbox; |
290 bbox.set(points, SkPatch::kNumCtrlPts); | 290 bbox.set(points, SkPatch::kNumCtrlPts); |
291 if (this->transformBounds(bbox, &paint)) { | 291 if (this->transformBounds(bbox, &paint)) { |
292 INHERITED::drawPatch(patch, paint); | 292 INHERITED::drawPatch(patch, paint); |
293 } | 293 } |
294 } | 294 } |
295 | 295 |
296 void SkBBoxRecord::onDrawPicture(const SkPicture* picture) { | 296 void SkBBoxRecord::onDrawPicture(const SkPicture* picture, const SkMatrix* matri
x, |
297 if (picture->width() > 0 && picture->height() > 0 && | 297 const SkPaint* paint) { |
298 this->transformBounds(SkRect::MakeWH(picture->width(), picture->height()
), NULL)) { | 298 SkRect bounds = SkRect::MakeWH(SkIntToScalar(picture->width()), |
299 this->INHERITED::onDrawPicture(picture); | 299 SkIntToScalar(picture->height())); |
| 300 // todo: wonder if we should allow passing an optional matrix to transformBo
unds so we don't |
| 301 // end up transforming the rect twice. |
| 302 if (matrix) { |
| 303 matrix->mapRect(&bounds); |
| 304 } |
| 305 if (this->transformBounds(bounds, paint)) { |
| 306 this->INHERITED::onDrawPicture(picture, matrix, paint); |
300 } | 307 } |
301 } | 308 } |
302 | 309 |
303 void SkBBoxRecord::willSave() { | 310 void SkBBoxRecord::willSave() { |
304 fSaveStack.push(NULL); | 311 fSaveStack.push(NULL); |
305 this->INHERITED::willSave(); | 312 this->INHERITED::willSave(); |
306 } | 313 } |
307 | 314 |
308 SkCanvas::SaveLayerStrategy SkBBoxRecord::willSaveLayer(const SkRect* bounds, | 315 SkCanvas::SaveLayerStrategy SkBBoxRecord::willSaveLayer(const SkRect* bounds, |
309 const SkPaint* paint, | 316 const SkPaint* paint, |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 } | 354 } |
348 | 355 |
349 if (!outBounds.isEmpty() && !this->quickReject(outBounds)) { | 356 if (!outBounds.isEmpty() && !this->quickReject(outBounds)) { |
350 this->getTotalMatrix().mapRect(&outBounds); | 357 this->getTotalMatrix().mapRect(&outBounds); |
351 this->handleBBox(outBounds); | 358 this->handleBBox(outBounds); |
352 return true; | 359 return true; |
353 } | 360 } |
354 | 361 |
355 return false; | 362 return false; |
356 } | 363 } |
OLD | NEW |