Defining new color constat for transparent color
Review URL: https://codereview.appspot.com/6901044
git-svn-id: http://skia.googlecode.com/svn/trunk@6696 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/bench/benchmain.cpp b/bench/benchmain.cpp
index 80b7871..6f062e4 100644
--- a/bench/benchmain.cpp
+++ b/bench/benchmain.cpp
@@ -46,7 +46,7 @@
static void erase(SkBitmap& bm) {
if (bm.config() == SkBitmap::kA8_Config) {
- bm.eraseColor(0);
+ bm.eraseColor(SK_ColorTRANSPARENT);
} else {
bm.eraseColor(SK_ColorWHITE);
}
diff --git a/debugger/QT/SkRasterWidget.cpp b/debugger/QT/SkRasterWidget.cpp
index 4f8537d..a8a36a8 100644
--- a/debugger/QT/SkRasterWidget.cpp
+++ b/debugger/QT/SkRasterWidget.cpp
@@ -12,7 +12,7 @@
SkRasterWidget::SkRasterWidget(SkDebugger *debugger) : QWidget() {
fBitmap.setConfig(SkBitmap::kARGB_8888_Config, 800, 800);
fBitmap.allocPixels();
- fBitmap.eraseColor(0);
+ fBitmap.eraseColor(SK_ColorTRANSPARENT);
fDevice = new SkDevice(fBitmap);
fDebugger = debugger;
fCanvas = new SkCanvas(fDevice);
diff --git a/debugger/SkDebugCanvas.cpp b/debugger/SkDebugCanvas.cpp
index af86a1e..03b57c3 100644
--- a/debugger/SkDebugCanvas.cpp
+++ b/debugger/SkDebugCanvas.cpp
@@ -101,7 +101,7 @@
canvas->restore();
}
i = 0;
- canvas->clear(0);
+ canvas->clear(SK_ColorTRANSPARENT);
canvas->resetMatrix();
SkRect rect = SkRect::MakeWH(SkIntToScalar(fWidth),
SkIntToScalar(fHeight));
diff --git a/experimental/Intersection/SkAntiEdge.cpp b/experimental/Intersection/SkAntiEdge.cpp
index eb7dc34..41887fe 100644
--- a/experimental/Intersection/SkAntiEdge.cpp
+++ b/experimental/Intersection/SkAntiEdge.cpp
@@ -999,7 +999,7 @@
const int pixelCol = 100;
sweep->setConfig(SkBitmap::kA8_Config, pixelCol, pixelRow);
sweep->allocPixels();
- sweep->eraseColor(0);
+ sweep->eraseColor(SK_ColorTRANSPARENT);
sweep->lockPixels();
void* pixels = sweep->getPixels();
create_sweep((uint8_t*) pixels, pixelRow, pixelCol, rectWidth);
@@ -1011,7 +1011,7 @@
const int pixelCol = 100;
sweep->setConfig(SkBitmap::kA8_Config, pixelCol, pixelRow);
sweep->allocPixels();
- sweep->eraseColor(0);
+ sweep->eraseColor(SK_ColorTRANSPARENT);
sweep->lockPixels();
void* pixels = sweep->getPixels();
create_horz((uint8_t*) pixels, pixelRow, pixelCol);
@@ -1023,7 +1023,7 @@
const int pixelCol = 100;
sweep->setConfig(SkBitmap::kA8_Config, pixelCol, pixelRow);
sweep->allocPixels();
- sweep->eraseColor(0);
+ sweep->eraseColor(SK_ColorTRANSPARENT);
sweep->lockPixels();
void* pixels = sweep->getPixels();
create_vert((uint8_t*) pixels, pixelRow, pixelCol);
@@ -1035,7 +1035,7 @@
const int pixelCol = 150;
sweep->setConfig(SkBitmap::kA8_Config, pixelCol, pixelRow);
sweep->allocPixels();
- sweep->eraseColor(0);
+ sweep->eraseColor(SK_ColorTRANSPARENT);
sweep->lockPixels();
void* pixels = sweep->getPixels();
create_angle((uint8_t*) pixels, pixelRow, pixelCol, angle);
diff --git a/gm/aaclip.cpp b/gm/aaclip.cpp
index 8acd04d..b74f6d3 100644
--- a/gm/aaclip.cpp
+++ b/gm/aaclip.cpp
@@ -29,7 +29,7 @@
SkBitmap bm;
bm.setConfig(SkBitmap::kARGB_8888_Config, bounds.width(), bounds.height());
bm.allocPixels();
- bm.eraseColor(0);
+ bm.eraseColor(SK_ColorTRANSPARENT);
SkCanvas* canvas = new SkCanvas(bm);
canvas->translate(-SkIntToScalar(bounds.fLeft), -SkIntToScalar(bounds.fTop));
diff --git a/gm/arithmode.cpp b/gm/arithmode.cpp
index 6f10dd6..f5e1091 100644
--- a/gm/arithmode.cpp
+++ b/gm/arithmode.cpp
@@ -19,7 +19,7 @@
SkBitmap bm;
bm.setConfig(SkBitmap::kARGB_8888_Config, WW, HH);
bm.allocPixels();
- bm.eraseColor(0);
+ bm.eraseColor(SK_ColorTRANSPARENT);
return bm;
}
diff --git a/gm/drawbitmaprect.cpp b/gm/drawbitmaprect.cpp
index f9b348f..24c3431 100644
--- a/gm/drawbitmaprect.cpp
+++ b/gm/drawbitmaprect.cpp
@@ -34,7 +34,7 @@
static void makebm(SkBitmap* bm, SkBitmap::Config config, int w, int h) {
bm->setConfig(config, w, h);
bm->allocPixels();
- bm->eraseColor(0);
+ bm->eraseColor(SK_ColorTRANSPARENT);
SkCanvas canvas(*bm);
diff --git a/gm/fatpathfill.cpp b/gm/fatpathfill.cpp
index c23a4ec..4c30949 100644
--- a/gm/fatpathfill.cpp
+++ b/gm/fatpathfill.cpp
@@ -41,7 +41,7 @@
const SkPath paths[], int count) {
SkPaint paint;
- surface->getCanvas()->clear(0);
+ surface->getCanvas()->clear(SK_ColorTRANSPARENT);
for (int i = 0; i < count; ++i) {
surface->getCanvas()->drawPath(paths[i], paint);
}
diff --git a/gm/gmmain.cpp b/gm/gmmain.cpp
index 757fa70..316251e 100644
--- a/gm/gmmain.cpp
+++ b/gm/gmmain.cpp
@@ -371,7 +371,7 @@
SkBitmap* bitmap) {
bitmap->setConfig(gRec.fConfig, size.width(), size.height());
bitmap->allocPixels();
- bitmap->eraseColor(0);
+ bitmap->eraseColor(SK_ColorTRANSPARENT);
}
static void installFilter(SkCanvas* canvas) {
diff --git a/gm/imagefiltersbase.cpp b/gm/imagefiltersbase.cpp
index 7f8aeaf..c7f043e 100644
--- a/gm/imagefiltersbase.cpp
+++ b/gm/imagefiltersbase.cpp
@@ -116,7 +116,7 @@
SkBitmap bm;
bm.setConfig(SkBitmap::kARGB_8888_Config, bounds.width(), bounds.height());
bm.allocPixels();
- bm.eraseColor(0);
+ bm.eraseColor(SK_ColorTRANSPARENT);
SkCanvas c(bm);
draw_path(&c, r, NULL);
@@ -133,7 +133,7 @@
SkBitmap bm;
bm.setConfig(SkBitmap::kARGB_8888_Config, bounds.width(), bounds.height());
bm.allocPixels();
- bm.eraseColor(0);
+ bm.eraseColor(SK_ColorTRANSPARENT);
SkCanvas c(bm);
draw_path(&c, r, NULL);
diff --git a/gm/ninepatchstretch.cpp b/gm/ninepatchstretch.cpp
index 38b6f7d..773a692 100644
--- a/gm/ninepatchstretch.cpp
+++ b/gm/ninepatchstretch.cpp
@@ -34,7 +34,7 @@
SkCanvas canvas(dev);
dev->unref();
- canvas.clear(0);
+ canvas.clear(SK_ColorTRANSPARENT);
SkRect r = SkRect::MakeWH(SkIntToScalar(kSize), SkIntToScalar(kSize));
const SkScalar strokeWidth = SkIntToScalar(6);
diff --git a/gm/shadertext.cpp b/gm/shadertext.cpp
index d8641db..0e092dc 100644
--- a/gm/shadertext.cpp
+++ b/gm/shadertext.cpp
@@ -15,7 +15,7 @@
static void makebm(SkBitmap* bm, SkBitmap::Config config, int w, int h) {
bm->setConfig(config, w, h);
bm->allocPixels();
- bm->eraseColor(0);
+ bm->eraseColor(SK_ColorTRANSPARENT);
SkCanvas canvas(*bm);
SkScalar s = SkIntToScalar(SkMin32(w, h));
diff --git a/gm/shadertext2.cpp b/gm/shadertext2.cpp
index 387bd49..e760e54 100644
--- a/gm/shadertext2.cpp
+++ b/gm/shadertext2.cpp
@@ -14,7 +14,7 @@
static void makebm(SkBitmap* bm, SkBitmap::Config config, int w, int h) {
bm->setConfig(config, w, h);
bm->allocPixels();
- bm->eraseColor(0);
+ bm->eraseColor(SK_ColorTRANSPARENT);
SkCanvas canvas(*bm);
SkScalar s = SkIntToScalar(SkMin32(w, h));
diff --git a/gm/shadertext3.cpp b/gm/shadertext3.cpp
index 4e95588..ed9b33f 100644
--- a/gm/shadertext3.cpp
+++ b/gm/shadertext3.cpp
@@ -14,7 +14,7 @@
static void makebm(SkBitmap* bm, SkBitmap::Config config, int w, int h) {
bm->setConfig(config, w, h);
bm->allocPixels();
- bm->eraseColor(0);
+ bm->eraseColor(SK_ColorTRANSPARENT);
SkCanvas canvas(*bm);
SkScalar s = SkIntToScalar(SkMin32(w, h));
diff --git a/gm/tablecolorfilter.cpp b/gm/tablecolorfilter.cpp
index c8806f9..49e342d 100644
--- a/gm/tablecolorfilter.cpp
+++ b/gm/tablecolorfilter.cpp
@@ -15,7 +15,7 @@
int H = 120;
bm->setConfig(SkBitmap::kARGB_8888_Config, W, H);
bm->allocPixels();
- bm->eraseColor(0);
+ bm->eraseColor(SK_ColorTRANSPARENT);
SkCanvas canvas(*bm);
SkPaint paint;
@@ -34,7 +34,7 @@
int H = 120;
bm->setConfig(SkBitmap::kARGB_8888_Config, W, H);
bm->allocPixels();
- bm->eraseColor(0);
+ bm->eraseColor(SK_ColorTRANSPARENT);
SkCanvas canvas(*bm);
SkPaint paint;
diff --git a/gm/tilemodes.cpp b/gm/tilemodes.cpp
index ab4ea0a..d51fce2 100644
--- a/gm/tilemodes.cpp
+++ b/gm/tilemodes.cpp
@@ -22,7 +22,7 @@
static void makebm(SkBitmap* bm, SkBitmap::Config config, int w, int h) {
bm->setConfig(config, w, h);
bm->allocPixels();
- bm->eraseColor(0);
+ bm->eraseColor(SK_ColorTRANSPARENT);
SkCanvas canvas(*bm);
SkPoint pts[] = { { 0, 0 }, { SkIntToScalar(w), SkIntToScalar(h)} };
diff --git a/gm/xfermodes.cpp b/gm/xfermodes.cpp
index 22b6edd..8934bc7 100644
--- a/gm/xfermodes.cpp
+++ b/gm/xfermodes.cpp
@@ -15,7 +15,7 @@
static void make_bitmaps(int w, int h, SkBitmap* src, SkBitmap* dst) {
src->setConfig(SkBitmap::kARGB_8888_Config, w, h);
src->allocPixels();
- src->eraseColor(0);
+ src->eraseColor(SK_ColorTRANSPARENT);
SkPaint p;
p.setAntiAlias(true);
@@ -33,7 +33,7 @@
dst->setConfig(SkBitmap::kARGB_8888_Config, w, h);
dst->allocPixels();
- dst->eraseColor(0);
+ dst->eraseColor(SK_ColorTRANSPARENT);
{
SkCanvas c(*dst);
diff --git a/include/core/SkColor.h b/include/core/SkColor.h
index e6d4352..f5055d0 100644
--- a/include/core/SkColor.h
+++ b/include/core/SkColor.h
@@ -73,18 +73,20 @@
// common colors
-#define SK_ColorBLACK 0xFF000000 //!< black SkColor value
-#define SK_ColorDKGRAY 0xFF444444 //!< dark gray SkColor value
-#define SK_ColorGRAY 0xFF888888 //!< gray SkColor value
-#define SK_ColorLTGRAY 0xFFCCCCCC //!< light gray SkColor value
-#define SK_ColorWHITE 0xFFFFFFFF //!< white SkColor value
+#define SK_ColorTRANSPARENT 0x00000000 //!< transparent SkColor value
-#define SK_ColorRED 0xFFFF0000 //!< red SkColor value
-#define SK_ColorGREEN 0xFF00FF00 //!< green SkColor value
-#define SK_ColorBLUE 0xFF0000FF //!< blue SkColor value
-#define SK_ColorYELLOW 0xFFFFFF00 //!< yellow SkColor value
-#define SK_ColorCYAN 0xFF00FFFF //!< cyan SkColor value
-#define SK_ColorMAGENTA 0xFFFF00FF //!< magenta SkColor value
+#define SK_ColorBLACK 0xFF000000 //!< black SkColor value
+#define SK_ColorDKGRAY 0xFF444444 //!< dark gray SkColor value
+#define SK_ColorGRAY 0xFF888888 //!< gray SkColor value
+#define SK_ColorLTGRAY 0xFFCCCCCC //!< light gray SkColor value
+#define SK_ColorWHITE 0xFFFFFFFF //!< white SkColor value
+
+#define SK_ColorRED 0xFFFF0000 //!< red SkColor value
+#define SK_ColorGREEN 0xFF00FF00 //!< green SkColor value
+#define SK_ColorBLUE 0xFF0000FF //!< blue SkColor value
+#define SK_ColorYELLOW 0xFFFFFF00 //!< yellow SkColor value
+#define SK_ColorCYAN 0xFF00FFFF //!< cyan SkColor value
+#define SK_ColorMAGENTA 0xFFFF00FF //!< magenta SkColor value
////////////////////////////////////////////////////////////////////////
diff --git a/samplecode/SampleApp.cpp b/samplecode/SampleApp.cpp
index 0943d77..cc06e04 100644
--- a/samplecode/SampleApp.cpp
+++ b/samplecode/SampleApp.cpp
@@ -468,7 +468,7 @@
SkBitmap bm;
bm.setConfig(SkBitmap::kA8_Config, 64, 64);
bm.allocPixels();
- bm.eraseColor(0);
+ bm.eraseColor(SK_ColorTRANSPARENT);
SkCanvas canvas(bm);
diff --git a/samplecode/SampleColorFilter.cpp b/samplecode/SampleColorFilter.cpp
index bbabea2..e57ccb0 100644
--- a/samplecode/SampleColorFilter.cpp
+++ b/samplecode/SampleColorFilter.cpp
@@ -101,7 +101,7 @@
SkBitmap bitmap;
bitmap.setConfig(SkBitmap::kARGB_8888_Config, n, n);
bitmap.allocPixels();
- bitmap.eraseColor(0);
+ bitmap.eraseColor(SK_ColorTRANSPARENT);
SkCanvas canvas(bitmap);
SkRect r;
diff --git a/samplecode/SampleDither.cpp b/samplecode/SampleDither.cpp
index 7e5fc21..259bc94 100644
--- a/samplecode/SampleDither.cpp
+++ b/samplecode/SampleDither.cpp
@@ -76,7 +76,7 @@
bm->eraseColor(SK_ColorBLUE);
return;
#else
- bm->eraseColor(0);
+ bm->eraseColor(SK_ColorTRANSPARENT);
#endif
SkCanvas c(*bm);
diff --git a/samplecode/SampleFatBits.cpp b/samplecode/SampleFatBits.cpp
index eac7136..3641ec9 100644
--- a/samplecode/SampleFatBits.cpp
+++ b/samplecode/SampleFatBits.cpp
@@ -21,7 +21,7 @@
#define WIRE_FRAME_SIZE 1.5f
static void erase(SkSurface* surface) {
- surface->getCanvas()->clear(0);
+ surface->getCanvas()->clear(SK_ColorTRANSPARENT);
}
static SkShader* createChecker() {
diff --git a/samplecode/SampleHairline.cpp b/samplecode/SampleHairline.cpp
index 7aa4666..28ed68f 100644
--- a/samplecode/SampleHairline.cpp
+++ b/samplecode/SampleHairline.cpp
@@ -232,7 +232,7 @@
HEIGHT + MARGIN*2);
bm.allocPixels();
// this will erase our margin, which we want to always stay 0
- bm.eraseColor(0);
+ bm.eraseColor(SK_ColorTRANSPARENT);
bm2.setConfig(SkBitmap::kARGB_8888_Config, WIDTH, HEIGHT,
bm.rowBytes());
@@ -243,7 +243,7 @@
paint.setAntiAlias(fDoAA);
paint.setStyle(SkPaint::kStroke_Style);
- bm2.eraseColor(0);
+ bm2.eraseColor(SK_ColorTRANSPARENT);
gProcs[fProcIndex].fProc(&c2, paint, bm);
canvas->drawBitmap(bm2, SkIntToScalar(10), SkIntToScalar(10), NULL);
diff --git a/samplecode/SampleLayerMask.cpp b/samplecode/SampleLayerMask.cpp
index 78b9800..d65c131 100644
--- a/samplecode/SampleLayerMask.cpp
+++ b/samplecode/SampleLayerMask.cpp
@@ -38,7 +38,7 @@
int h = SkScalarRound(r.height());
mask.setConfig(SkBitmap::kARGB_8888_Config, w, h);
mask.allocPixels();
- mask.eraseColor(0);
+ mask.eraseColor(SK_ColorTRANSPARENT);
SkCanvas c(mask);
SkRect bounds = r;
bounds.offset(-bounds.fLeft, -bounds.fTop);
diff --git a/samplecode/SampleMipMap.cpp b/samplecode/SampleMipMap.cpp
index e0a8e4d..f3a12cd 100644
--- a/samplecode/SampleMipMap.cpp
+++ b/samplecode/SampleMipMap.cpp
@@ -16,7 +16,7 @@
SkBitmap bitmap;
bitmap.setConfig(SkBitmap::kARGB_8888_Config, n, n);
bitmap.allocPixels();
- bitmap.eraseColor(0);
+ bitmap.eraseColor(SK_ColorTRANSPARENT);
SkCanvas canvas(bitmap);
SkRect r;
@@ -83,7 +83,7 @@
SkAutoCanvasRestore acr(canvas, true);
for (int i = 0; i < 6; i++) {
- bg.eraseColor(0);
+ bg.eraseColor(SK_ColorTRANSPARENT);
SkCanvas c(bg);
c.scale(SK_Scalar1 / (1 << i), SK_Scalar1 / (1 << i));
c.drawBitmap(bitmap, 0, 0, NULL);
diff --git a/samplecode/SampleOvalTest.cpp b/samplecode/SampleOvalTest.cpp
index 340acf6..88b7d5f 100644
--- a/samplecode/SampleOvalTest.cpp
+++ b/samplecode/SampleOvalTest.cpp
@@ -45,7 +45,7 @@
SkCanvas canvas(fBitmap);
SkPaint p;
- fBitmap.eraseColor(0);
+ fBitmap.eraseColor(SK_ColorTRANSPARENT);
canvas.drawOval(SkRect::MakeSize(fSize), p);
}
diff --git a/samplecode/SamplePageFlip.cpp b/samplecode/SamplePageFlip.cpp
index 7daeb1b..1020189 100644
--- a/samplecode/SamplePageFlip.cpp
+++ b/samplecode/SamplePageFlip.cpp
@@ -120,7 +120,7 @@
fBitmaps[i].setConfig(gConfigs[i], WIDTH, HEIGHT);
SkFlipPixelRef* pr = new SkFlipPixelRef(gConfigs[i], WIDTH, HEIGHT);
fBitmaps[i].setPixelRef(pr)->unref();
- fBitmaps[i].eraseColor(0);
+ fBitmaps[i].eraseColor(SK_ColorTRANSPARENT);
status = pthread_create(&fThreads[i], &attr, draw_proc, &fBitmaps[i]);
SkASSERT(0 == status);
diff --git a/samplecode/SampleRegion.cpp b/samplecode/SampleRegion.cpp
index 269fc6a..8b3a03c 100644
--- a/samplecode/SampleRegion.cpp
+++ b/samplecode/SampleRegion.cpp
@@ -22,7 +22,7 @@
SkBitmap bitmap;
bitmap.setConfig(SkBitmap::kA8_Config, width*2, height*2);
bitmap.allocPixels();
- bitmap.eraseColor(0);
+ bitmap.eraseColor(SK_ColorTRANSPARENT);
SkScalar dx = 20;
SkScalar dy = 20;
@@ -41,12 +41,12 @@
paint.setStrokeWidth(1);
// use the rect
- c.clear(0);
+ c.clear(SK_ColorTRANSPARENT);
c.drawRect(r, paint);
canvas->drawBitmap(bitmap, 0, 0, NULL);
// use the path
- c.clear(0);
+ c.clear(SK_ColorTRANSPARENT);
c.drawPath(path, paint);
canvas->drawBitmap(bitmap, SkIntToScalar(2*width), 0, NULL);
}
diff --git a/samplecode/SampleShaderText.cpp b/samplecode/SampleShaderText.cpp
index cada977..a83b099 100644
--- a/samplecode/SampleShaderText.cpp
+++ b/samplecode/SampleShaderText.cpp
@@ -14,7 +14,7 @@
static void makebm(SkBitmap* bm, SkBitmap::Config config, int w, int h) {
bm->setConfig(config, w, h);
bm->allocPixels();
- bm->eraseColor(0);
+ bm->eraseColor(SK_ColorTRANSPARENT);
SkCanvas canvas(*bm);
SkScalar s = SkIntToScalar(w < h ? w : h);
diff --git a/samplecode/SampleStrokeText.cpp b/samplecode/SampleStrokeText.cpp
index 8245f4e..4ceb0d5 100644
--- a/samplecode/SampleStrokeText.cpp
+++ b/samplecode/SampleStrokeText.cpp
@@ -48,7 +48,7 @@
SkBitmap src;
src.setConfig(config, w, h);
src.allocPixels();
- src.eraseColor(0);
+ src.eraseColor(SK_ColorTRANSPARENT);
{
SkCanvas canvas(src);
paint.setAntiAlias(true);
diff --git a/samplecode/SampleTiling.cpp b/samplecode/SampleTiling.cpp
index e7b6a7f..59e88ea 100644
--- a/samplecode/SampleTiling.cpp
+++ b/samplecode/SampleTiling.cpp
@@ -26,7 +26,7 @@
static void makebm(SkBitmap* bm, SkBitmap::Config config, int w, int h) {
bm->setConfig(config, w, h);
bm->allocPixels();
- bm->eraseColor(0);
+ bm->eraseColor(SK_ColorTRANSPARENT);
SkCanvas canvas(*bm);
SkPoint pts[] = { { 0, 0 }, { SkIntToScalar(w), SkIntToScalar(h) } };
diff --git a/src/core/SkBitmap.cpp b/src/core/SkBitmap.cpp
index 458cb61..9d51f9b 100644
--- a/src/core/SkBitmap.cpp
+++ b/src/core/SkBitmap.cpp
@@ -1023,7 +1023,7 @@
} else {
// if the src has alpha, we have to clear the dst first
if (!src->isOpaque()) {
- tmpDst.eraseColor(0);
+ tmpDst.eraseColor(SK_ColorTRANSPARENT);
}
SkCanvas canvas(tmpDst);
diff --git a/src/core/SkDevice.cpp b/src/core/SkDevice.cpp
index 7da9a6b..56b1841 100644
--- a/src/core/SkDevice.cpp
+++ b/src/core/SkDevice.cpp
@@ -44,7 +44,7 @@
fBitmap.allocPixels();
fBitmap.setIsOpaque(isOpaque);
if (!isOpaque) {
- fBitmap.eraseColor(0);
+ fBitmap.eraseColor(SK_ColorTRANSPARENT);
}
}
diff --git a/src/core/SkScalerContext.h b/src/core/SkScalerContext.h
index b637e84..05d5bc0 100644
--- a/src/core/SkScalerContext.h
+++ b/src/core/SkScalerContext.h
@@ -74,7 +74,7 @@
* paint and device gamma to be effectively 1.0.
*/
void ignorePreBlend() {
- setLuminanceColor(0x00000000);
+ setLuminanceColor(SK_ColorTRANSPARENT);
setPaintGamma(SK_Scalar1);
setDeviceGamma(SK_Scalar1);
setContrast(0);
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index 5d04995..296af4a 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -59,12 +59,12 @@
// a sub region of a larger source image.
#define COLOR_BLEED_TOLERANCE SkFloatToScalar(0.001f)
-#define DO_DEFERRED_CLEAR() \
- do { \
- if (fNeedClear) { \
- this->clear(0x0); \
- } \
- } while (false) \
+#define DO_DEFERRED_CLEAR() \
+ do { \
+ if (fNeedClear) { \
+ this->clear(SK_ColorTRANSPARENT); \
+ } \
+ } while (false) \
///////////////////////////////////////////////////////////////////////////////
diff --git a/src/image/SkSurface_Raster.cpp b/src/image/SkSurface_Raster.cpp
index dd31819..455ef1b 100644
--- a/src/image/SkSurface_Raster.cpp
+++ b/src/image/SkSurface_Raster.cpp
@@ -103,7 +103,7 @@
fWeOwnThePixels = true;
if (!isOpaque) {
- fBitmap.eraseColor(0);
+ fBitmap.eraseColor(SK_ColorTRANSPARENT);
}
}
diff --git a/src/ports/SkImageDecoder_CG.cpp b/src/ports/SkImageDecoder_CG.cpp
index c1b63ea..d687003 100644
--- a/src/ports/SkImageDecoder_CG.cpp
+++ b/src/ports/SkImageDecoder_CG.cpp
@@ -78,7 +78,7 @@
}
bm->lockPixels();
- bm->eraseColor(0);
+ bm->eraseColor(SK_ColorTRANSPARENT);
// use the same colorspace, so we don't change the pixels at all
CGColorSpaceRef cs = CGImageGetColorSpace(image);
diff --git a/src/ports/SkImageDecoder_WIC.cpp b/src/ports/SkImageDecoder_WIC.cpp
index 5a36ace..d83611f 100644
--- a/src/ports/SkImageDecoder_WIC.cpp
+++ b/src/ports/SkImageDecoder_WIC.cpp
@@ -127,7 +127,7 @@
//Copy the pixels into the bitmap.
if (SUCCEEDED(hr)) {
SkAutoLockPixels alp(*bm);
- bm->eraseColor(0);
+ bm->eraseColor(SK_ColorTRANSPARENT);
const int stride = bm->rowBytes();
hr = piBitmapSourceConverted->CopyPixels(
NULL, //Get all the pixels
diff --git a/tests/AnnotationTest.cpp b/tests/AnnotationTest.cpp
index 17da622..586525a 100644
--- a/tests/AnnotationTest.cpp
+++ b/tests/AnnotationTest.cpp
@@ -16,7 +16,7 @@
SkBitmap bm;
bm.setConfig(SkBitmap::kARGB_8888_Config, 10, 10);
bm.allocPixels();
- bm.eraseColor(0);
+ bm.eraseColor(SK_ColorTRANSPARENT);
SkCanvas canvas(bm);
SkRect r = SkRect::MakeWH(SkIntToScalar(10), SkIntToScalar(10));
diff --git a/tests/ClipCubicTest.cpp b/tests/ClipCubicTest.cpp
index 2e913a7..e980781 100644
--- a/tests/ClipCubicTest.cpp
+++ b/tests/ClipCubicTest.cpp
@@ -20,7 +20,7 @@
bm.setConfig(SkBitmap::kARGB_8888_Config, 64919, 1);
bm.allocPixels();
SkCanvas canvas(bm);
- canvas.clear(0);
+ canvas.clear(SK_ColorTRANSPARENT);
SkPath path;
path.moveTo(0, 0); path.lineTo(1, 0); path.lineTo(33, 1);
diff --git a/tests/DrawBitmapRectTest.cpp b/tests/DrawBitmapRectTest.cpp
index 0147a71..f74199e 100644
--- a/tests/DrawBitmapRectTest.cpp
+++ b/tests/DrawBitmapRectTest.cpp
@@ -36,7 +36,7 @@
SkBitmap dev;
dev.setConfig(SkBitmap::kARGB_8888_Config, 0x56F, 0x4f6);
dev.allocPixels();
- dev.eraseColor(0); // necessary, so we know if we draw to it
+ dev.eraseColor(SK_ColorTRANSPARENT); // necessary, so we know if we draw to it
SkMatrix matrix;
diff --git a/tests/DrawPathTest.cpp b/tests/DrawPathTest.cpp
index 55e3164..171a63c 100644
--- a/tests/DrawPathTest.cpp
+++ b/tests/DrawPathTest.cpp
@@ -210,7 +210,7 @@
const int W = 400;
const int H = 400;
SkAutoTUnref<SkCanvas> canvas(new_canvas(33000, 10));
- canvas.get()->clear(0);
+ canvas.get()->clear(SK_ColorTRANSPARENT);
SkPaint paint;
paint.setAntiAlias(true);
diff --git a/tests/EmptyPathTest.cpp b/tests/EmptyPathTest.cpp
index 4cff190..be7d529 100644
--- a/tests/EmptyPathTest.cpp
+++ b/tests/EmptyPathTest.cpp
@@ -28,7 +28,7 @@
// explicitly specify a trim rowbytes, so we have no padding on each row
bm.setConfig(SkBitmap::kARGB_8888_Config, DIMENSION, DIMENSION, DIMENSION*4);
bm.allocPixels();
- bm.eraseColor(0);
+ bm.eraseColor(SK_ColorTRANSPARENT);
SkCanvas canvas(bm);
SkPaint p(paint);
diff --git a/tests/PipeTest.cpp b/tests/PipeTest.cpp
index 7790c16..acf288a 100644
--- a/tests/PipeTest.cpp
+++ b/tests/PipeTest.cpp
@@ -32,7 +32,7 @@
SkBitmap bm;
bm.setConfig(SkBitmap::kARGB_8888_Config, 2, 2);
bm.allocPixels();
- bm.eraseColor(0);
+ bm.eraseColor(SK_ColorTRANSPARENT);
SkShader* shader = SkShader::CreateBitmapShader(bm, SkShader::kClamp_TileMode,
SkShader::kClamp_TileMode);
diff --git a/tests/QuickRejectTest.cpp b/tests/QuickRejectTest.cpp
index b8fb989..0000833 100644
--- a/tests/QuickRejectTest.cpp
+++ b/tests/QuickRejectTest.cpp
@@ -41,7 +41,7 @@
SkBitmap dst;
dst.setConfig(SkBitmap::kARGB_8888_Config, 10, 10);
dst.allocPixels();
- dst.eraseColor(0);
+ dst.eraseColor(SK_ColorTRANSPARENT);
SkCanvas canvas(dst);
SkPaint paint;
@@ -54,7 +54,7 @@
REPORTER_ASSERT(reporter, 0xFFFFFFFF == *dst.getAddr32(5, 5));
// reverify we are clear again
- dst.eraseColor(0);
+ dst.eraseColor(SK_ColorTRANSPARENT);
REPORTER_ASSERT(reporter, 0 == *dst.getAddr32(5, 5));
// if the bitmap is clipped out, we don't draw it
diff --git a/tools/picture_utils.cpp b/tools/picture_utils.cpp
index b9bedbb..7a5e156 100644
--- a/tools/picture_utils.cpp
+++ b/tools/picture_utils.cpp
@@ -88,6 +88,6 @@
void setup_bitmap(SkBitmap* bitmap, int width, int height) {
bitmap->setConfig(SkBitmap::kARGB_8888_Config, width, height);
bitmap->allocPixels();
- bitmap->eraseColor(0);
+ bitmap->eraseColor(SK_ColorTRANSPARENT);
}
}