add SkCanvas::clear(SkColor color) to call the new virtual clear on device.
git-svn-id: http://skia.googlecode.com/svn/trunk@1131 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
parent
398109cc3e
commit
2a98181f04
@ -391,9 +391,26 @@ public:
|
||||
void drawColor(SkColor color,
|
||||
SkXfermode::Mode mode = SkXfermode::kSrcOver_Mode);
|
||||
|
||||
/** Fill the entire canvas' bitmap (restricted to the current clip) with the
|
||||
specified paint.
|
||||
@param paint The paint used to fill the canvas
|
||||
/**
|
||||
* This erases the entire drawing surface to the specified color,
|
||||
* irrespective of the clip. It does not blend with the previous pixels,
|
||||
* but always overwrites them.
|
||||
*
|
||||
* It is roughly equivalent to the following:
|
||||
* canvas.save();
|
||||
* canvas.clipRect(hugeRect, kReplace_Op);
|
||||
* paint.setColor(color);
|
||||
* paint.setXfermodeMode(kSrc_Mode);
|
||||
* canvas.drawPaint(paint);
|
||||
* canvas.restore();
|
||||
* though it is almost always much more efficient.
|
||||
*/
|
||||
virtual void clear(SkColor);
|
||||
|
||||
/**
|
||||
* Fill the entire canvas' bitmap (restricted to the current clip) with the
|
||||
* specified paint.
|
||||
* @param paint The paint used to fill the canvas
|
||||
*/
|
||||
virtual void drawPaint(const SkPaint& paint);
|
||||
|
||||
|
@ -1194,6 +1194,14 @@ SkDevice* SkCanvas::createDevice(SkBitmap::Config config, int width, int height,
|
||||
// These are the virtual drawing methods
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void SkCanvas::clear(SkColor color) {
|
||||
SkDrawIter iter(this);
|
||||
|
||||
while (iter.next()) {
|
||||
iter.fDevice->clear(color);
|
||||
}
|
||||
}
|
||||
|
||||
void SkCanvas::drawPaint(const SkPaint& paint) {
|
||||
LOOPER_BEGIN(paint, SkDrawFilter::kPaint_Type)
|
||||
|
||||
|
@ -18,6 +18,7 @@ enum DrawType {
|
||||
DRAW_BITMAP,
|
||||
DRAW_BITMAP_MATRIX,
|
||||
DRAW_BITMAP_RECT,
|
||||
DRAW_CLEAR,
|
||||
DRAW_DATA,
|
||||
DRAW_PAINT,
|
||||
DRAW_PATH,
|
||||
|
@ -589,6 +589,9 @@ void SkPicturePlayback::draw(SkCanvas& canvas) {
|
||||
const SkMatrix* matrix = getMatrix();
|
||||
canvas.drawBitmapMatrix(bitmap, *matrix, paint);
|
||||
} break;
|
||||
case DRAW_CLEAR:
|
||||
canvas.clear(getInt());
|
||||
break;
|
||||
case DRAW_DATA: {
|
||||
size_t length = getInt();
|
||||
canvas.drawData(fReader.skip(length), length);
|
||||
|
@ -166,6 +166,12 @@ bool SkPictureRecord::clipRegion(const SkRegion& region, SkRegion::Op op) {
|
||||
return this->INHERITED::clipRegion(region, op);
|
||||
}
|
||||
|
||||
void SkPictureRecord::clear(SkColor color) {
|
||||
addDraw(DRAW_CLEAR);
|
||||
addInt(color);
|
||||
validate();
|
||||
}
|
||||
|
||||
void SkPictureRecord::drawPaint(const SkPaint& paint) {
|
||||
addDraw(DRAW_PAINT);
|
||||
addPaint(paint);
|
||||
|
@ -27,6 +27,7 @@ public:
|
||||
virtual bool clipRect(const SkRect& rect, SkRegion::Op op);
|
||||
virtual bool clipPath(const SkPath& path, SkRegion::Op op);
|
||||
virtual bool clipRegion(const SkRegion& region, SkRegion::Op op);
|
||||
virtual void clear(SkColor);
|
||||
virtual void drawPaint(const SkPaint& paint);
|
||||
virtual void drawPoints(PointMode, size_t count, const SkPoint pts[],
|
||||
const SkPaint&);
|
||||
|
Loading…
Reference in New Issue
Block a user