Revert "Respect SkBitmapDeviceFilteredSurfaceProps in SkThreadedBMPDevice"

This reverts commit b9a1e688fd.

Reason for revert: breaking msan

Original change's description:
> Respect SkBitmapDeviceFilteredSurfaceProps in SkThreadedBMPDevice
> 
> Bug: skia:7909
> Change-Id: I3e480a57f16eec97706296137c8c1061555b9701
> Reviewed-on: https://skia-review.googlesource.com/126100
> Commit-Queue: Ben Wagner <bungeman@google.com>
> Commit-Queue: Yuqian Li <liyuqian@google.com>
> Reviewed-by: Ben Wagner <bungeman@google.com>
> Auto-Submit: Yuqian Li <liyuqian@google.com>

TBR=mtklein@google.com,bungeman@google.com,liyuqian@google.com

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: skia:7909
Change-Id: Iee605220721a8b9f74b652106d22b4516a87900a
Reviewed-on: https://skia-review.googlesource.com/126320
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
This commit is contained in:
Greg Daniel 2018-05-06 13:44:30 +00:00 committed by Skia Commit-Bot
parent 963d1ef8ac
commit 95e2b91d76
3 changed files with 22 additions and 20 deletions

View File

@ -567,6 +567,25 @@ void SkBitmapDevice::drawSprite(const SkBitmap& bitmap, int x, int y, const SkPa
BDDraw(this).drawSprite(bitmap, x, y, paint);
}
class SkBitmapDeviceFilteredSurfaceProps {
public:
SkBitmapDeviceFilteredSurfaceProps(const SkBitmap& bitmap, const SkPaint& paint,
const SkSurfaceProps& surfaceProps) {
if (kN32_SkColorType != bitmap.colorType() || !paint.isSrcOver()) {
SkSurfaceProps* newPaint = fLazy.init(surfaceProps.flags(), kUnknown_SkPixelGeometry);
fSurfaceProps = newPaint;
} else {
fSurfaceProps = &surfaceProps;
}
}
const SkSurfaceProps& operator()() const { return *fSurfaceProps; }
private:
const SkSurfaceProps* fSurfaceProps;
SkTLazy<SkSurfaceProps> fLazy;
};
void SkBitmapDevice::drawText(const void* text, size_t len,
SkScalar x, SkScalar y, const SkPaint& paint) {
SkBitmapDeviceFilteredSurfaceProps props(fBitmap, paint, fSurfaceProps);

View File

@ -179,20 +179,4 @@ private:
typedef SkBaseDevice INHERITED;
};
class SkBitmapDeviceFilteredSurfaceProps {
public:
SkBitmapDeviceFilteredSurfaceProps(const SkBitmap& bitmap, const SkPaint& paint,
const SkSurfaceProps& surfaceProps)
: fSurfaceProps((kN32_SkColorType != bitmap.colorType() || !paint.isSrcOver())
? fLazy.init(surfaceProps.flags(), kUnknown_SkPixelGeometry)
: &surfaceProps)
{ }
const SkSurfaceProps& operator()() const { return *fSurfaceProps; }
private:
SkTLazy<SkSurfaceProps> fLazy;
SkSurfaceProps const * const fSurfaceProps;
};
#endif // SkBitmapDevice_DEFINED

View File

@ -214,9 +214,9 @@ void SkThreadedBMPDevice::drawText(const void* text, size_t len, SkScalar x, SkS
const SkPaint& paint) {
char* clonedText = this->cloneArray((const char*)text, len);
SkRect drawBounds = SkRectPriv::MakeLargest(); // TODO tighter drawBounds
SkBitmapDeviceFilteredSurfaceProps props(fBitmap, paint, this->surfaceProps());
fQueue.push(drawBounds, [=](SkArenaAlloc*, const DrawState& ds, const SkIRect& tileBounds){
TileDraw(ds, tileBounds).drawText(clonedText, len, x, y, paint, &props());
TileDraw(ds, tileBounds).drawText(clonedText, len, x, y, paint,
&this->surfaceProps());
});
}
@ -225,10 +225,9 @@ void SkThreadedBMPDevice::drawPosText(const void* text, size_t len, const SkScal
char* clonedText = this->cloneArray((const char*)text, len);
SkScalar* clonedXpos = this->cloneArray(xpos, paint.countText(text, len) * scalarsPerPos);
SkRect drawBounds = SkRectPriv::MakeLargest(); // TODO tighter drawBounds
SkBitmapDeviceFilteredSurfaceProps props(fBitmap, paint, this->surfaceProps());
fQueue.push(drawBounds, [=](SkArenaAlloc*, const DrawState& ds, const SkIRect& tileBounds){
TileDraw(ds, tileBounds).drawPosText(clonedText, len, clonedXpos, scalarsPerPos, offset,
paint, &props());
paint, &surfaceProps());
});
}