aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--bench/BitmapBench.cpp2
-rw-r--r--bench/RepeatTileBench.cpp1
-rw-r--r--gm/tilemodes.cpp1
-rw-r--r--gyp/SampleApp.gyp1
-rw-r--r--gyp/core.gypi2
-rw-r--r--include/core/SkBlitRow.h1
-rw-r--r--include/core/SkXfermode.h4
-rw-r--r--include/effects/SkAvoidXfermode.h2
-rw-r--r--samplecode/SampleStrokeText.cpp147
-rw-r--r--samplecode/SampleTiling.cpp1
-rw-r--r--src/core/SkBitmap.cpp14
-rw-r--r--src/core/SkBlitRow_D16.cpp8
-rw-r--r--src/core/SkBlitRow_D4444.cpp218
-rw-r--r--src/core/SkBlitter.cpp4
-rw-r--r--src/core/SkBlitter_4444.cpp480
-rw-r--r--src/core/SkCanvas.cpp15
-rw-r--r--src/core/SkCoreBlitters.h6
-rw-r--r--src/core/SkDevice.cpp2
-rw-r--r--src/core/SkDraw.cpp7
-rw-r--r--src/core/SkXfermode.cpp54
-rw-r--r--src/effects/SkAvoidXfermode.cpp53
-rw-r--r--src/effects/SkTransparentShader.cpp16
-rw-r--r--src/gpu/gl/GrGpuGL.cpp6
-rw-r--r--src/opts/SkBlitRow_opts_arm.h2
-rw-r--r--src/opts/opts_check_SSE2.cpp4
-rw-r--r--src/utils/mac/SkBitmap_Mac.cpp149
-rw-r--r--tests/ARGBImageEncoderTest.cpp1
-rw-r--r--tests/BitmapCopyTest.cpp8
-rw-r--r--tests/BitmapGetColorTest.cpp2
-rw-r--r--tests/BitmapHasherTest.cpp4
-rw-r--r--tests/GpuBitmapCopyTest.cpp3
31 files changed, 15 insertions, 1203 deletions
diff --git a/bench/BitmapBench.cpp b/bench/BitmapBench.cpp
index 6091d46766..3bf6b779cb 100644
--- a/bench/BitmapBench.cpp
+++ b/bench/BitmapBench.cpp
@@ -374,8 +374,6 @@ private:
DEF_BENCH( return new BitmapBench(p, false, SkBitmap::kARGB_8888_Config); )
DEF_BENCH( return new BitmapBench(p, true, SkBitmap::kARGB_8888_Config); )
DEF_BENCH( return new BitmapBench(p, true, SkBitmap::kRGB_565_Config); )
-DEF_BENCH( return new BitmapBench(p, false, SkBitmap::kARGB_4444_Config); )
-DEF_BENCH( return new BitmapBench(p, true, SkBitmap::kARGB_4444_Config); )
DEF_BENCH( return new BitmapBench(p, false, SkBitmap::kIndex8_Config); )
DEF_BENCH( return new BitmapBench(p, true, SkBitmap::kIndex8_Config); )
DEF_BENCH( return new BitmapBench(p, true, SkBitmap::kARGB_8888_Config, true, true); )
diff --git a/bench/RepeatTileBench.cpp b/bench/RepeatTileBench.cpp
index 5235696abc..11dd6f899b 100644
--- a/bench/RepeatTileBench.cpp
+++ b/bench/RepeatTileBench.cpp
@@ -138,5 +138,4 @@ private:
DEF_BENCH(return new RepeatTileBench(p, SkBitmap::kARGB_8888_Config, true))
DEF_BENCH(return new RepeatTileBench(p, SkBitmap::kARGB_8888_Config, false))
DEF_BENCH(return new RepeatTileBench(p, SkBitmap::kRGB_565_Config))
-DEF_BENCH(return new RepeatTileBench(p, SkBitmap::kARGB_4444_Config))
DEF_BENCH(return new RepeatTileBench(p, SkBitmap::kIndex8_Config))
diff --git a/gm/tilemodes.cpp b/gm/tilemodes.cpp
index d5501b0dfb..a11ff4ebb9 100644
--- a/gm/tilemodes.cpp
+++ b/gm/tilemodes.cpp
@@ -53,7 +53,6 @@ static void setup(SkPaint* paint, const SkBitmap& bm, bool filter,
static const SkBitmap::Config gConfigs[] = {
SkBitmap::kARGB_8888_Config,
SkBitmap::kRGB_565_Config,
- SkBitmap::kARGB_4444_Config
};
static const int gWidth = 32;
static const int gHeight = 32;
diff --git a/gyp/SampleApp.gyp b/gyp/SampleApp.gyp
index 644121f967..f8ba9629b2 100644
--- a/gyp/SampleApp.gyp
+++ b/gyp/SampleApp.gyp
@@ -99,7 +99,6 @@
'../samplecode/SampleSkLayer.cpp',
'../samplecode/SampleSlides.cpp',
'../samplecode/SampleStrokePath.cpp',
- '../samplecode/SampleStrokeText.cpp',
'../samplecode/SampleTests.cpp',
'../samplecode/SampleText.cpp',
'../samplecode/SampleTextAlpha.cpp',
diff --git a/gyp/core.gypi b/gyp/core.gypi
index a88f7223af..270323150c 100644
--- a/gyp/core.gypi
+++ b/gyp/core.gypi
@@ -38,10 +38,8 @@
'<(skia_src_path)/core/SkBlitMask_D32.cpp',
'<(skia_src_path)/core/SkBlitRow_D16.cpp',
'<(skia_src_path)/core/SkBlitRow_D32.cpp',
- '<(skia_src_path)/core/SkBlitRow_D4444.cpp',
'<(skia_src_path)/core/SkBlitter.h',
'<(skia_src_path)/core/SkBlitter.cpp',
- '<(skia_src_path)/core/SkBlitter_4444.cpp',
'<(skia_src_path)/core/SkBlitter_A1.cpp',
'<(skia_src_path)/core/SkBlitter_A8.cpp',
'<(skia_src_path)/core/SkBlitter_ARGB32.cpp',
diff --git a/include/core/SkBlitRow.h b/include/core/SkBlitRow.h
index febc405f29..501134238f 100644
--- a/include/core/SkBlitRow.h
+++ b/include/core/SkBlitRow.h
@@ -92,7 +92,6 @@ public:
static Proc32 PlatformProcs32(unsigned flags);
static Proc PlatformProcs565(unsigned flags);
- static Proc PlatformProcs4444(unsigned flags);
static ColorProc PlatformColorProc();
private:
diff --git a/include/core/SkXfermode.h b/include/core/SkXfermode.h
index 03ca1014e6..ef00f71b75 100644
--- a/include/core/SkXfermode.h
+++ b/include/core/SkXfermode.h
@@ -36,8 +36,6 @@ public:
const SkAlpha aa[]) const;
virtual void xfer16(uint16_t dst[], const SkPMColor src[], int count,
const SkAlpha aa[]) const;
- virtual void xfer4444(uint16_t dst[], const SkPMColor src[], int count,
- const SkAlpha aa[]) const;
virtual void xferA8(SkAlpha dst[], const SkPMColor src[], int count,
const SkAlpha aa[]) const;
@@ -258,8 +256,6 @@ public:
const SkAlpha aa[]) const SK_OVERRIDE;
virtual void xfer16(uint16_t dst[], const SkPMColor src[], int count,
const SkAlpha aa[]) const SK_OVERRIDE;
- virtual void xfer4444(uint16_t dst[], const SkPMColor src[], int count,
- const SkAlpha aa[]) const SK_OVERRIDE;
virtual void xferA8(SkAlpha dst[], const SkPMColor src[], int count,
const SkAlpha aa[]) const SK_OVERRIDE;
diff --git a/include/effects/SkAvoidXfermode.h b/include/effects/SkAvoidXfermode.h
index e35439160e..4950b64707 100644
--- a/include/effects/SkAvoidXfermode.h
+++ b/include/effects/SkAvoidXfermode.h
@@ -44,8 +44,6 @@ public:
const SkAlpha aa[]) const SK_OVERRIDE;
virtual void xfer16(uint16_t dst[], const SkPMColor src[], int count,
const SkAlpha aa[]) const SK_OVERRIDE;
- virtual void xfer4444(uint16_t dst[], const SkPMColor src[], int count,
- const SkAlpha aa[]) const SK_OVERRIDE;
virtual void xferA8(SkAlpha dst[], const SkPMColor src[], int count,
const SkAlpha aa[]) const SK_OVERRIDE;
diff --git a/samplecode/SampleStrokeText.cpp b/samplecode/SampleStrokeText.cpp
deleted file mode 100644
index aa19017964..0000000000
--- a/samplecode/SampleStrokeText.cpp
+++ /dev/null
@@ -1,147 +0,0 @@
-
-/*
- * Copyright 2011 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-#include "SampleCode.h"
-#include "SkView.h"
-#include "SkCanvas.h"
-#include "Sk64.h"
-#include "SkGradientShader.h"
-#include "SkGraphics.h"
-#include "SkImageDecoder.h"
-#include "SkKernel33MaskFilter.h"
-#include "SkPath.h"
-#include "SkRandom.h"
-#include "SkRegion.h"
-#include "SkShader.h"
-#include "SkUtils.h"
-#include "SkColorPriv.h"
-#include "SkColorFilter.h"
-#include "SkTime.h"
-#include "SkTypeface.h"
-#include "SkXfermode.h"
-
-static void lettersToBitmap(SkBitmap* dst, const char chars[],
- const SkPaint& original, SkBitmap::Config config) {
- SkPath path;
- SkScalar x = 0;
- SkScalar width;
- SkPath p;
- for (size_t i = 0; i < strlen(chars); i++) {
- original.getTextPath(&chars[i], 1, x, 0, &p);
- path.addPath(p);
- original.getTextWidths(&chars[i], 1, &width);
- x += width;
- }
- SkRect bounds = path.getBounds();
- SkScalar sw = -original.getStrokeWidth();
- bounds.inset(sw, sw);
- path.offset(-bounds.fLeft, -bounds.fTop);
- bounds.offset(-bounds.fLeft, -bounds.fTop);
-
- int w = SkScalarRound(bounds.width());
- int h = SkScalarRound(bounds.height());
- SkPaint paint(original);
- SkBitmap src;
- src.setConfig(config, w, h);
- src.allocPixels();
- src.eraseColor(SK_ColorTRANSPARENT);
- {
- SkCanvas canvas(src);
- paint.setAntiAlias(true);
- paint.setColor(SK_ColorBLACK);
- paint.setStyle(SkPaint::kFill_Style);
- canvas.drawPath(path, paint);
- }
-
- dst->setConfig(config, w, h);
- dst->allocPixels();
- dst->eraseColor(SK_ColorWHITE);
- {
- SkCanvas canvas(*dst);
- paint.setXfermodeMode(SkXfermode::kDstATop_Mode);
- canvas.drawBitmap(src, 0, 0, &paint);
- paint.setColor(original.getColor());
- paint.setStyle(SkPaint::kStroke_Style);
- canvas.drawPath(path, paint);
- }
-}
-
-static void lettersToBitmap2(SkBitmap* dst, const char chars[],
- const SkPaint& original, SkBitmap::Config config) {
- SkPath path;
- SkScalar x = 0;
- SkScalar width;
- SkPath p;
- for (size_t i = 0; i < strlen(chars); i++) {
- original.getTextPath(&chars[i], 1, x, 0, &p);
- path.addPath(p);
- original.getTextWidths(&chars[i], 1, &width);
- x += width;
- }
- SkRect bounds = path.getBounds();
- SkScalar sw = -original.getStrokeWidth();
- bounds.inset(sw, sw);
- path.offset(-bounds.fLeft, -bounds.fTop);
- bounds.offset(-bounds.fLeft, -bounds.fTop);
-
- int w = SkScalarRound(bounds.width());
- int h = SkScalarRound(bounds.height());
- SkPaint paint(original);
-
- paint.setAntiAlias(true);
- paint.setXfermodeMode(SkXfermode::kDstATop_Mode);
- paint.setColor(original.getColor());
- paint.setStyle(SkPaint::kStroke_Style);
-
- dst->setConfig(config, w, h);
- dst->allocPixels();
- dst->eraseColor(SK_ColorWHITE);
-
- SkCanvas canvas(*dst);
- canvas.drawPath(path, paint);
-}
-
-class StrokeTextView : public SampleView {
-public:
- StrokeTextView() {
- this->setBGColor(0xFFCC8844);
- }
-
-protected:
- // overrides from SkEventSink
- virtual bool onQuery(SkEvent* evt) {
- if (SampleCode::TitleQ(*evt)) {
- SampleCode::TitleR(evt, "StrokeText");
- return true;
- }
- return this->INHERITED::onQuery(evt);
- }
-
- virtual void onDrawContent(SkCanvas* canvas) {
- SkBitmap bm;
- SkPaint paint;
-
- paint.setStrokeWidth(SkIntToScalar(6));
- paint.setTextSize(SkIntToScalar(80));
-// paint.setTypeface(Typeface.DEFAULT_BOLD);
-
- lettersToBitmap(&bm, "Test Case", paint, SkBitmap::kARGB_4444_Config);
- if (false) { // avoid bit rot, suppress warning
- lettersToBitmap2(&bm, "Test Case", paint, SkBitmap::kARGB_4444_Config);
- }
- canvas->drawBitmap(bm, 0, 0);
- }
-
-private:
-
- typedef SampleView INHERITED;
-};
-
-//////////////////////////////////////////////////////////////////////////////
-
-static SkView* MyFactory() { return new StrokeTextView; }
-static SkViewRegister reg(MyFactory);
diff --git a/samplecode/SampleTiling.cpp b/samplecode/SampleTiling.cpp
index 5c2a352f1a..69c7710636 100644
--- a/samplecode/SampleTiling.cpp
+++ b/samplecode/SampleTiling.cpp
@@ -57,7 +57,6 @@ static void setup(SkPaint* paint, const SkBitmap& bm, bool filter,
static const SkBitmap::Config gConfigs[] = {
SkBitmap::kARGB_8888_Config,
SkBitmap::kRGB_565_Config,
- SkBitmap::kARGB_4444_Config
};
static const int gWidth = 32;
static const int gHeight = 32;
diff --git a/src/core/SkBitmap.cpp b/src/core/SkBitmap.cpp
index b53e4bc350..da7bff8f8a 100644
--- a/src/core/SkBitmap.cpp
+++ b/src/core/SkBitmap.cpp
@@ -793,17 +793,11 @@ void SkBitmap::eraseARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b) const {
}
break;
}
- case kARGB_4444_Config:
case kRGB_565_Config: {
uint16_t* p = (uint16_t*)fPixels;
- uint16_t v;
-
- if (kARGB_4444_Config == fConfig) {
- v = SkPackARGB4444(a >> 4, r >> 4, g >> 4, b >> 4);
- } else { // kRGB_565_Config
- v = SkPackRGB16(r >> (8 - SK_R16_BITS), g >> (8 - SK_G16_BITS),
- b >> (8 - SK_B16_BITS));
- }
+ uint16_t v = SkPackRGB16(r >> (8 - SK_R16_BITS),
+ g >> (8 - SK_G16_BITS),
+ b >> (8 - SK_B16_BITS));
while (--height >= 0) {
sk_memset16(p, v, width);
p = (uint16_t*)((char*)p + rowBytes);
@@ -1005,12 +999,12 @@ bool SkBitmap::canCopyTo(Config dstConfig) const {
bool sameConfigs = (this->config() == dstConfig);
switch (dstConfig) {
case kA8_Config:
- case kARGB_4444_Config:
case kRGB_565_Config:
case kARGB_8888_Config:
break;
case kA1_Config:
case kIndex8_Config:
+ case kARGB_4444_Config:
if (!sameConfigs) {
return false;
}
diff --git a/src/core/SkBlitRow_D16.cpp b/src/core/SkBlitRow_D16.cpp
index 309e459c2e..e244723986 100644
--- a/src/core/SkBlitRow_D16.cpp
+++ b/src/core/SkBlitRow_D16.cpp
@@ -224,8 +224,6 @@ static const SkBlitRow::Proc gDefault_565_Procs[] = {
S32A_D565_Blend_Dither
};
-extern SkBlitRow::Proc SkBlitRow_Factory_4444(unsigned flags);
-
SkBlitRow::Proc SkBlitRow::Factory(unsigned flags, SkBitmap::Config config) {
SkASSERT(flags < SK_ARRAY_COUNT(gDefault_565_Procs));
// just so we don't crash
@@ -240,12 +238,6 @@ SkBlitRow::Proc SkBlitRow::Factory(unsigned flags, SkBitmap::Config config) {
proc = gDefault_565_Procs[flags];
}
break;
- case SkBitmap::kARGB_4444_Config:
- proc = PlatformProcs4444(flags);
- if (NULL == proc) {
- proc = SkBlitRow_Factory_4444(flags);
- }
- break;
default:
break;
}
diff --git a/src/core/SkBlitRow_D4444.cpp b/src/core/SkBlitRow_D4444.cpp
deleted file mode 100644
index 026d156376..0000000000
--- a/src/core/SkBlitRow_D4444.cpp
+++ /dev/null
@@ -1,218 +0,0 @@
-/*
- * Copyright 2011 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "SkBlitRow.h"
-#include "SkColorPriv.h"
-#include "SkDither.h"
-
-///////////////////////////////////////////////////////////////////////////////
-
-static void S32_D4444_Opaque(uint16_t* SK_RESTRICT dst,
- const SkPMColor* SK_RESTRICT src, int count,
- U8CPU alpha, int /*x*/, int /*y*/) {
- SkASSERT(255 == alpha);
-
- if (count > 0) {
- do {
- SkPMColor c = *src++;
- SkPMColorAssert(c);
- SkASSERT(SkGetPackedA32(c) == 255);
- *dst++ = SkPixel32ToPixel4444(c);
- } while (--count != 0);
- }
-}
-
-static void S32_D4444_Blend(uint16_t* SK_RESTRICT dst,
- const SkPMColor* SK_RESTRICT src, int count,
- U8CPU alpha, int /*x*/, int /*y*/) {
- SkASSERT(255 > alpha);
-
- if (count > 0) {
- unsigned scale16 = SkAlpha255To256(alpha) >> 4;
- do {
- SkPMColor c = *src++;
- SkPMColorAssert(c);
- SkASSERT(SkGetPackedA32(c) == 255);
-
- uint32_t src_expand = SkExpand32_4444(c);
- uint32_t dst_expand = SkExpand_4444(*dst);
- dst_expand += (src_expand - dst_expand) * scale16 >> 4;
- *dst++ = SkCompact_4444(dst_expand);
- } while (--count != 0);
- }
-}
-
-static void S32A_D4444_Opaque(uint16_t* SK_RESTRICT dst,
- const SkPMColor* SK_RESTRICT src, int count,
- U8CPU alpha, int /*x*/, int /*y*/) {
- SkASSERT(255 == alpha);
-
- if (count > 0) {
- do {
- SkPMColor c = *src++;
- SkPMColorAssert(c);
-// if (__builtin_expect(c!=0, 1))
- if (c)
- {
- unsigned scale16 = SkAlpha255To256(255 - SkGetPackedA32(c)) >> 4;
- uint32_t src_expand = SkExpand_8888(c);
- uint32_t dst_expand = SkExpand_4444(*dst) * scale16;
- *dst = SkCompact_4444((src_expand + dst_expand) >> 4);
- }
- dst += 1;
- } while (--count != 0);
- }
-}
-
-static void S32A_D4444_Blend(uint16_t* SK_RESTRICT dst,
- const SkPMColor* SK_RESTRICT src, int count,
- U8CPU alpha, int /*x*/, int /*y*/) {
- SkASSERT(255 > alpha);
-
- if (count > 0) {
- int src_scale = SkAlpha255To256(alpha) >> 4;
- do {
- SkPMColor sc = *src++;
- SkPMColorAssert(sc);
-
- if (sc) {
- unsigned dst_scale = 16 - (SkGetPackedA32(sc) * src_scale >> 8);
- uint32_t src_expand = SkExpand32_4444(sc) * src_scale;
- uint32_t dst_expand = SkExpand_4444(*dst) * dst_scale;
- *dst = SkCompact_4444((src_expand + dst_expand) >> 4);
- }
- dst += 1;
- } while (--count != 0);
- }
-}
-
-/////////////////////////////////////////////////////////////////////////////
-
-static void S32_D4444_Opaque_Dither(uint16_t* SK_RESTRICT dst,
- const SkPMColor* SK_RESTRICT src,
- int count, U8CPU alpha, int x, int y) {
- SkASSERT(255 == alpha);
-
- if (count > 0) {
- DITHER_4444_SCAN(y);
- do {
- SkPMColor c = *src++;
- SkPMColorAssert(c);
-
- unsigned dither = DITHER_VALUE(x);
- *dst++ = SkDitherARGB32To4444(c, dither);
- DITHER_INC_X(x);
- } while (--count != 0);
- }
-}
-
-static void S32_D4444_Blend_Dither(uint16_t* SK_RESTRICT dst,
- const SkPMColor* SK_RESTRICT src,
- int count, U8CPU alpha, int x, int y) {
- SkASSERT(255 > alpha);
-
- if (count > 0) {
- int scale16 = SkAlpha255To256(alpha) >> 4;
- DITHER_4444_SCAN(y);
- do {
- SkPMColor c = *src++;
- SkPMColorAssert(c);
- SkASSERT(SkGetPackedA32(c) == 255);
-
- uint32_t src_expand = SkExpand32_4444(c) * scale16;
- uint32_t dst_expand = SkExpand_4444(*dst) * (16 - scale16);
-
- c = SkCompact_8888(src_expand + dst_expand); // convert back to SkPMColor
- *dst++ = SkDitherARGB32To4444(c, DITHER_VALUE(x));
- DITHER_INC_X(x);
- } while (--count != 0);
- }
-}
-
-static void S32A_D4444_Opaque_Dither(uint16_t* SK_RESTRICT dst,
- const SkPMColor* SK_RESTRICT src,
- int count, U8CPU alpha, int x, int y) {
- SkASSERT(255 == alpha);
-
- if (count > 0) {
- DITHER_4444_SCAN(y);
- do {
- SkPMColor c = *src++;
- SkPMColorAssert(c);
- if (c) {
- unsigned a = SkGetPackedA32(c);
- int d = SkAlphaMul(DITHER_VALUE(x), SkAlpha255To256(a));
-
- unsigned scale16 = SkAlpha255To256(255 - a) >> 4;
- uint32_t src_expand = SkExpand_8888(c);
- uint32_t dst_expand = SkExpand_4444(*dst) * scale16;
- // convert back to SkPMColor
- c = SkCompact_8888(src_expand + dst_expand);
- *dst = SkDitherARGB32To4444(c, d);
- }
- dst += 1;
- DITHER_INC_X(x);
- } while (--count != 0);
- }
-}
-
-// need DitherExpand888To4444(expand, dither)
-
-static void S32A_D4444_Blend_Dither(uint16_t* SK_RESTRICT dst,
- const SkPMColor* SK_RESTRICT src,
- int count, U8CPU alpha, int x, int y) {
- SkASSERT(255 > alpha);
-
- if (count > 0) {
- int src_scale = SkAlpha255To256(alpha) >> 4;
- DITHER_4444_SCAN(y);
- do {
- SkPMColor c = *src++;
- SkPMColorAssert(c);
- if (c) {
- unsigned a = SkAlpha255To256(SkGetPackedA32(c));
- int d = SkAlphaMul(DITHER_VALUE(x), a);
-
- unsigned dst_scale = 16 - SkAlphaMul(src_scale, a);
- uint32_t src_expand = SkExpand32_4444(c) * src_scale;
- uint32_t dst_expand = SkExpand_4444(*dst) * dst_scale;
- // convert back to SkPMColor
- c = SkCompact_8888(src_expand + dst_expand);
- *dst = SkDitherARGB32To4444(c, d);
- }
- dst += 1;
- DITHER_INC_X(x);
- } while (--count != 0);
- }
-}
-
-///////////////////////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////////////////
-
-static const SkBlitRow::Proc gProcs4444[] = {
- // no dither
- S32_D4444_Opaque,
- S32_D4444_Blend,
-
- S32A_D4444_Opaque,
- S32A_D4444_Blend,
-
- // dither
- S32_D4444_Opaque_Dither,
- S32_D4444_Blend_Dither,
-
- S32A_D4444_Opaque_Dither,
- S32A_D4444_Blend_Dither
-};
-
-SkBlitRow::Proc SkBlitRow_Factory_4444(unsigned flags);
-SkBlitRow::Proc SkBlitRow_Factory_4444(unsigned flags)
-{
- SkASSERT(flags < SK_ARRAY_COUNT(gProcs4444));
-
- return gProcs4444[flags];
-}
diff --git a/src/core/SkBlitter.cpp b/src/core/SkBlitter.cpp
index f43ad75a44..162fdbcd29 100644
--- a/src/core/SkBlitter.cpp
+++ b/src/core/SkBlitter.cpp
@@ -956,10 +956,6 @@ SkBlitter* SkBlitter::Choose(const SkBitmap& device,
}
break;
- case SkBitmap::kARGB_4444_Config:
- blitter = SkBlitter_ChooseD4444(device, *paint, storage, storageSize);
- break;
-
case SkBitmap::kRGB_565_Config:
blitter = SkBlitter_ChooseD565(device, *paint, storage, storageSize);
break;
diff --git a/src/core/SkBlitter_4444.cpp b/src/core/SkBlitter_4444.cpp
deleted file mode 100644
index 0d81f8ddb6..0000000000
--- a/src/core/SkBlitter_4444.cpp
+++ /dev/null
@@ -1,480 +0,0 @@
-
-/*
- * Copyright 2006 The Android Open Source Project
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-
-#include "SkCoreBlitters.h"
-#include "SkColorPriv.h"
-#include "SkDither.h"
-#include "SkShader.h"
-#include "SkTemplatesPriv.h"
-#include "SkUtils.h"
-#include "SkXfermode.h"
-
-static inline SkPMColor SkBlendARGB4444(SkPMColor16 src, SkPMColor16 dst,
- U8CPU aa) {
- SkASSERT((unsigned)aa <= 255);
-
- unsigned src_scale = SkAlpha255To256(aa) >> 4;
- unsigned dst_scale = SkAlpha15To16(15 - SkAlphaMul4(SkGetPackedA4444(src), src_scale));
-
- uint32_t src32 = SkExpand_4444(src) * src_scale;
- uint32_t dst32 = SkExpand_4444(dst) * dst_scale;
- return SkCompact_4444((src32 + dst32) >> 4);
-}
-
-///////////////////////////////////////////////////////////////////////////////
-
-class SkARGB4444_Blitter : public SkRasterBlitter {
-public:
- SkARGB4444_Blitter(const SkBitmap& device, const SkPaint& paint);
- virtual void blitH(int x, int y, int width);
- virtual void blitAntiH(int x, int y, const SkAlpha antialias[],
- const int16_t runs[]);
- virtual void blitV(int x, int y, int height, SkAlpha alpha);
- virtual void blitRect(int x, int y, int width, int height);
- virtual void blitMask(const SkMask&, const SkIRect&);
- virtual const SkBitmap* justAnOpaqueColor(uint32_t*);
-
-protected:
- SkPMColor16 fPMColor16, fPMColor16Other;
- SkPMColor16 fRawColor16, fRawColor16Other;
- uint8_t fScale16;
-
-private:
- // illegal
- SkARGB4444_Blitter& operator=(const SkARGB4444_Blitter&);
-
- typedef SkRasterBlitter INHERITED;
-};
-
-
-SkARGB4444_Blitter::SkARGB4444_Blitter(const SkBitmap& device,
- const SkPaint& paint) : INHERITED(device) {
- // cache premultiplied versions in 4444
- SkPMColor c = SkPreMultiplyColor(paint.getColor());
- fPMColor16 = SkPixel32ToPixel4444(c);
- if (paint.isDither()) {
- fPMColor16Other = SkDitherPixel32To4444(c);
- } else {
- fPMColor16Other = fPMColor16;
- }
-
- // cache raw versions in 4444
- fRawColor16 = SkPackARGB4444(0xFF >> 4, SkColorGetR(c) >> 4,
- SkColorGetG(c) >> 4, SkColorGetB(c) >> 4);
- if (paint.isDither()) {
- fRawColor16Other = SkDitherARGB32To4444(0xFF, SkColorGetR(c),
- SkColorGetG(c), SkColorGetB(c));
- } else {
- fRawColor16Other = fRawColor16;
- }
-
- fScale16 = SkAlpha15To16(SkGetPackedA4444(fPMColor16Other));
- if (16 == fScale16) {
- // force the original to also be opaque
- fPMColor16 |= (0xF << SK_A4444_SHIFT);
- }
-}
-
-const SkBitmap* SkARGB4444_Blitter::justAnOpaqueColor(uint32_t* value) {
- if (16 == fScale16) {
- *value = fPMColor16;
- return &fDevice;
- }
- return NULL;
-}
-
-static void src_over_4444(SkPMColor16 dst[], SkPMColor16 color,
- SkPMColor16 other, unsigned invScale, int count) {
- int twice = count >> 1;
- while (--twice >= 0) {
- *dst = color + SkAlphaMulQ4(*dst, invScale);
- dst++;
- *dst = other + SkAlphaMulQ4(*dst, invScale);
- dst++;
- }
- if (count & 1) {
- *dst = color + SkAlphaMulQ4(*dst, invScale);
- }
-}
-
-static inline uint32_t SkExpand_4444_Replicate(SkPMColor16 c) {
- uint32_t c32 = SkExpand_4444(c);
- return c32 | (c32 << 4);
-}
-
-static void src_over_4444x(SkPMColor16 dst[], uint32_t color,
- uint32_t other, unsigned invScale, int count) {
- int twice = count >> 1;
- uint32_t tmp;
- while (--twice >= 0) {
- tmp = SkExpand_4444(*dst) * invScale;
- *dst++ = SkCompact_4444((color + tmp) >> 4);
- tmp = SkExpand_4444(*dst) * invScale;
- *dst++ = SkCompact_4444((other + tmp) >> 4);
- }
- if (count & 1) {
- tmp = SkExpand_4444(*dst) * invScale;
- *dst = SkCompact_4444((color + tmp) >> 4);
- }
-}
-
-void SkARGB4444_Blitter::blitH(int x, int y, int width) {
- SkASSERT(x >= 0 && y >= 0 && x + width <= fDevice.width());
-
- if (0 == fScale16) {
- return;
- }
-
- SkPMColor16* device = fDevice.getAddr16(x, y);
- SkPMColor16 color = fPMColor16;
- SkPMColor16 other = fPMColor16Other;
-
- if ((x ^ y) & 1) {
- SkTSwap<SkPMColor16>(color, other);
- }
-
- if (16 == fScale16) {
- sk_dither_memset16(device, color, other, width);
- } else {
- src_over_4444x(device, SkExpand_4444_Replicate(color),
- SkExpand_4444_Replicate(other),
- 16 - fScale16, width);
- }
-}
-
-void SkARGB4444_Blitter::blitV(int x, int y, int height, SkAlpha alpha) {
- if (0 == alpha || 0 == fScale16) {
- return;
- }
-
- SkPMColor16* device = fDevice.getAddr16(x, y);
- SkPMColor16 color = fPMColor16;
- SkPMColor16 other = fPMColor16Other;
- size_t rb = fDevice.rowBytes();
-
- if ((x ^ y) & 1) {
- SkTSwap<SkPMColor16>(color, other);
- }
-
- if (16 == fScale16 && 255 == alpha) {
- while (--height >= 0) {
- *device = color;
- device = (SkPMColor16*)((char*)device + rb);
- SkTSwap<SkPMColor16>(color, other);
- }
- } else {
- unsigned alphaScale = SkAlpha255To256(alpha);
- uint32_t c32 = SkExpand_4444(color) * (alphaScale >> 4);
- // need to normalize the low nibble of each expanded component
- // so we don't overflow the add with d32
- c32 = SkCompact_4444(c32 >> 4);
- unsigned invScale = 16 - SkAlpha15To16(SkGetPackedA4444(c32));
- // now re-expand and replicate
- c32 = SkExpand_4444_Replicate(c32);
-
- while (--height >= 0) {
- uint32_t d32 = SkExpand_4444(*device) * invScale;
- *device = SkCompact_4444((c32 + d32) >> 4);
- device = (SkPMColor16*)((char*)device + rb);
- }
- }
-}
-
-void SkARGB4444_Blitter::blitRect(int x, int y, int width, int height) {
- SkASSERT(x >= 0 && y >= 0 && x + width <= fDevice.width() &&
- y + height <= fDevice.height());
-
- if (0 == fScale16) {
- return;
- }
-
- SkPMColor16* device = fDevice.getAddr16(x, y);
- SkPMColor16 color = fPMColor16;
- SkPMColor16 other = fPMColor16Other;
-
- if ((x ^ y) & 1) {
- SkTSwap<SkPMColor16>(color, other);
- }
-
- if (16 == fScale16) {
- while (--height >= 0) {
- sk_dither_memset16(device, color, other, width);
- device = (SkPMColor16*)((char*)device + fDevice.rowBytes());
- SkTSwap<SkPMColor16>(color, other);
- }
- } else {
- unsigned invScale = 16 - fScale16;
-
- uint32_t c32 = SkExpand_4444_Replicate(color);
- uint32_t o32 = SkExpand_4444_Replicate(other);
- while (--height >= 0) {
- src_over_4444x(device, c32, o32, invScale, width);
- device = (SkPMColor16*)((char*)device + fDevice.rowBytes());
- SkTSwap<uint32_t>(c32, o32);
- }
- }
-}
-
-void SkARGB4444_Blitter::blitAntiH(int x, int y, const SkAlpha antialias[],
- const int16_t runs[]) {
- if (0 == fScale16) {
- return;
- }
-
- SkPMColor16* device = fDevice.getAddr16(x, y);
- SkPMColor16 color = fPMColor16;
- SkPMColor16 other = fPMColor16Other;
-
- if ((x ^ y) & 1) {
- SkTSwap<SkPMColor16>(color, other);
- }
-
- for (;;) {
- int count = runs[0];
- SkASSERT(count >= 0);
- if (count <= 0) {
- return;
- }
-
- unsigned aa = antialias[0];
- if (aa) {
- if (0xFF == aa) {
- if (16 == fScale16) {
- sk_dither_memset16(device, color, other, count);
- } else {
- src_over_4444(device, color, other, 16 - fScale16, count);
- }
- } else {
- // todo: respect dithering
- aa = SkAlpha255To256(aa); // FIX
- SkPMColor16 src = SkAlphaMulQ4(color, aa >> 4);
- unsigned dst_scale = SkAlpha15To16(15 - SkGetPackedA4444(src)); // FIX
- int n = count;
- do {
- --n;
- device[n] = src + SkAlphaMulQ4(device[n], dst_scale);
- } while (n > 0);
- }
- }
-
- runs += count;
- antialias += count;
- device += count;
-
- if (count & 1) {
- SkTSwap<SkPMColor16>(color, other);
- }
- }
-}
-
-///////////////////////////////////////////////////////////////////////////////
-
-#define solid_8_pixels(mask, dst, color) \
- do { \
- if (mask & 0x80) dst[0] = color; \
- if (mask & 0x40) dst[1] = color; \
- if (mask & 0x20) dst[2] = color; \
- if (mask & 0x10) dst[3] = color; \
- if (mask & 0x08) dst[4] = color; \
- if (mask & 0x04) dst[5] = color; \
- if (mask & 0x02) dst[6] = color; \
- if (mask & 0x01) dst[7] = color; \
- } while (0)
-
-#define SK_BLITBWMASK_NAME SkARGB4444_BlitBW
-#define SK_BLITBWMASK_ARGS , SkPMColor16 color
-#define SK_BLITBWMASK_BLIT8(mask, dst) solid_8_pixels(mask, dst, color)
-#define SK_BLITBWMASK_GETADDR getAddr16
-#define SK_BLITBWMASK_DEVTYPE uint16_t
-#include "SkBlitBWMaskTemplate.h"
-
-#define blend_8_pixels(mask, dst, sc, dst_scale) \
- do { \
- if (mask & 0x80) { dst[0] = sc + SkAlphaMulQ4(dst[0], dst_scale); } \
- if (mask & 0x40) { dst[1] = sc + SkAlphaMulQ4(dst[1], dst_scale); } \
- if (mask & 0x20) { dst[2] = sc + SkAlphaMulQ4(dst[2], dst_scale); } \
- if (mask & 0x10) { dst[3] = sc + SkAlphaMulQ4(dst[3], dst_scale); } \
- if (mask & 0x08) { dst[4] = sc + SkAlphaMulQ4(dst[4], dst_scale); } \
- if (mask & 0x04) { dst[5] = sc + SkAlphaMulQ4(dst[5], dst_scale); } \
- if (mask & 0x02) { dst[6] = sc + SkAlphaMulQ4(dst[6], dst_scale); } \
- if (mask & 0x01) { dst[7] = sc + SkAlphaMulQ4(dst[7], dst_scale); } \
- } while (0)
-
-#define SK_BLITBWMASK_NAME SkARGB4444_BlendBW
-#define SK_BLITBWMASK_ARGS , uint16_t sc, unsigned dst_scale
-#define SK_BLITBWMASK_BLIT8(mask, dst) blend_8_pixels(mask, dst, sc, dst_scale)
-#define SK_BLITBWMASK_GETADDR getAddr16
-#define SK_BLITBWMASK_DEVTYPE uint16_t
-#include "SkBlitBWMaskTemplate.h"
-
-void SkARGB4444_Blitter::blitMask(const SkMask& mask, const SkIRect& clip) {
- SkASSERT(mask.fBounds.contains(clip));
-
- if (0 == fScale16) {
- return;
- }
-
- if (mask.fFormat == SkMask::kBW_Format) {
- if (16 == fScale16) {
- SkARGB4444_BlitBW(fDevice, mask, clip, fPMColor16);
- } else {
- SkARGB4444_BlendBW(fDevice, mask, clip, fPMColor16, 16 - fScale16);
- }
- return;
- }
-
- int x = clip.fLeft;
- int y = clip.fTop;
- int width = clip.width();
- int height = clip.height();
-
- SkPMColor16* device = fDevice.getAddr16(x, y);
- const uint8_t* alpha = mask.getAddr8(x, y);
- SkPMColor16 srcColor = fPMColor16;
- size_t devRB = fDevice.rowBytes() - (width << 1);
- unsigned maskRB = mask.fRowBytes - width;
-
- do {
- int w = width;
- do {
- unsigned aa = *alpha++;
- *device = SkBlendARGB4444(srcColor, *device, aa);
- device += 1;
- } while (--w != 0);
- device = (SkPMColor16*)((char*)device + devRB);
- alpha += maskRB;
- } while (--height != 0);
-}
-
-///////////////////////////////////////////////////////////////////////////////
-
-class SkARGB4444_Shader_Blitter : public SkShaderBlitter {
- SkXfermode* fXfermode;
- SkBlitRow::Proc fOpaqueProc;
- SkBlitRow::Proc fAlphaProc;
- SkPMColor* fBuffer;
- uint8_t* fAAExpand;
-public:
-
-SkARGB4444_Shader_Blitter(const SkBitmap& device, const SkPaint& paint)
- : INHERITED(device, paint) {
- const int width = device.width();
- fBuffer = (SkPMColor*)sk_malloc_throw(width * sizeof(SkPMColor) + width);
- fAAExpand = (uint8_t*)(fBuffer + width);
-
- fXfermode = paint.getXfermode();
- SkSafeRef(fXfermode);
-
- unsigned flags = 0;
- if (!(fShader->getFlags() & SkShader::kOpaqueAlpha_Flag)) {
- flags |= SkBlitRow::kSrcPixelAlpha_Flag;
- }
- if (paint.isDither()) {
- flags |= SkBlitRow::kDither_Flag;
- }
- fOpaqueProc = SkBlitRow::Factory(flags, SkBitmap::kARGB_4444_Config);
- fAlphaProc = SkBlitRow::Factory(flags | SkBlitRow::kGlobalAlpha_Flag,
- SkBitmap::kARGB_4444_Config);
-}
-
-virtual ~SkARGB4444_Shader_Blitter() {
- SkSafeUnref(fXfermode);
- sk_free(fBuffer);
-}
-
-virtual void blitH(int x, int y, int width) {
- SkASSERT(x >= 0 && y >= 0 && x + width <= fDevice.width());
-
- SkPMColor16* device = fDevice.getAddr16(x, y);
- SkPMColor* span = fBuffer;
-
- fShader->shadeSpan(x, y, span, width);
- if (fXfermode) {
- fXfermode->xfer4444(device, span, width, NULL);
- } else {
- fOpaqueProc(device, span, width, 0xFF, x, y);
- }
-}
-
-virtual void blitAntiH(int x, int y, const SkAlpha antialias[],
- const int16_t runs[]) {
- SkPMColor* SK_RESTRICT span = fBuffer;
- uint8_t* SK_RESTRICT aaExpand = fAAExpand;
- SkPMColor16* device = fDevice.getAddr16(x, y);
- SkShader* shader = fShader;
- SkXfermode* xfer = fXfermode;
-
- if (NULL != xfer) {
- for (;;) {
- int count = *runs;
- if (count <= 0) {
- break;
- }
- int aa = *antialias;
- if (aa) {
- shader->shadeSpan(x, y, span, count);
- if (255 == aa) {
- xfer->xfer4444(device, span, count, NULL);
- } else {
- const uint8_t* aaBuffer = antialias;
- if (count > 1) {
- memset(aaExpand, aa, count);
- aaBuffer = aaExpand;
- }
- xfer->xfer4444(device, span, count, aaBuffer);
- }
- }
- device += count;
- runs += count;
- antialias += count;
- x += count;
- }
- } else { // no xfermode
- for (;;) {
- int count = *runs;
- if (count <= 0) {
- break;
- }
- int aa = *antialias;
- if (aa) {
- fShader->shadeSpan(x, y, span, count);
- if (255 == aa) {
- fOpaqueProc(device, span, count, aa, x, y);
- } else {
- fAlphaProc(device, span, count, aa, x, y);
- }
- }
- device += count;
- runs += count;
- antialias += count;
- x += count;
- }
- }
-}
-
-private:
- typedef SkShaderBlitter INHERITED;
-};
-
-///////////////////////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////////////////
-
-SkBlitter* SkBlitter_ChooseD4444(const SkBitmap& device,
- const SkPaint& paint,
- void* storage, size_t storageSize)
-{
- SkBlitter* blitter;
-
- if (paint.getShader()) {
- SK_PLACEMENT_NEW_ARGS(blitter, SkARGB4444_Shader_Blitter, storage, storageSize, (device, paint));
- } else {
- SK_PLACEMENT_NEW_ARGS(blitter, SkARGB4444_Blitter, storage, storageSize, (device, paint));
- }
- return blitter;
-}
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index 07b615ac45..36dd304c37 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -464,20 +464,7 @@ private:
class AutoValidator {
public:
AutoValidator(SkDevice* device) : fDevice(device) {}
- ~AutoValidator() {
-#ifdef SK_DEBUG
- const SkBitmap& bm = fDevice->accessBitmap(false);
- if (bm.config() == SkBitmap::kARGB_4444_Config) {
- for (int y = 0; y < bm.height(); y++) {
- const SkPMColor16* p = bm.getAddr16(0, y);
- for (int x = 0; x < bm.width(); x++) {
- SkPMColor16 c = p[x];
- SkPMColor16Assert(c);
- }
- }
- }
-#endif
- }
+
private:
SkDevice* fDevice;
};
diff --git a/src/core/SkCoreBlitters.h b/src/core/SkCoreBlitters.h
index 823cb41b0d..9455509c48 100644
--- a/src/core/SkCoreBlitters.h
+++ b/src/core/SkCoreBlitters.h
@@ -154,7 +154,7 @@ private:
class SkA1_Blitter : public SkRasterBlitter {
public:
SkA1_Blitter(const SkBitmap& device, const SkPaint& paint);
- virtual void blitH(int x, int y, int width);
+ virtual void blitH(int x, int y, int width) SK_OVERRIDE;
private:
uint8_t fSrcA;
@@ -180,10 +180,6 @@ private:
SkBlitter::Choose(...)
*/
-extern SkBlitter* SkBlitter_ChooseD4444(const SkBitmap& device,
- const SkPaint& paint,
- void* storage, size_t storageSize);
-
extern SkBlitter* SkBlitter_ChooseD565(const SkBitmap& device,
const SkPaint& paint,
void* storage, size_t storageSize);
diff --git a/src/core/SkDevice.cpp b/src/core/SkDevice.cpp
index dee5bc76af..97d5748cdb 100644
--- a/src/core/SkDevice.cpp
+++ b/src/core/SkDevice.cpp
@@ -32,6 +32,8 @@ SkDevice::SkDevice(const SkBitmap& bitmap)
{
fOrigin.setZero();
fMetaData = NULL;
+
+ SkASSERT(SkBitmap::kARGB_4444_Config != bitmap.config());
}
SkDevice::SkDevice(const SkBitmap& bitmap, const SkDeviceProperties& deviceProperties)
diff --git a/src/core/SkDraw.cpp b/src/core/SkDraw.cpp
index 30d5956ae8..1cfeaa34d6 100644
--- a/src/core/SkDraw.cpp
+++ b/src/core/SkDraw.cpp
@@ -222,12 +222,6 @@ static BitmapXferProc ChooseBitmapXferProc(const SkBitmap& bitmap,
}
// SkDebugf("--- D32_Src_BitmapXferProc\n");
return D32_Src_BitmapXferProc;
- case SkBitmap::kARGB_4444_Config:
- if (data) {
- *data = SkPixel32ToPixel4444(pmc);
- }
-// SkDebugf("--- D16_Src_BitmapXferProc\n");
- return D16_Src_BitmapXferProc;
case SkBitmap::kRGB_565_Config:
if (data) {
*data = SkPixel32ToPixel16(pmc);
@@ -258,7 +252,6 @@ static void CallBitmapXferProc(const SkBitmap& bitmap, const SkIRect& rect,
case SkBitmap::kARGB_8888_Config:
shiftPerPixel = 2;
break;
- case SkBitmap::kARGB_4444_Config:
case SkBitmap::kRGB_565_Config:
shiftPerPixel = 1;
break;
diff --git a/src/core/SkXfermode.cpp b/src/core/SkXfermode.cpp
index 2da500a7d8..2cfdcfa4b3 100644
--- a/src/core/SkXfermode.cpp
+++ b/src/core/SkXfermode.cpp
@@ -751,31 +751,6 @@ void SkXfermode::xfer16(uint16_t* dst,
}
}
-void SkXfermode::xfer4444(SkPMColor16* SK_RESTRICT dst,
- const SkPMColor* SK_RESTRICT src, int count,
- const SkAlpha* SK_RESTRICT aa) const {
- SkASSERT(dst && src && count >= 0);
-
- if (NULL == aa) {
- for (int i = count - 1; i >= 0; --i) {
- SkPMColor dstC = SkPixel4444ToPixel32(dst[i]);
- dst[i] = SkPixel32ToPixel4444(this->xferColor(src[i], dstC));
- }
- } else {
- for (int i = count - 1; i >= 0; --i) {
- unsigned a = aa[i];
- if (0 != a) {
- SkPMColor dstC = SkPixel4444ToPixel32(dst[i]);
- SkPMColor C = this->xferColor(src[i], dstC);
- if (0xFF != a) {
- C = SkFourByteInterp(C, dstC, a);
- }
- dst[i] = SkPixel32ToPixel4444(C);
- }
- }
- }
-}
-
void SkXfermode::xferA8(SkAlpha* SK_RESTRICT dst,
const SkPMColor src[], int count,
const SkAlpha* SK_RESTRICT aa) const {
@@ -861,35 +836,6 @@ void SkProcXfermode::xfer16(uint16_t* SK_RESTRICT dst,
}
}
-void SkProcXfermode::xfer4444(SkPMColor16* SK_RESTRICT dst,
- const SkPMColor* SK_RESTRICT src, int count,
- const SkAlpha* SK_RESTRICT aa) const {
- SkASSERT(dst && src && count >= 0);
-
- SkXfermodeProc proc = fProc;
-
- if (NULL != proc) {
- if (NULL == aa) {
- for (int i = count - 1; i >= 0; --i) {
- SkPMColor dstC = SkPixel4444ToPixel32(dst[i]);
- dst[i] = SkPixel32ToPixel4444(proc(src[i], dstC));
- }
- } else {
- for (int i = count - 1; i >= 0; --i) {
- unsigned a = aa[i];
- if (0 != a) {
- SkPMColor dstC = SkPixel4444ToPixel32(dst[i]);
- SkPMColor C = proc(src[i], dstC);
- if (0xFF != a) {
- C = SkFourByteInterp(C, dstC, a);
- }
- dst[i] = SkPixel32ToPixel4444(C);
- }
- }
- }
- }
-}
-
void SkProcXfermode::xferA8(SkAlpha* SK_RESTRICT dst,
const SkPMColor* SK_RESTRICT src, int count,
const SkAlpha* SK_RESTRICT aa) const {
diff --git a/src/effects/SkAvoidXfermode.cpp b/src/effects/SkAvoidXfermode.cpp
index 206f7e9870..d76efb839e 100644
--- a/src/effects/SkAvoidXfermode.cpp
+++ b/src/effects/SkAvoidXfermode.cpp
@@ -48,19 +48,6 @@ static unsigned color_dist16(uint16_t c, unsigned r, unsigned g, unsigned b) {
return SkMax32(dr, SkMax32(dg, db));
}
-// returns 0..15
-static unsigned color_dist4444(uint16_t c, unsigned r, unsigned g, unsigned b) {
- SkASSERT(r <= 0xF);
- SkASSERT(g <= 0xF);
- SkASSERT(b <= 0xF);
-
- unsigned dr = SkAbs32(SkGetPackedR4444(c) - r);
- unsigned dg = SkAbs32(SkGetPackedG4444(c) - g);
- unsigned db = SkAbs32(SkGetPackedB4444(c) - b);
-
- return SkMax32(dr, SkMax32(dg, db));
-}
-
// returns 0..255
static unsigned color_dist32(SkPMColor c, U8CPU r, U8CPU g, U8CPU b) {
SkASSERT(r <= 0xFF);
@@ -174,46 +161,6 @@ void SkAvoidXfermode::xfer16(uint16_t dst[], const SkPMColor src[], int count,
}
}
-void SkAvoidXfermode::xfer4444(uint16_t dst[], const SkPMColor src[], int count,
- const SkAlpha aa[]) const {
- unsigned opR = SkColorGetR(fOpColor) >> 4;
- unsigned opG = SkColorGetG(fOpColor) >> 4;
- unsigned opB = SkColorGetB(fOpColor) >> 4;
- uint32_t mul = fDistMul;
- uint32_t sub = (fDistMul - (1 << 14)) << 4;
-
- int MAX, mask;
-
- if (kTargetColor_Mode == fMode) {
- mask = -1;
- MAX = 15;
- } else {
- mask = 0;
- MAX = 0;
- }
-
- for (int i = 0; i < count; i++) {
- int d = color_dist4444(dst[i], opR, opG, opB);
- // now reverse d if we need to
- d = MAX + (d ^ mask) - mask;
- SkASSERT((unsigned)d <= 15);
- // convert from 0..15 to 0..16
- d += d >> 3;
- d = scale_dist_14(d, mul, sub);
- SkASSERT(d <= 16);
-
- if (d > 0) {
- if (NULL != aa) {
- d = SkAlphaMul(d, Accurate255To256(*aa++));
- if (0 == d) {
- continue;
- }
- }
- dst[i] = SkBlend4444(SkPixel32ToPixel4444(src[i]), dst[i], d);
- }
- }
-}
-
void SkAvoidXfermode::xferA8(SkAlpha dst[], const SkPMColor src[], int count,
const SkAlpha aa[]) const {
// override in subclass
diff --git a/src/effects/SkTransparentShader.cpp b/src/effects/SkTransparentShader.cpp
index 7b92fde6db..0274481623 100644
--- a/src/effects/SkTransparentShader.cpp
+++ b/src/effects/SkTransparentShader.cpp
@@ -30,7 +30,6 @@ uint32_t SkTransparentShader::getFlags() {
flags |= kOpaqueAlpha_Flag;
break;
case SkBitmap::kARGB_8888_Config:
- case SkBitmap::kARGB_4444_Config:
if (fAlpha == 255 && fDevice->isOpaque())
flags |= kOpaqueAlpha_Flag;
break;
@@ -79,21 +78,6 @@ void SkTransparentShader::shadeSpan(int x, int y, SkPMColor span[], int count) {
}
break;
}
- case SkBitmap::kARGB_4444_Config: {
- const uint16_t* src = fDevice->getAddr16(x, y);
- if (scale == 256) {
- for (int i = count - 1; i >= 0; --i) {
- span[i] = SkPixel4444ToPixel32(src[i]);
- }
- } else {
- unsigned scale16 = scale >> 4;
- for (int i = count - 1; i >= 0; --i) {
- uint32_t c = SkExpand_4444(src[i]) * scale16;
- span[i] = SkCompact_8888(c);
- }
- }
- break;
- }
case SkBitmap::kIndex8_Config:
SkDEBUGFAIL("index8 not supported as a destination device");
break;
diff --git a/src/gpu/gl/GrGpuGL.cpp b/src/gpu/gl/GrGpuGL.cpp
index a2ff1fd576..d96ea395e6 100644
--- a/src/gpu/gl/GrGpuGL.cpp
+++ b/src/gpu/gl/GrGpuGL.cpp
@@ -218,10 +218,8 @@ void GrGpuGL::fillInConfigRenderableTable() {
fConfigRenderSupport[kRGB_565_GrPixelConfig] = true;
}
- // Pre 3.0, Ganesh relies on either GL_ARB_framebuffer_object or
- // GL_EXT_framebuffer_object for FBO support. Both of these
- // allow RGBA4 render targets so this is always supported.
- fConfigRenderSupport[kRGBA_4444_GrPixelConfig] = true;
+ // we no longer support 444 as a render target
+ fConfigRenderSupport[kRGBA_4444_GrPixelConfig] = false;
if (this->glCaps().rgba8RenderbufferSupport()) {
fConfigRenderSupport[kRGBA_8888_GrPixelConfig] = true;
diff --git a/src/opts/SkBlitRow_opts_arm.h b/src/opts/SkBlitRow_opts_arm.h
index d929814be3..25f8bf4774 100644
--- a/src/opts/SkBlitRow_opts_arm.h
+++ b/src/opts/SkBlitRow_opts_arm.h
@@ -19,7 +19,6 @@
#if USE_NEON_CODE
// These are defined in SkBlitRow_opts_arm_neon.cpp
extern const SkBlitRow::Proc sk_blitrow_platform_565_procs_arm_neon[];
-extern const SkBlitRow::Proc sk_blitrow_platform_4444_procs_arm_neon[];
extern const SkBlitRow::Proc32 sk_blitrow_platform_32_procs_arm_neon[];
extern void Color32_arm_neon(SkPMColor* dst, const SkPMColor* src, int count,
@@ -29,7 +28,6 @@ extern void Color32_arm_neon(SkPMColor* dst, const SkPMColor* src, int count,
#if USE_ARM_CODE
// These are defined in SkBlitRow_opts_arm.cpp
extern const SkBlitRow::Proc sk_blitrow_platform_565_procs_arm[];
-extern const SkBlitRow::Proc sk_blitrow_platform_4444_procs_arm[];
extern const SkBlitRow::Proc32 sk_blitrow_platform_32_procs_arm[];
#endif
diff --git a/src/opts/opts_check_SSE2.cpp b/src/opts/opts_check_SSE2.cpp
index 6370058f0d..d23e3844d5 100644
--- a/src/opts/opts_check_SSE2.cpp
+++ b/src/opts/opts_check_SSE2.cpp
@@ -152,10 +152,6 @@ static SkBlitRow::Proc32 platform_32_procs[] = {
S32A_Blend_BlitRow32_SSE2, // S32A_Blend,
};
-SkBlitRow::Proc SkBlitRow::PlatformProcs4444(unsigned flags) {
- return NULL;
-}
-
SkBlitRow::Proc SkBlitRow::PlatformProcs565(unsigned flags) {
return NULL;
}
diff --git a/src/utils/mac/SkBitmap_Mac.cpp b/src/utils/mac/SkBitmap_Mac.cpp
deleted file mode 100644
index 151dc9b8f9..0000000000
--- a/src/utils/mac/SkBitmap_Mac.cpp
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * Copyright 2011 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "SkBitmap.h"
-#include "SkColorPriv.h"
-#include "SkMath.h"
-
-#if defined(SK_BUILD_FOR_MAC)
-
-#include <ApplicationServices/ApplicationServices.h>
-
-#ifndef __ppc__
- #define SWAP_16BIT
-#endif
-
-static void convertGL32_to_Mac32(uint32_t dst[], const SkBitmap& bm) {
- memcpy(dst, bm.getPixels(), bm.getSize());
- return;
-
- uint32_t* stop = dst + (bm.getSize() >> 2);
- const uint8_t* src = (const uint8_t*)bm.getPixels();
- while (dst < stop) {
- *dst++ = src[2] << 24 | src[1] << 16 | src[0] << 8 | src[3] << 0;
- src += sizeof(uint32_t);
- }
-}
-
-static void convert565_to_32(uint32_t dst[], const SkBitmap& bm) {
- for (int y = 0; y < bm.height(); y++) {
- const uint16_t* src = bm.getAddr16(0, y);
- const uint16_t* stop = src + bm.width();
- while (src < stop) {
- unsigned c = *src++;
- unsigned r = SkPacked16ToR32(c);
- unsigned g = SkPacked16ToG32(c);
- unsigned b = SkPacked16ToB32(c);
-
- *dst++ = (b << 24) | (g << 16) | (r << 8) | 0xFF;
- }
- }
-}
-
-static void convert4444_to_555(uint16_t dst[], const uint16_t src[], int count)
-{
- const uint16_t* stop = src + count;
-
- while (src < stop)
- {
- unsigned c = *src++;
-
- unsigned r = SkGetPackedR4444(c);
- unsigned g = SkGetPackedG4444(c);
- unsigned b = SkGetPackedB4444(c);
- // convert to 5 bits
- r = (r << 1) | (r >> 3);
- g = (g << 1) | (g >> 3);
- b = (b << 1) | (b >> 3);
- // build the 555
- c = (r << 10) | (g << 5) | b;
-
-#ifdef SWAP_16BIT
- c = (c >> 8) | (c << 8);
-#endif
- *dst++ = c;
- }
-}
-
-#include "SkTemplates.h"
-
-static CGImageRef bitmap2imageref(const SkBitmap& bm) {
- size_t bitsPerComp;
- size_t bitsPerPixel;
- CGBitmapInfo info;
- CGColorSpaceRef cs = CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB);
- CGDataProviderRef data = CGDataProviderCreateWithData(NULL,
- bm.getPixels(),
- bm.getSize(),
- NULL);
- SkAutoTCallVProc<CGDataProvider, CGDataProviderRelease> acp(data);
- SkAutoTCallVProc<CGColorSpace, CGColorSpaceRelease> acp2(cs);
-
- switch (bm.config()) {
- case SkBitmap::kARGB_8888_Config:
- bitsPerComp = 8;
- bitsPerPixel = 32;
- info = kCGImageAlphaPremultipliedLast;
- break;
- case SkBitmap::kARGB_4444_Config:
- bitsPerComp = 4;
- bitsPerPixel = 16;
- info = kCGImageAlphaPremultipliedLast | kCGBitmapByteOrder16Little;
- break;
-#if 0 // not supported by quartz !!!
- case SkBitmap::kRGB_565_Config:
- bitsPerComp = 5;
- bitsPerPixel = 16;
- info = kCGImageAlphaNone | kCGBitmapByteOrder16Little;
- break;
-#endif
- default:
- return NULL;
- }
-
- return CGImageCreate(bm.width(), bm.height(), bitsPerComp, bitsPerPixel,
- bm.rowBytes(), cs, info, data,
- NULL, false, kCGRenderingIntentDefault);
-}
-
-void SkBitmap::drawToPort(WindowRef wind, CGContextRef cg) const {
- if (fPixels == NULL || fWidth == 0 || fHeight == 0) {
- return;
- }
-
- bool useQD = false;
- if (NULL == cg) {
- SetPortWindowPort(wind);
- QDBeginCGContext(GetWindowPort(wind), &cg);
- useQD = true;
- }
-
- SkBitmap bm;
- if (this->config() == kRGB_565_Config) {
- this->copyTo(&bm, kARGB_8888_Config);
- } else {
- bm = *this;
- }
- bm.lockPixels();
-
- CGImageRef image = bitmap2imageref(bm);
- if (image) {
- CGRect rect;
- rect.origin.x = rect.origin.y = 0;
- rect.size.width = bm.width();
- rect.size.height = bm.height();
-
- CGContextDrawImage(cg, rect, image);
- CGImageRelease(image);
- }
-
- if (useQD) {
- QDEndCGContext(GetWindowPort(wind), &cg);
- }
-}
-
-#endif
diff --git a/tests/ARGBImageEncoderTest.cpp b/tests/ARGBImageEncoderTest.cpp
index 05ad58cd54..9f68a0a151 100644
--- a/tests/ARGBImageEncoderTest.cpp
+++ b/tests/ARGBImageEncoderTest.cpp
@@ -25,7 +25,6 @@ protected:
static SkBitmap::Config configs[] = {
SkBitmap::kRGB_565_Config,
- SkBitmap::kARGB_4444_Config,
SkBitmap::kARGB_8888_Config,
};
diff --git a/tests/BitmapCopyTest.cpp b/tests/BitmapCopyTest.cpp
index 6cfb24b102..4058b04775 100644
--- a/tests/BitmapCopyTest.cpp
+++ b/tests/BitmapCopyTest.cpp
@@ -242,11 +242,11 @@ static void TestBitmapCopy(skiatest::Reporter* reporter) {
static const Pair gPairs[] = {
{ SkBitmap::kNo_Config, "00000000" },
{ SkBitmap::kA1_Config, "01000000" },
- { SkBitmap::kA8_Config, "00101110" },
- { SkBitmap::kIndex8_Config, "00111110" },
- { SkBitmap::kRGB_565_Config, "00101110" },
+ { SkBitmap::kA8_Config, "00101010" },
+ { SkBitmap::kIndex8_Config, "00111010" },
+ { SkBitmap::kRGB_565_Config, "00101010" },
{ SkBitmap::kARGB_4444_Config, "00101110" },
- { SkBitmap::kARGB_8888_Config, "00101110" },
+ { SkBitmap::kARGB_8888_Config, "00101010" },
// TODO: create valid RLE bitmap to test with
// { SkBitmap::kRLE_Index8_Config, "00101111" }
};
diff --git a/tests/BitmapGetColorTest.cpp b/tests/BitmapGetColorTest.cpp
index 4204ddf5de..8ada98cc9a 100644
--- a/tests/BitmapGetColorTest.cpp
+++ b/tests/BitmapGetColorTest.cpp
@@ -18,8 +18,6 @@ static void TestGetColor(skiatest::Reporter* reporter) {
// unpremultiply aspect of getColor()
{ SkBitmap::kA8_Config, 0xFF000000, 0xFF000000 },
{ SkBitmap::kA8_Config, 0, 0 },
- { SkBitmap::kARGB_4444_Config, 0xFF224466, 0xFF224466 },
- { SkBitmap::kARGB_4444_Config, 0, 0 },
{ SkBitmap::kRGB_565_Config, 0xFF00FF00, 0xFF00FF00 },
{ SkBitmap::kRGB_565_Config, 0xFFFF00FF, 0xFFFF00FF },
{ SkBitmap::kARGB_8888_Config, 0xFFFFFFFF, 0xFFFFFFFF },
diff --git a/tests/BitmapHasherTest.cpp b/tests/BitmapHasherTest.cpp
index 04de7074f7..924cea2dcc 100644
--- a/tests/BitmapHasherTest.cpp
+++ b/tests/BitmapHasherTest.cpp
@@ -51,10 +51,6 @@ namespace skiatest {
CreateTestBitmap(bitmap, SkBitmap::kARGB_8888_Config, 555, 333, SK_ColorGREEN);
REPORTER_ASSERT(fReporter, SkBitmapHasher::ComputeDigest(bitmap, &digest));
REPORTER_ASSERT(fReporter, digest == 0x2423c51cad6d1edcULL);
- // same pixel colors in a different config should yield the same checksum
- CreateTestBitmap(bitmap, SkBitmap::kARGB_4444_Config, 555, 333, SK_ColorGREEN);
- REPORTER_ASSERT(fReporter, SkBitmapHasher::ComputeDigest(bitmap, &digest));
- REPORTER_ASSERT(fReporter, digest == 0x2423c51cad6d1edcULL);
}
Reporter* fReporter;
diff --git a/tests/GpuBitmapCopyTest.cpp b/tests/GpuBitmapCopyTest.cpp
index 22141e54de..a800fb11d9 100644
--- a/tests/GpuBitmapCopyTest.cpp
+++ b/tests/GpuBitmapCopyTest.cpp
@@ -25,7 +25,7 @@ static const char* boolStr(bool value) {
// these are in the same order as the SkBitmap::Config enum
static const char* gConfigName[] = {
- "None", "4444", "8888"
+ "None", "8888"
};
struct Pair {
@@ -119,7 +119,6 @@ static void TestGpuBitmapCopy(skiatest::Reporter* reporter, GrContextFactory* fa
}
static const Pair gPairs[] = {
{ SkBitmap::kNo_Config, "000" },
- { SkBitmap::kARGB_4444_Config, "011" },
{ SkBitmap::kARGB_8888_Config, "011" },
};