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 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 const uint16_t indices[], int indexCount, | 273 const uint16_t indices[], int indexCount, |
274 const SkPaint& paint) { | 274 const SkPaint& paint) { |
275 SkRect bbox; | 275 SkRect bbox; |
276 bbox.set(vertices, vertexCount); | 276 bbox.set(vertices, vertexCount); |
277 if (this->transformBounds(bbox, &paint)) { | 277 if (this->transformBounds(bbox, &paint)) { |
278 INHERITED::drawVertices(mode, vertexCount, vertices, texs, | 278 INHERITED::drawVertices(mode, vertexCount, vertices, texs, |
279 colors, xfer, indices, indexCount, paint); | 279 colors, xfer, indices, indexCount, paint); |
280 } | 280 } |
281 } | 281 } |
282 | 282 |
283 void SkBBoxRecord::drawPicture(SkPicture& picture) { | 283 void SkBBoxRecord::onDrawPicture(const SkPicture* picture) { |
284 if (picture.width() > 0 && picture.height() > 0 && | 284 if (picture->width() > 0 && picture->height() > 0 && |
285 this->transformBounds(SkRect::MakeWH(picture.width(), picture.height()),
NULL)) { | 285 this->transformBounds(SkRect::MakeWH(picture->width(), picture->height()
), NULL)) { |
286 INHERITED::drawPicture(picture); | 286 this->INHERITED::onDrawPicture(picture); |
287 } | 287 } |
288 } | 288 } |
289 | 289 |
290 bool SkBBoxRecord::transformBounds(const SkRect& bounds, const SkPaint* paint) { | 290 bool SkBBoxRecord::transformBounds(const SkRect& bounds, const SkPaint* paint) { |
291 SkRect outBounds = bounds; | 291 SkRect outBounds = bounds; |
292 outBounds.sort(); | 292 outBounds.sort(); |
293 | 293 |
294 if (paint) { | 294 if (paint) { |
295 // account for stroking, path effects, shadows, etc | 295 // account for stroking, path effects, shadows, etc |
296 if (paint->canComputeFastBounds()) { | 296 if (paint->canComputeFastBounds()) { |
297 SkRect temp; | 297 SkRect temp; |
298 outBounds = paint->computeFastBounds(outBounds, &temp); | 298 outBounds = paint->computeFastBounds(outBounds, &temp); |
299 } else { | 299 } else { |
300 // set bounds to current clip | 300 // set bounds to current clip |
301 if (!this->getClipBounds(&outBounds)) { | 301 if (!this->getClipBounds(&outBounds)) { |
302 // current clip is empty | 302 // current clip is empty |
303 return false; | 303 return false; |
304 } | 304 } |
305 } | 305 } |
306 } | 306 } |
307 | 307 |
308 if (!outBounds.isEmpty() && !this->quickReject(outBounds)) { | 308 if (!outBounds.isEmpty() && !this->quickReject(outBounds)) { |
309 this->getTotalMatrix().mapRect(&outBounds); | 309 this->getTotalMatrix().mapRect(&outBounds); |
310 this->handleBBox(outBounds); | 310 this->handleBBox(outBounds); |
311 return true; | 311 return true; |
312 } | 312 } |
313 | 313 |
314 return false; | 314 return false; |
315 } | 315 } |
OLD | NEW |