Revert "explictly fail to draw unpremul, as this is buggy, incomplete, tricky, and unused"
This reverts commit 1baaacac74d24604e3dfca9857fbd647df375997.
Reason for revert: Failing the roll: https://storage.googleapis.com/chromium-layout-test-archives/linux_trusty_blink_rel/3868/layout-test-results/results.html
Original change's description:
> explictly fail to draw unpremul, as this is buggy, incomplete, tricky, and unused
>
> BUG=skia:
>
> Change-Id: Ie9da6015cc4955c0f27f6db53fc6ae532e0132f4
> Reviewed-on: https://skia-review.googlesource.com/7304
> Commit-Queue: Mike Reed <reed@google.com>
> Reviewed-by: Matt Sarett <msarett@google.com>
>
TBR=bsalomon@google.com,msarett@google.com,brianosman@google.com,reed@google.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:
Change-Id: Ifc808a430b8afe4fef6df3775c2bfdcede1a2dd7
Reviewed-on: https://skia-review.googlesource.com/7329
Commit-Queue: Joe Gregorio <jcgregorio@google.com>
Reviewed-by: Joe Gregorio <jcgregorio@google.com>
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index 367a348..0375ab7 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -53,12 +53,6 @@
#define RETURN_ON_NULL(ptr) do { if (nullptr == (ptr)) return; } while (0)
-#define RETURN_ON_UNPREMUL_IMAGE(image) \
- do { if (as_IB(image)->onAlphaType() == kUnpremul_SkAlphaType) return; } while (0)
-
-#define RETURN_ON_UNPREMUL_BITMAP(bitmap) \
- do { if (bitmap.alphaType() == kUnpremul_SkAlphaType) return; } while (0)
-
/*
* Return true if the drawing this rect would hit every pixels in the canvas.
*
@@ -1915,14 +1909,12 @@
void SkCanvas::drawImage(const SkImage* image, SkScalar x, SkScalar y, const SkPaint* paint) {
RETURN_ON_NULL(image);
- RETURN_ON_UNPREMUL_IMAGE(image);
this->onDrawImage(image, x, y, paint);
}
void SkCanvas::drawImageRect(const SkImage* image, const SkRect& src, const SkRect& dst,
const SkPaint* paint, SrcRectConstraint constraint) {
RETURN_ON_NULL(image);
- RETURN_ON_UNPREMUL_IMAGE(image);
if (dst.isEmpty() || src.isEmpty()) {
return;
}
@@ -1932,14 +1924,12 @@
void SkCanvas::drawImageRect(const SkImage* image, const SkIRect& isrc, const SkRect& dst,
const SkPaint* paint, SrcRectConstraint constraint) {
RETURN_ON_NULL(image);
- RETURN_ON_UNPREMUL_IMAGE(image);
this->drawImageRect(image, SkRect::Make(isrc), dst, paint, constraint);
}
void SkCanvas::drawImageRect(const SkImage* image, const SkRect& dst, const SkPaint* paint,
SrcRectConstraint constraint) {
RETURN_ON_NULL(image);
- RETURN_ON_UNPREMUL_IMAGE(image);
this->drawImageRect(image, SkRect::MakeIWH(image->width(), image->height()), dst, paint,
constraint);
}
@@ -1947,7 +1937,6 @@
void SkCanvas::drawImageNine(const SkImage* image, const SkIRect& center, const SkRect& dst,
const SkPaint* paint) {
RETURN_ON_NULL(image);
- RETURN_ON_UNPREMUL_IMAGE(image);
if (dst.isEmpty()) {
return;
}
@@ -1961,7 +1950,6 @@
void SkCanvas::drawImageLattice(const SkImage* image, const Lattice& lattice, const SkRect& dst,
const SkPaint* paint) {
RETURN_ON_NULL(image);
- RETURN_ON_UNPREMUL_IMAGE(image);
if (dst.isEmpty()) {
return;
}
@@ -1984,7 +1972,6 @@
if (bitmap.drawsNothing()) {
return;
}
- RETURN_ON_UNPREMUL_BITMAP(bitmap);
this->onDrawBitmap(bitmap, dx, dy, paint);
}
@@ -1993,7 +1980,6 @@
if (bitmap.drawsNothing() || dst.isEmpty() || src.isEmpty()) {
return;
}
- RETURN_ON_UNPREMUL_BITMAP(bitmap);
this->onDrawBitmapRect(bitmap, &src, dst, paint, constraint);
}
@@ -2013,7 +1999,6 @@
if (bitmap.drawsNothing() || dst.isEmpty()) {
return;
}
- RETURN_ON_UNPREMUL_BITMAP(bitmap);
if (SkLatticeIter::Valid(bitmap.width(), bitmap.height(), center)) {
this->onDrawBitmapNine(bitmap, center, dst, paint);
} else {
@@ -2026,7 +2011,6 @@
if (bitmap.drawsNothing() || dst.isEmpty()) {
return;
}
- RETURN_ON_UNPREMUL_BITMAP(bitmap);
SkIRect bounds;
Lattice latticePlusBounds = lattice;
@@ -2046,10 +2030,10 @@
const SkColor colors[], int count, SkBlendMode mode,
const SkRect* cull, const SkPaint* paint) {
RETURN_ON_NULL(atlas);
- RETURN_ON_UNPREMUL_IMAGE(atlas);
if (count <= 0) {
return;
}
+ SkASSERT(atlas);
SkASSERT(tex);
this->onDrawAtlas(atlas, xform, tex, colors, count, mode, cull, paint);
}