OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 #define __STDC_LIMIT_MACROS | 7 #define __STDC_LIMIT_MACROS |
8 | 8 |
9 #include "SkDraw.h" | 9 #include "SkDraw.h" |
10 #include "SkBlitter.h" | 10 #include "SkBlitter.h" |
(...skipping 1470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1481 SkRegion::Cliperator clipper(*fClip, mask.fBounds); | 1481 SkRegion::Cliperator clipper(*fClip, mask.fBounds); |
1482 | 1482 |
1483 if (!clipper.done() && this->getImageData(glyph, &mask)) { | 1483 if (!clipper.done() && this->getImageData(glyph, &mask)) { |
1484 const SkIRect& cr = clipper.rect(); | 1484 const SkIRect& cr = clipper.rect(); |
1485 do { | 1485 do { |
1486 this->blitMask(mask, cr); | 1486 this->blitMask(mask, cr); |
1487 clipper.next(); | 1487 clipper.next(); |
1488 } while (!clipper.done()); | 1488 } while (!clipper.done()); |
1489 } | 1489 } |
1490 } else { | 1490 } else { |
1491 SkIRect storage; | 1491 SkIRect storage; |
1492 SkIRect* bounds = &mask.fBounds; | 1492 if (mask.fBounds.isEmpty() || |
reed1
2016/06/17 10:39:42
I wonder
1. if it would be clearer to put this e
| |
1493 | 1493 !storage.intersectNoEmptyCheck(mask.fBounds, fClipBounds)) { |
1494 // this extra test is worth it, assuming that most of the time it su cceeds | 1494 return; |
1495 // since we can avoid writing to storage | |
1496 if (!fClipBounds.containsNoEmptyCheck(mask.fBounds)) { | |
1497 if (!storage.intersectNoEmptyCheck(mask.fBounds, fClipBounds)) | |
1498 return; | |
1499 bounds = &storage; | |
1500 } | 1495 } |
1501 | 1496 |
1502 if (this->getImageData(glyph, &mask)) { | 1497 if (this->getImageData(glyph, &mask)) { |
1503 this->blitMask(mask, *bounds); | 1498 this->blitMask(mask, storage); |
1504 } | 1499 } |
1505 } | 1500 } |
1506 } | 1501 } |
1507 | 1502 |
1508 private: | 1503 private: |
1509 static bool UsingRegionToDraw(const SkRasterClip* rClip) { | 1504 static bool UsingRegionToDraw(const SkRasterClip* rClip) { |
1510 return rClip->isBW() && !rClip->isRect(); | 1505 return rClip->isBW() && !rClip->isRect(); |
1511 } | 1506 } |
1512 | 1507 |
1513 static SkIRect PickClipBounds(const SkDraw& draw) { | 1508 static SkIRect PickClipBounds(const SkDraw& draw) { |
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2076 mask->fImage = SkMask::AllocImage(size); | 2071 mask->fImage = SkMask::AllocImage(size); |
2077 memset(mask->fImage, 0, mask->computeImageSize()); | 2072 memset(mask->fImage, 0, mask->computeImageSize()); |
2078 } | 2073 } |
2079 | 2074 |
2080 if (SkMask::kJustComputeBounds_CreateMode != mode) { | 2075 if (SkMask::kJustComputeBounds_CreateMode != mode) { |
2081 draw_into_mask(*mask, devPath, style); | 2076 draw_into_mask(*mask, devPath, style); |
2082 } | 2077 } |
2083 | 2078 |
2084 return true; | 2079 return true; |
2085 } | 2080 } |
OLD | NEW |