aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Greg Daniel <egdaniel@google.com>2018-05-06 13:44:30 +0000
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-05-06 15:17:58 +0000
commit95e2b91d76d60ae69588ca700211146aabddbe5a (patch)
tree2ea8b137a61d7bb8bc2a3329929be38d68d25696
parent963d1ef8acad6861e1408bd60395a644f066c5be (diff)
Revert "Respect SkBitmapDeviceFilteredSurfaceProps in SkThreadedBMPDevice"
This reverts commit b9a1e688fd9c3e64c50d9159481e72a812f978c1. 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>
-rw-r--r--src/core/SkBitmapDevice.cpp19
-rw-r--r--src/core/SkBitmapDevice.h16
-rw-r--r--src/core/SkThreadedBMPDevice.cpp7
3 files changed, 22 insertions, 20 deletions
diff --git a/src/core/SkBitmapDevice.cpp b/src/core/SkBitmapDevice.cpp
index 522f016a2d..b49818c2a1 100644
--- a/src/core/SkBitmapDevice.cpp
+++ b/src/core/SkBitmapDevice.cpp
@@ -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);
diff --git a/src/core/SkBitmapDevice.h b/src/core/SkBitmapDevice.h
index 62b1063ba4..f80cba6ee4 100644
--- a/src/core/SkBitmapDevice.h
+++ b/src/core/SkBitmapDevice.h
@@ -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
diff --git a/src/core/SkThreadedBMPDevice.cpp b/src/core/SkThreadedBMPDevice.cpp
index b0ab478818..83ed614263 100644
--- a/src/core/SkThreadedBMPDevice.cpp
+++ b/src/core/SkThreadedBMPDevice.cpp
@@ -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());
});
}