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 1458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1469 mask.fBounds.set(left, top, right, bottom); | 1469 mask.fBounds.set(left, top, right, bottom); |
1470 | 1470 |
1471 // this extra test is worth it, assuming that most of the time it succeeds | 1471 // this extra test is worth it, assuming that most of the time it succeeds |
1472 // since we can avoid writing to storage | 1472 // since we can avoid writing to storage |
1473 if (!state.fClipBounds.containsNoEmptyCheck(left, top, right, bottom)) { | 1473 if (!state.fClipBounds.containsNoEmptyCheck(left, top, right, bottom)) { |
1474 if (!storage.intersectNoEmptyCheck(mask.fBounds, state.fClipBounds)) | 1474 if (!storage.intersectNoEmptyCheck(mask.fBounds, state.fClipBounds)) |
1475 return; | 1475 return; |
1476 bounds = &storage; | 1476 bounds = &storage; |
1477 } | 1477 } |
1478 | 1478 |
1479 uint8_t* aa = (uint8_t*)glyph.fImage; | 1479 uint8_t*aa = (uint8_t*)state.fCache->findImage(glyph); |
1480 if (nullptr == aa) { | 1480 if (nullptr == aa) { |
1481 aa = (uint8_t*)state.fCache->findImage(glyph); | 1481 return; // can't rasterize glyph |
1482 if (nullptr == aa) { | |
1483 return; // can't rasterize glyph | |
1484 } | |
1485 } | 1482 } |
1486 | 1483 |
| 1484 |
1487 mask.fRowBytes = glyph.rowBytes(); | 1485 mask.fRowBytes = glyph.rowBytes(); |
1488 mask.fFormat = static_cast<SkMask::Format>(glyph.fMaskFormat); | 1486 mask.fFormat = static_cast<SkMask::Format>(glyph.fMaskFormat); |
1489 mask.fImage = aa; | 1487 mask.fImage = aa; |
1490 state.blitMask(mask, *bounds); | 1488 state.blitMask(mask, *bounds); |
1491 } | 1489 } |
1492 | 1490 |
1493 static void D1G_RgnClip(const SkDraw1Glyph& state, Sk48Dot16 fx, Sk48Dot16 fy, c
onst SkGlyph& glyph) { | 1491 static void D1G_RgnClip(const SkDraw1Glyph& state, Sk48Dot16 fx, Sk48Dot16 fy, c
onst SkGlyph& glyph) { |
1494 int left = Sk48Dot16FloorToInt(fx); | 1492 int left = Sk48Dot16FloorToInt(fx); |
1495 int top = Sk48Dot16FloorToInt(fy); | 1493 int top = Sk48Dot16FloorToInt(fy); |
1496 SkASSERT(glyph.fWidth > 0 && glyph.fHeight > 0); | 1494 SkASSERT(glyph.fWidth > 0 && glyph.fHeight > 0); |
(...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2260 mask->fImage = SkMask::AllocImage(size); | 2258 mask->fImage = SkMask::AllocImage(size); |
2261 memset(mask->fImage, 0, mask->computeImageSize()); | 2259 memset(mask->fImage, 0, mask->computeImageSize()); |
2262 } | 2260 } |
2263 | 2261 |
2264 if (SkMask::kJustComputeBounds_CreateMode != mode) { | 2262 if (SkMask::kJustComputeBounds_CreateMode != mode) { |
2265 draw_into_mask(*mask, devPath, style); | 2263 draw_into_mask(*mask, devPath, style); |
2266 } | 2264 } |
2267 | 2265 |
2268 return true; | 2266 return true; |
2269 } | 2267 } |
OLD | NEW |