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
This commit is contained in:
parent
4eeda37a74
commit
dbfac8a723
@ -46,7 +46,7 @@ enum benchModes {
|
||||
|
||||
static void erase(SkBitmap& bm) {
|
||||
if (bm.config() == SkBitmap::kA8_Config) {
|
||||
bm.eraseColor(0);
|
||||
bm.eraseColor(SK_ColorTRANSPARENT);
|
||||
} else {
|
||||
bm.eraseColor(SK_ColorWHITE);
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -101,7 +101,7 @@ void SkDebugCanvas::drawTo(SkCanvas* canvas, int index) {
|
||||
canvas->restore();
|
||||
}
|
||||
i = 0;
|
||||
canvas->clear(0);
|
||||
canvas->clear(SK_ColorTRANSPARENT);
|
||||
canvas->resetMatrix();
|
||||
SkRect rect = SkRect::MakeWH(SkIntToScalar(fWidth),
|
||||
SkIntToScalar(fHeight));
|
||||
|
@ -999,7 +999,7 @@ void CreateSweep(SkBitmap* sweep, SkScalar rectWidth) {
|
||||
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 @@ void CreateHorz(SkBitmap* sweep) {
|
||||
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 @@ void CreateVert(SkBitmap* sweep) {
|
||||
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 @@ void CreateAngle(SkBitmap* sweep, SkScalar angle) {
|
||||
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);
|
||||
|
@ -29,7 +29,7 @@ static SkCanvas* MakeCanvas(const SkIRect& bounds) {
|
||||
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));
|
||||
|
@ -19,7 +19,7 @@ static SkBitmap make_bm() {
|
||||
SkBitmap bm;
|
||||
bm.setConfig(SkBitmap::kARGB_8888_Config, WW, HH);
|
||||
bm.allocPixels();
|
||||
bm.eraseColor(0);
|
||||
bm.eraseColor(SK_ColorTRANSPARENT);
|
||||
return bm;
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ static SkBitmap make_chessbm(int w, int h) {
|
||||
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);
|
||||
|
||||
|
@ -41,7 +41,7 @@ static void draw_fatpath(SkCanvas* canvas, SkSurface* surface,
|
||||
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);
|
||||
}
|
||||
|
@ -371,7 +371,7 @@ public:
|
||||
SkBitmap* bitmap) {
|
||||
bitmap->setConfig(gRec.fConfig, size.width(), size.height());
|
||||
bitmap->allocPixels();
|
||||
bitmap->eraseColor(0);
|
||||
bitmap->eraseColor(SK_ColorTRANSPARENT);
|
||||
}
|
||||
|
||||
static void installFilter(SkCanvas* canvas) {
|
||||
|
@ -116,7 +116,7 @@ static void draw_bitmap(SkCanvas* canvas, const SkRect& r, SkImageFilter* imf) {
|
||||
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 @@ static void draw_sprite(SkCanvas* canvas, const SkRect& r, SkImageFilter* imf) {
|
||||
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);
|
||||
|
||||
|
@ -34,7 +34,7 @@ static void make_bitmap(SkBitmap* bitmap, GrContext* ctx, SkIRect* center) {
|
||||
|
||||
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);
|
||||
|
@ -15,7 +15,7 @@ namespace skiagm {
|
||||
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));
|
||||
|
@ -14,7 +14,7 @@ namespace skiagm {
|
||||
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));
|
||||
|
@ -14,7 +14,7 @@ namespace skiagm {
|
||||
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));
|
||||
|
@ -15,7 +15,7 @@ static void make_bm0(SkBitmap* bm) {
|
||||
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 @@ static void make_bm1(SkBitmap* bm) {
|
||||
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;
|
||||
|
@ -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)} };
|
||||
|
@ -15,7 +15,7 @@ namespace skiagm {
|
||||
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 @@ static void make_bitmaps(int w, int h, SkBitmap* src, SkBitmap* dst) {
|
||||
|
||||
dst->setConfig(SkBitmap::kARGB_8888_Config, w, h);
|
||||
dst->allocPixels();
|
||||
dst->eraseColor(0);
|
||||
dst->eraseColor(SK_ColorTRANSPARENT);
|
||||
|
||||
{
|
||||
SkCanvas c(*dst);
|
||||
|
@ -73,18 +73,20 @@ static inline SkColor SkColorSetA(SkColor c, U8CPU a) {
|
||||
|
||||
// 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
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -468,7 +468,7 @@ static void testpdf() {
|
||||
SkBitmap bm;
|
||||
bm.setConfig(SkBitmap::kA8_Config, 64, 64);
|
||||
bm.allocPixels();
|
||||
bm.eraseColor(0);
|
||||
bm.eraseColor(SK_ColorTRANSPARENT);
|
||||
|
||||
SkCanvas canvas(bm);
|
||||
|
||||
|
@ -101,7 +101,7 @@ static SkBitmap createBitmap(int n) {
|
||||
SkBitmap bitmap;
|
||||
bitmap.setConfig(SkBitmap::kARGB_8888_Config, n, n);
|
||||
bitmap.allocPixels();
|
||||
bitmap.eraseColor(0);
|
||||
bitmap.eraseColor(SK_ColorTRANSPARENT);
|
||||
|
||||
SkCanvas canvas(bitmap);
|
||||
SkRect r;
|
||||
|
@ -76,7 +76,7 @@ static void make_bm(SkBitmap* bm) {
|
||||
bm->eraseColor(SK_ColorBLUE);
|
||||
return;
|
||||
#else
|
||||
bm->eraseColor(0);
|
||||
bm->eraseColor(SK_ColorTRANSPARENT);
|
||||
#endif
|
||||
|
||||
SkCanvas c(*bm);
|
||||
|
@ -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() {
|
||||
|
@ -232,7 +232,7 @@ protected:
|
||||
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 @@ protected:
|
||||
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);
|
||||
|
||||
|
@ -38,7 +38,7 @@ protected:
|
||||
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);
|
||||
|
@ -16,7 +16,7 @@ static SkBitmap createBitmap(int n) {
|
||||
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 @@ protected:
|
||||
|
||||
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);
|
||||
|
@ -45,7 +45,7 @@ protected:
|
||||
SkCanvas canvas(fBitmap);
|
||||
SkPaint p;
|
||||
|
||||
fBitmap.eraseColor(0);
|
||||
fBitmap.eraseColor(SK_ColorTRANSPARENT);
|
||||
canvas.drawOval(SkRect::MakeSize(fSize), p);
|
||||
}
|
||||
|
||||
|
@ -120,7 +120,7 @@ public:
|
||||
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);
|
||||
|
@ -22,7 +22,7 @@ static void test_strokerect(SkCanvas* canvas) {
|
||||
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 @@ static void test_strokerect(SkCanvas* canvas) {
|
||||
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);
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -48,7 +48,7 @@ static void lettersToBitmap(SkBitmap* dst, const char chars[],
|
||||
SkBitmap src;
|
||||
src.setConfig(config, w, h);
|
||||
src.allocPixels();
|
||||
src.eraseColor(0);
|
||||
src.eraseColor(SK_ColorTRANSPARENT);
|
||||
{
|
||||
SkCanvas canvas(src);
|
||||
paint.setAntiAlias(true);
|
||||
|
@ -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) } };
|
||||
|
@ -1023,7 +1023,7 @@ bool SkBitmap::copyTo(SkBitmap* dst, Config dstConfig, Allocator* alloc) const {
|
||||
} 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);
|
||||
|
@ -44,7 +44,7 @@ SkDevice::SkDevice(SkBitmap::Config config, int width, int height, bool isOpaque
|
||||
fBitmap.allocPixels();
|
||||
fBitmap.setIsOpaque(isOpaque);
|
||||
if (!isOpaque) {
|
||||
fBitmap.eraseColor(0);
|
||||
fBitmap.eraseColor(SK_ColorTRANSPARENT);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -74,7 +74,7 @@ struct SkScalerContextRec {
|
||||
* paint and device gamma to be effectively 1.0.
|
||||
*/
|
||||
void ignorePreBlend() {
|
||||
setLuminanceColor(0x00000000);
|
||||
setLuminanceColor(SK_ColorTRANSPARENT);
|
||||
setPaintGamma(SK_Scalar1);
|
||||
setDeviceGamma(SK_Scalar1);
|
||||
setContrast(0);
|
||||
|
@ -59,12 +59,12 @@ enum {
|
||||
// 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) \
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -103,7 +103,7 @@ SkSurface_Raster::SkSurface_Raster(const SkImage::Info& info, SkPixelRef* pr, si
|
||||
fWeOwnThePixels = true;
|
||||
|
||||
if (!isOpaque) {
|
||||
fBitmap.eraseColor(0);
|
||||
fBitmap.eraseColor(SK_ColorTRANSPARENT);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -78,7 +78,7 @@ bool SkImageDecoder_CG::onDecode(SkStream* stream, SkBitmap* bm, Mode mode) {
|
||||
}
|
||||
|
||||
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);
|
||||
|
@ -127,7 +127,7 @@ bool SkImageDecoder_WIC::onDecode(SkStream* stream, SkBitmap* bm, Mode mode) {
|
||||
//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
|
||||
|
@ -16,7 +16,7 @@ static void test_nodraw(skiatest::Reporter* reporter) {
|
||||
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));
|
||||
|
@ -20,7 +20,7 @@ static void test_giantClip() {
|
||||
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);
|
||||
|
@ -36,7 +36,7 @@ static void test_wacky_bitmapshader(skiatest::Reporter* reporter,
|
||||
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;
|
||||
|
||||
|
@ -210,7 +210,7 @@ static void test_giantaa(skiatest::Reporter* reporter) {
|
||||
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);
|
||||
|
@ -28,7 +28,7 @@ static void drawAndTest(skiatest::Reporter* reporter, const SkPath& path,
|
||||
// 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);
|
||||
|
@ -32,7 +32,7 @@ static void testDrawingAfterEndRecording(SkCanvas* canvas) {
|
||||
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);
|
||||
|
@ -41,7 +41,7 @@ static void test_drawBitmap(skiatest::Reporter* reporter) {
|
||||
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 @@ static void test_drawBitmap(skiatest::Reporter* reporter) {
|
||||
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
|
||||
|
@ -88,6 +88,6 @@ namespace sk_tools {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user