return (matrix.getType() & ~mask) == 0;
}
-// return true if the config can possibly have per-pixel alpha, ignoring the
-// current setting of isOpaque.
-static bool canSupportPerPixelAlpha(const SkBitmap& bm) {
- // return true unless we're guaranteed to be opaque
- return bm.config() != SkBitmap::kRGB_565_Config;
-}
-
bool SkBitmapProcShader::setContext(const SkBitmap& device,
const SkPaint& paint,
const SkMatrix& matrix) {
const SkBitmap& bitmap = *fState.fBitmap;
bool bitmapIsOpaque = bitmap.isOpaque();
- // filtering doesn't guarantee that opaque stays opaque (finite precision)
- // so pretend we're not opaque if we're being asked to filter. If we had
- // more blit-procs, we could specialize on opaque src, and just OR in 0xFF
- // after the filter to be sure...
- /*
- (some time later)
- Adding check for canSupportPerPixelAlpha, since bitmaps that are 565
- (for example) will *always* be opaque, even after filtering.
-
- Would be really nice to never do this, if we could ensure that
- filtering didn't introduct non-opaqueness accidentally.
- */
- if (paint.isFilterBitmap() && canSupportPerPixelAlpha(bitmap)) {
- bitmapIsOpaque = false;
- }
-
// update fFlags
uint32_t flags = 0;
if (bitmapIsOpaque && (255 == this->getPaintAlpha())) {
#endif
#include "SkColorPriv.h"
+/*
+ Filter_32_opaque
+
+ There is no hard-n-fast rule that the filtering must produce
+ exact results for the color components, but if the 4 incoming colors are
+ all opaque, then the output color must also be opaque. Subsequent parts of
+ the drawing pipeline may rely on this (e.g. which blitrow proc to use).
+ */
+
#if defined(__ARM_HAVE_NEON) && !defined(SK_CPU_BENDIAN)
static inline void Filter_32_opaque_neon(unsigned x, unsigned y,
SkPMColor a00, SkPMColor a01,