 Chromium Code Reviews
 Chromium Code Reviews Issue 494763004:
  Quick-reject draw text blob calls.  (Closed) 
  Base URL: https://skia.googlesource.com/skia.git@master
    
  
    Issue 494763004:
  Quick-reject draw text blob calls.  (Closed) 
  Base URL: https://skia.googlesource.com/skia.git@master| Index: src/core/SkCanvas.cpp | 
| diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp | 
| index af25b46f3f808f386a04387a14eb78a36fe418bd..c136c218b5840cdccc0e96f115d99c1e0f20b48a 100644 | 
| --- a/src/core/SkCanvas.cpp | 
| +++ b/src/core/SkCanvas.cpp | 
| @@ -2220,36 +2220,38 @@ void SkCanvas::onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y, | 
| const SkPaint& paint) { | 
| SkASSERT(blob); | 
| - // FIXME: dispatch to the device instead | 
| - | 
| if (x || y) { | 
| this->translate(x, y); | 
| } | 
| - SkPaint runPaint = paint; | 
| - SkTextBlob::RunIterator it(blob); | 
| - while (!it.done()) { | 
| - size_t textLen = it.glyphCount() * sizeof(uint16_t); | 
| - const SkPoint& offset = it.offset(); | 
| - // applyFontToPaint() always overwrites the exact same attributes, | 
| - // so it is safe to not re-seed the paint. | 
| - it.applyFontToPaint(&runPaint); | 
| + if (!this->quickReject(blob->bounds())) { | 
| + // FIXME: dispatch to the device instead | 
| 
reed1
2014/08/27 17:16:22
I don't think the device needs to do this.
Howeve
 
robertphillips
2014/08/27 17:25:30
The GPU device wants this.
 
f(malita)
2014/08/27 17:55:44
Done.
 | 
| - switch (it.positioning()) { | 
| - case SkTextBlob::kDefault_Positioning: | 
| - this->drawText(it.glyphs(), textLen, offset.x(), offset.y(), runPaint); | 
| - break; | 
| - case SkTextBlob::kHorizontal_Positioning: | 
| - this->drawPosTextH(it.glyphs(), textLen, it.pos(), offset.y(), runPaint); | 
| - break; | 
| - case SkTextBlob::kFull_Positioning: | 
| - this->drawPosText(it.glyphs(), textLen, (const SkPoint*)it.pos(), runPaint); | 
| - break; | 
| - default: | 
| - SkFAIL("unhandled positioning mode"); | 
| - } | 
| + SkPaint runPaint = paint; | 
| + SkTextBlob::RunIterator it(blob); | 
| + while (!it.done()) { | 
| + size_t textLen = it.glyphCount() * sizeof(uint16_t); | 
| + const SkPoint& offset = it.offset(); | 
| + // applyFontToPaint() always overwrites the exact same attributes, | 
| + // so it is safe to not re-seed the paint. | 
| + it.applyFontToPaint(&runPaint); | 
| - it.next(); | 
| + switch (it.positioning()) { | 
| + case SkTextBlob::kDefault_Positioning: | 
| + this->drawText(it.glyphs(), textLen, offset.x(), offset.y(), runPaint); | 
| + break; | 
| + case SkTextBlob::kHorizontal_Positioning: | 
| + this->drawPosTextH(it.glyphs(), textLen, it.pos(), offset.y(), runPaint); | 
| + break; | 
| + case SkTextBlob::kFull_Positioning: | 
| + this->drawPosText(it.glyphs(), textLen, (const SkPoint*)it.pos(), runPaint); | 
| + break; | 
| + default: | 
| + SkFAIL("unhandled positioning mode"); | 
| + } | 
| + | 
| + it.next(); | 
| + } | 
| } | 
| if (x || y) { |