Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(835)

Unified Diff: src/core/SkScalerContext.cpp

Issue 1148793007: change SkDraw and all Blitters to use pixmap instead of bitmap (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkDraw.cpp ('k') | src/core/SkScan_Path.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkScalerContext.cpp
diff --git a/src/core/SkScalerContext.cpp b/src/core/SkScalerContext.cpp
index 7747cae0dfb297d80b2086cd906d22dc53080c8e..4ce42ddc077cef101215d1d96a3741f5a3cde54e 100644
--- a/src/core/SkScalerContext.cpp
+++ b/src/core/SkScalerContext.cpp
@@ -248,7 +248,7 @@ static void applyLUTToA8Mask(const SkMask& mask, const uint8_t* lut) {
}
template<bool APPLY_PREBLEND>
-static void pack4xHToLCD16(const SkBitmap& src, const SkMask& dst,
+static void pack4xHToLCD16(const SkPixmap& src, const SkMask& dst,
const SkMaskGamma::PreBlend& maskPreBlend) {
#define SAMPLES_PER_PIXEL 4
#define LCD_PER_PIXEL 3
@@ -291,7 +291,7 @@ static void pack4xHToLCD16(const SkBitmap& src, const SkMask& dst,
};
for (int y = 0; y < height; ++y) {
- const uint8_t* srcP = src.getAddr8(0, y);
+ const uint8_t* srcP = src.addr8(0, y);
// TODO: this fir filter implementation is straight forward, but slow.
// It should be possible to make it much faster.
@@ -406,29 +406,29 @@ static void generateMask(const SkMask& mask, const SkPath& path,
clip.setRect(SkIRect::MakeWH(dstW, dstH));
const SkImageInfo info = SkImageInfo::MakeA8(dstW, dstH);
- SkBitmap bm;
+ SkAutoPixmapStorage dst;
if (0 == dstRB) {
- if (!bm.tryAllocPixels(info)) {
+ if (!dst.tryAlloc(info)) {
// can't allocate offscreen, so empty the mask and return
sk_bzero(mask.fImage, mask.computeImageSize());
return;
}
} else {
- bm.installPixels(info, mask.fImage, dstRB);
+ dst.reset(info, mask.fImage, dstRB);
}
- sk_bzero(bm.getPixels(), bm.getSafeSize());
+ sk_bzero(dst.writable_addr(), dst.getSafeSize());
SkDraw draw;
+ draw.fDst = dst;
draw.fRC = &clip;
draw.fClip = &clip.bwRgn();
draw.fMatrix = &matrix;
- draw.fBitmap = &bm;
draw.drawPath(path, paint);
switch (mask.fFormat) {
case SkMask::kBW_Format:
- packA8ToA1(mask, bm.getAddr8(0, 0), bm.rowBytes());
+ packA8ToA1(mask, dst.addr8(0, 0), dst.rowBytes());
break;
case SkMask::kA8_Format:
if (maskPreBlend.isApplicable()) {
@@ -437,9 +437,9 @@ static void generateMask(const SkMask& mask, const SkPath& path,
break;
case SkMask::kLCD16_Format:
if (maskPreBlend.isApplicable()) {
- pack4xHToLCD16<true>(bm, mask, maskPreBlend);
+ pack4xHToLCD16<true>(dst, mask, maskPreBlend);
} else {
- pack4xHToLCD16<false>(bm, mask, maskPreBlend);
+ pack4xHToLCD16<false>(dst, mask, maskPreBlend);
}
break;
default:
« no previous file with comments | « src/core/SkDraw.cpp ('k') | src/core/SkScan_Path.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698