If the path is a rect, call drawRect to raster the geometry in SkCanvas::drawPath to get better performance.
R=bsalomon@google.com, robertphillips@google.com, reed@google.com Author: yunchao.he@intel.com Review URL: https://codereview.chromium.org/23484007 git-svn-id: http://skia.googlecode.com/svn/trunk@11842 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
parent
627f66283b
commit
521a46750d
@ -55,10 +55,8 @@ public:
|
||||
virtual void drawPaint(const SkPaint& paint) {}
|
||||
virtual void drawPoints(PointMode mode, size_t count, const SkPoint pts[],
|
||||
const SkPaint& paint) {}
|
||||
virtual void drawRect(const SkRect& rect, const SkPaint& paint) {}
|
||||
virtual void drawOval(const SkRect& oval, const SkPaint&) {}
|
||||
virtual void drawRRect(const SkRRect& rrect, const SkPaint& paint) {}
|
||||
virtual void drawPath(const SkPath& path, const SkPaint& paint) {}
|
||||
virtual void drawBitmap(const SkBitmap& bitmap, SkScalar left, SkScalar top,
|
||||
const SkPaint* paint = NULL) {}
|
||||
virtual void drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect* src,
|
||||
@ -95,6 +93,8 @@ public:
|
||||
virtual SkDrawFilter* setDrawFilter(SkDrawFilter* filter) {return NULL;}
|
||||
|
||||
protected:
|
||||
virtual void onDrawRect(const SkRect& rect, const SkPaint& paint) {}
|
||||
virtual void onDrawPath(const SkPath& path, const SkPaint& paint) {}
|
||||
virtual SkCanvas* canvasForDrawIter() {return NULL;}
|
||||
virtual SkBaseDevice* setDevice(SkBaseDevice* device) {return NULL;}
|
||||
|
||||
|
@ -135,7 +135,7 @@ static int showPathContour(SkPath::Iter& iter) {
|
||||
}
|
||||
|
||||
class PathCanvas : public SkCanvas {
|
||||
virtual void drawPath(const SkPath& path, const SkPaint& paint) {
|
||||
virtual void onDrawPath(const SkPath& path, const SkPaint& paint) {
|
||||
if (nameonly) {
|
||||
SkDebugf(" %s%d,\n", filename.c_str(), ++count);
|
||||
return;
|
||||
|
@ -575,16 +575,20 @@ public:
|
||||
will be filled or stroked based on the Style in the paint.
|
||||
@param rect The rect to be drawn
|
||||
@param paint The paint used to draw the rect
|
||||
|
||||
Overriding this function is deprecated. It will be made non-virtual
|
||||
soon. Instead override onDrawRect.
|
||||
*/
|
||||
virtual void drawRect(const SkRect& rect, const SkPaint& paint);
|
||||
virtual void drawRect(const SkRect& rect, const SkPaint& paint) {
|
||||
this->onDrawRect(rect, paint);
|
||||
}
|
||||
|
||||
/** Draw the specified rectangle using the specified paint. The rectangle
|
||||
will be filled or framed based on the Style in the paint.
|
||||
@param rect The rect to be drawn
|
||||
@param paint The paint used to draw the rect
|
||||
*/
|
||||
void drawIRect(const SkIRect& rect, const SkPaint& paint)
|
||||
{
|
||||
void drawIRect(const SkIRect& rect, const SkPaint& paint) {
|
||||
SkRect r;
|
||||
r.set(rect); // promotes the ints to scalars
|
||||
this->drawRect(r, paint);
|
||||
@ -656,8 +660,18 @@ public:
|
||||
filled or framed based on the Style in the paint.
|
||||
@param path The path to be drawn
|
||||
@param paint The paint used to draw the path
|
||||
|
||||
Overriding this function is deprecated. It will be made non-virtual
|
||||
soon. Instead override onDrawRect.
|
||||
*/
|
||||
virtual void drawPath(const SkPath& path, const SkPaint& paint);
|
||||
virtual void drawPath(const SkPath& path, const SkPaint& paint) {
|
||||
SkRect rect;
|
||||
if (path.isRect(&rect)) {
|
||||
this->onDrawRect(rect, paint);
|
||||
} else {
|
||||
this->onDrawPath(path, paint);
|
||||
}
|
||||
}
|
||||
|
||||
/** Draw the specified bitmap, with its top/left corner at (x,y), using the
|
||||
specified paint, transformed by the current matrix. Note: if the paint
|
||||
@ -1034,6 +1048,10 @@ protected:
|
||||
// can perform copy-on-write or invalidate any cached images
|
||||
void predrawNotify();
|
||||
|
||||
virtual void onDrawRect(const SkRect& rect, const SkPaint& paint);
|
||||
|
||||
virtual void onDrawPath(const SkPath& path, const SkPaint& paint);
|
||||
|
||||
/** DEPRECATED -- use constructor(device)
|
||||
|
||||
Marked as 'protected' to avoid new clients using this before we can
|
||||
|
@ -162,10 +162,7 @@ public:
|
||||
virtual void drawPoints(PointMode mode, size_t count, const SkPoint pts[],
|
||||
const SkPaint& paint) SK_OVERRIDE;
|
||||
virtual void drawOval(const SkRect&, const SkPaint& paint) SK_OVERRIDE;
|
||||
virtual void drawRect(const SkRect& rect, const SkPaint& paint) SK_OVERRIDE;
|
||||
virtual void drawRRect(const SkRRect&, const SkPaint& paint) SK_OVERRIDE;
|
||||
virtual void drawPath(const SkPath& path, const SkPaint& paint)
|
||||
SK_OVERRIDE;
|
||||
virtual void drawBitmap(const SkBitmap& bitmap, SkScalar left,
|
||||
SkScalar top, const SkPaint* paint)
|
||||
SK_OVERRIDE;
|
||||
@ -234,6 +231,8 @@ public:
|
||||
};
|
||||
|
||||
protected:
|
||||
virtual void onDrawRect(const SkRect& rect, const SkPaint& paint) SK_OVERRIDE;
|
||||
virtual void onDrawPath(const SkPath& path, const SkPaint& paint) SK_OVERRIDE;
|
||||
virtual SkCanvas* canvasForDrawIter();
|
||||
DeferredDevice* getDeferredDevice() const;
|
||||
|
||||
|
@ -93,9 +93,7 @@ public:
|
||||
virtual void drawPoints(PointMode mode, size_t count, const SkPoint pts[],
|
||||
const SkPaint& paint) SK_OVERRIDE;
|
||||
virtual void drawOval(const SkRect&, const SkPaint& paint) SK_OVERRIDE;
|
||||
virtual void drawRect(const SkRect&, const SkPaint& paint) SK_OVERRIDE;
|
||||
virtual void drawRRect(const SkRRect&, const SkPaint& paint) SK_OVERRIDE;
|
||||
virtual void drawPath(const SkPath& path, const SkPaint& paint) SK_OVERRIDE;
|
||||
virtual void drawBitmap(const SkBitmap& bitmap, SkScalar left, SkScalar top,
|
||||
const SkPaint* paint) SK_OVERRIDE;
|
||||
virtual void drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect* src,
|
||||
@ -126,6 +124,10 @@ public:
|
||||
virtual void addComment(const char* kywd, const char* value) SK_OVERRIDE;
|
||||
virtual void endCommentGroup() SK_OVERRIDE;
|
||||
|
||||
protected:
|
||||
virtual void onDrawRect(const SkRect&, const SkPaint& paint) SK_OVERRIDE;
|
||||
virtual void onDrawPath(const SkPath& path, const SkPaint& paint) SK_OVERRIDE;
|
||||
|
||||
private:
|
||||
Dumper* fDumper;
|
||||
int fNestLevel; // for nesting recursive elements like pictures
|
||||
|
@ -42,9 +42,7 @@ public:
|
||||
virtual void drawPoints(PointMode mode, size_t count, const SkPoint pts[],
|
||||
const SkPaint& paint) SK_OVERRIDE;
|
||||
virtual void drawOval(const SkRect&, const SkPaint& paint) SK_OVERRIDE;
|
||||
virtual void drawRect(const SkRect&, const SkPaint& paint) SK_OVERRIDE;
|
||||
virtual void drawRRect(const SkRRect&, const SkPaint& paint) SK_OVERRIDE;
|
||||
virtual void drawPath(const SkPath& path, const SkPaint& paint) SK_OVERRIDE;
|
||||
virtual void drawBitmap(const SkBitmap& bitmap, SkScalar left, SkScalar top,
|
||||
const SkPaint* paint) SK_OVERRIDE;
|
||||
virtual void drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect* src,
|
||||
@ -72,6 +70,10 @@ public:
|
||||
const SkPaint& paint) SK_OVERRIDE;
|
||||
virtual void drawData(const void* data, size_t length) SK_OVERRIDE;
|
||||
|
||||
protected:
|
||||
virtual void onDrawRect(const SkRect&, const SkPaint& paint) SK_OVERRIDE;
|
||||
virtual void onDrawPath(const SkPath& path, const SkPaint& paint) SK_OVERRIDE;
|
||||
|
||||
private:
|
||||
lua_State* fL;
|
||||
SkString fFunc;
|
||||
|
@ -43,9 +43,7 @@ public:
|
||||
virtual void drawPoints(PointMode mode, size_t count, const SkPoint pts[],
|
||||
const SkPaint&) SK_OVERRIDE;
|
||||
virtual void drawOval(const SkRect&, const SkPaint&) SK_OVERRIDE;
|
||||
virtual void drawRect(const SkRect&, const SkPaint&) SK_OVERRIDE;
|
||||
virtual void drawRRect(const SkRRect&, const SkPaint&) SK_OVERRIDE;
|
||||
virtual void drawPath(const SkPath& path, const SkPaint&) SK_OVERRIDE;
|
||||
virtual void drawBitmap(const SkBitmap& bitmap, SkScalar left, SkScalar top,
|
||||
const SkPaint*) SK_OVERRIDE;
|
||||
virtual void drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect* src,
|
||||
@ -80,6 +78,8 @@ public:
|
||||
virtual void endCommentGroup() SK_OVERRIDE;
|
||||
|
||||
protected:
|
||||
virtual void onDrawRect(const SkRect&, const SkPaint&) SK_OVERRIDE;
|
||||
virtual void onDrawPath(const SkPath& path, const SkPaint&) SK_OVERRIDE;
|
||||
SkTDArray<SkCanvas*> fList;
|
||||
|
||||
class Iter;
|
||||
|
@ -48,9 +48,7 @@ public:
|
||||
virtual void drawPoints(PointMode mode, size_t count, const SkPoint pts[],
|
||||
const SkPaint& paint) SK_OVERRIDE;
|
||||
virtual void drawOval(const SkRect&, const SkPaint& paint) SK_OVERRIDE;
|
||||
virtual void drawRect(const SkRect&, const SkPaint& paint) SK_OVERRIDE;
|
||||
virtual void drawRRect(const SkRRect&, const SkPaint& paint) SK_OVERRIDE;
|
||||
virtual void drawPath(const SkPath& path, const SkPaint& paint) SK_OVERRIDE;
|
||||
virtual void drawBitmap(const SkBitmap& bitmap, SkScalar left, SkScalar top,
|
||||
const SkPaint* paint = NULL) SK_OVERRIDE;
|
||||
virtual void drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect* src,
|
||||
@ -85,6 +83,10 @@ public:
|
||||
virtual SkBounder* setBounder(SkBounder* bounder) SK_OVERRIDE;
|
||||
virtual SkDrawFilter* setDrawFilter(SkDrawFilter* filter) SK_OVERRIDE;
|
||||
|
||||
protected:
|
||||
virtual void onDrawRect(const SkRect&, const SkPaint& paint) SK_OVERRIDE;
|
||||
virtual void onDrawPath(const SkPath& path, const SkPaint& paint) SK_OVERRIDE;
|
||||
|
||||
private:
|
||||
SkCanvas* fProxy;
|
||||
|
||||
|
@ -20,23 +20,23 @@ void SkBBoxRecord::drawRRect(const SkRRect& rrect, const SkPaint& paint) {
|
||||
}
|
||||
}
|
||||
|
||||
void SkBBoxRecord::drawRect(const SkRect& rect, const SkPaint& paint) {
|
||||
void SkBBoxRecord::onDrawRect(const SkRect& rect, const SkPaint& paint) {
|
||||
if (this->transformBounds(rect, &paint)) {
|
||||
INHERITED::drawRect(rect, paint);
|
||||
INHERITED::onDrawRect(rect, paint);
|
||||
}
|
||||
}
|
||||
|
||||
void SkBBoxRecord::drawPath(const SkPath& path, const SkPaint& paint) {
|
||||
void SkBBoxRecord::onDrawPath(const SkPath& path, const SkPaint& paint) {
|
||||
if (path.isInverseFillType()) {
|
||||
// If path is inverse filled, use the current clip bounds as the
|
||||
// path's device-space bounding box.
|
||||
SkIRect clipBounds;
|
||||
if (this->getClipDeviceBounds(&clipBounds)) {
|
||||
this->handleBBox(SkRect::MakeFromIRect(clipBounds));
|
||||
INHERITED::drawPath(path, paint);
|
||||
INHERITED::onDrawPath(path, paint);
|
||||
}
|
||||
} else if (this->transformBounds(path.getBounds(), &paint)) {
|
||||
INHERITED::drawPath(path, paint);
|
||||
INHERITED::onDrawPath(path, paint);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -31,8 +31,6 @@ public:
|
||||
|
||||
virtual void drawOval(const SkRect& rect, const SkPaint& paint) SK_OVERRIDE;
|
||||
virtual void drawRRect(const SkRRect& rrect, const SkPaint& paint) SK_OVERRIDE;
|
||||
virtual void drawRect(const SkRect& rect, const SkPaint& paint) SK_OVERRIDE;
|
||||
virtual void drawPath(const SkPath& path, const SkPaint& paint) SK_OVERRIDE;
|
||||
virtual void drawPoints(PointMode mode, size_t count, const SkPoint pts[],
|
||||
const SkPaint& paint) SK_OVERRIDE;
|
||||
virtual void drawPaint(const SkPaint& paint) SK_OVERRIDE;
|
||||
@ -65,6 +63,10 @@ public:
|
||||
const SkPaint& paint) SK_OVERRIDE;
|
||||
virtual void drawPicture(SkPicture& picture) SK_OVERRIDE;
|
||||
|
||||
protected:
|
||||
virtual void onDrawRect(const SkRect& rect, const SkPaint& paint) SK_OVERRIDE;
|
||||
virtual void onDrawPath(const SkPath& path, const SkPaint& paint) SK_OVERRIDE;
|
||||
|
||||
private:
|
||||
/**
|
||||
* Takes a bounding box in current canvas view space, accounts for stroking and effects, and
|
||||
|
@ -1631,7 +1631,7 @@ void SkCanvas::drawPoints(PointMode mode, size_t count, const SkPoint pts[],
|
||||
LOOPER_END
|
||||
}
|
||||
|
||||
void SkCanvas::drawRect(const SkRect& r, const SkPaint& paint) {
|
||||
void SkCanvas::onDrawRect(const SkRect& r, const SkPaint& paint) {
|
||||
CHECK_SHADER_NOSETCONTEXT(paint);
|
||||
|
||||
if (paint.canComputeFastBounds()) {
|
||||
@ -1699,7 +1699,7 @@ void SkCanvas::drawRRect(const SkRRect& rrect, const SkPaint& paint) {
|
||||
}
|
||||
|
||||
|
||||
void SkCanvas::drawPath(const SkPath& path, const SkPaint& paint) {
|
||||
void SkCanvas::onDrawPath(const SkPath& path, const SkPaint& paint) {
|
||||
CHECK_SHADER_NOSETCONTEXT(paint);
|
||||
|
||||
if (!path.isFinite()) {
|
||||
|
@ -868,7 +868,7 @@ void SkPictureRecord::drawOval(const SkRect& oval, const SkPaint& paint) {
|
||||
this->validate(initialOffset, size);
|
||||
}
|
||||
|
||||
void SkPictureRecord::drawRect(const SkRect& rect, const SkPaint& paint) {
|
||||
void SkPictureRecord::onDrawRect(const SkRect& rect, const SkPaint& paint) {
|
||||
// op + paint index + rect
|
||||
uint32_t size = 2 * kUInt32Size + sizeof(rect);
|
||||
size_t initialOffset = this->addDraw(DRAW_RECT, &size);
|
||||
@ -895,7 +895,7 @@ void SkPictureRecord::drawRRect(const SkRRect& rrect, const SkPaint& paint) {
|
||||
}
|
||||
}
|
||||
|
||||
void SkPictureRecord::drawPath(const SkPath& path, const SkPaint& paint) {
|
||||
void SkPictureRecord::onDrawPath(const SkPath& path, const SkPaint& paint) {
|
||||
// op + paint index + path index
|
||||
uint32_t size = 3 * kUInt32Size;
|
||||
size_t initialOffset = this->addDraw(DRAW_PATH, &size);
|
||||
|
@ -53,9 +53,7 @@ public:
|
||||
virtual void drawPoints(PointMode, size_t count, const SkPoint pts[],
|
||||
const SkPaint&) SK_OVERRIDE;
|
||||
virtual void drawOval(const SkRect&, const SkPaint&) SK_OVERRIDE;
|
||||
virtual void drawRect(const SkRect&, const SkPaint&) SK_OVERRIDE;
|
||||
virtual void drawRRect(const SkRRect&, const SkPaint&) SK_OVERRIDE;
|
||||
virtual void drawPath(const SkPath& path, const SkPaint&) SK_OVERRIDE;
|
||||
virtual void drawBitmap(const SkBitmap&, SkScalar left, SkScalar top,
|
||||
const SkPaint*) SK_OVERRIDE;
|
||||
virtual void drawBitmapRectToRect(const SkBitmap&, const SkRect* src,
|
||||
@ -106,6 +104,10 @@ public:
|
||||
void beginRecording();
|
||||
void endRecording();
|
||||
|
||||
protected:
|
||||
virtual void onDrawRect(const SkRect&, const SkPaint&) SK_OVERRIDE;
|
||||
virtual void onDrawPath(const SkPath& path, const SkPaint&) SK_OVERRIDE;
|
||||
|
||||
private:
|
||||
void handleOptimization(int opt);
|
||||
void recordRestoreOffsetPlaceholder(SkRegion::Op);
|
||||
|
@ -224,9 +224,7 @@ public:
|
||||
virtual void drawPoints(PointMode, size_t count, const SkPoint pts[],
|
||||
const SkPaint&) SK_OVERRIDE;
|
||||
virtual void drawOval(const SkRect&, const SkPaint&) SK_OVERRIDE;
|
||||
virtual void drawRect(const SkRect& rect, const SkPaint&) SK_OVERRIDE;
|
||||
virtual void drawRRect(const SkRRect&, const SkPaint&) SK_OVERRIDE;
|
||||
virtual void drawPath(const SkPath& path, const SkPaint&) SK_OVERRIDE;
|
||||
virtual void drawBitmap(const SkBitmap&, SkScalar left, SkScalar top,
|
||||
const SkPaint*) SK_OVERRIDE;
|
||||
virtual void drawBitmapRectToRect(const SkBitmap&, const SkRect* src,
|
||||
@ -264,6 +262,11 @@ public:
|
||||
* according to slot.
|
||||
*/
|
||||
bool shuttleBitmap(const SkBitmap&, int32_t slot);
|
||||
|
||||
protected:
|
||||
virtual void onDrawRect(const SkRect& rect, const SkPaint&) SK_OVERRIDE;
|
||||
virtual void onDrawPath(const SkPath& path, const SkPaint&) SK_OVERRIDE;
|
||||
|
||||
private:
|
||||
enum {
|
||||
kNoSaveLayer = -1,
|
||||
@ -715,7 +718,7 @@ void SkGPipeCanvas::drawOval(const SkRect& rect, const SkPaint& paint) {
|
||||
}
|
||||
}
|
||||
|
||||
void SkGPipeCanvas::drawRect(const SkRect& rect, const SkPaint& paint) {
|
||||
void SkGPipeCanvas::onDrawRect(const SkRect& rect, const SkPaint& paint) {
|
||||
NOTIFY_SETUP(this);
|
||||
this->writePaint(paint);
|
||||
if (this->needOpBytes(sizeof(SkRect))) {
|
||||
@ -733,7 +736,7 @@ void SkGPipeCanvas::drawRRect(const SkRRect& rrect, const SkPaint& paint) {
|
||||
}
|
||||
}
|
||||
|
||||
void SkGPipeCanvas::drawPath(const SkPath& path, const SkPaint& paint) {
|
||||
void SkGPipeCanvas::onDrawPath(const SkPath& path, const SkPaint& paint) {
|
||||
NOTIFY_SETUP(this);
|
||||
this->writePaint(paint);
|
||||
if (this->needOpBytes(path.writeToMemory(NULL))) {
|
||||
|
@ -846,7 +846,7 @@ void SkDeferredCanvas::drawOval(const SkRect& rect, const SkPaint& paint) {
|
||||
this->recordedDrawCommand();
|
||||
}
|
||||
|
||||
void SkDeferredCanvas::drawRect(const SkRect& rect, const SkPaint& paint) {
|
||||
void SkDeferredCanvas::onDrawRect(const SkRect& rect, const SkPaint& paint) {
|
||||
if (fDeferredDrawing && this->isFullFrame(&rect, &paint) &&
|
||||
isPaintOpaque(&paint)) {
|
||||
this->getDeferredDevice()->skipPendingCommands();
|
||||
@ -869,7 +869,7 @@ void SkDeferredCanvas::drawRRect(const SkRRect& rrect, const SkPaint& paint) {
|
||||
}
|
||||
}
|
||||
|
||||
void SkDeferredCanvas::drawPath(const SkPath& path, const SkPaint& paint) {
|
||||
void SkDeferredCanvas::onDrawPath(const SkPath& path, const SkPaint& paint) {
|
||||
AutoImmediateDrawIfNeeded autoDraw(*this, &paint);
|
||||
this->drawingCanvas()->drawPath(path, paint);
|
||||
this->recordedDrawCommand();
|
||||
|
@ -323,7 +323,7 @@ void SkDumpCanvas::drawOval(const SkRect& rect, const SkPaint& paint) {
|
||||
this->dump(kDrawOval_Verb, &paint, "drawOval(%s)", str.c_str());
|
||||
}
|
||||
|
||||
void SkDumpCanvas::drawRect(const SkRect& rect, const SkPaint& paint) {
|
||||
void SkDumpCanvas::onDrawRect(const SkRect& rect, const SkPaint& paint) {
|
||||
SkString str;
|
||||
toString(rect, &str);
|
||||
this->dump(kDrawRect_Verb, &paint, "drawRect(%s)", str.c_str());
|
||||
@ -335,7 +335,7 @@ void SkDumpCanvas::drawRRect(const SkRRect& rrect, const SkPaint& paint) {
|
||||
this->dump(kDrawRRect_Verb, &paint, "drawRRect(%s)", str.c_str());
|
||||
}
|
||||
|
||||
void SkDumpCanvas::drawPath(const SkPath& path, const SkPaint& paint) {
|
||||
void SkDumpCanvas::onDrawPath(const SkPath& path, const SkPaint& paint) {
|
||||
SkString str;
|
||||
toString(path, &str);
|
||||
this->dump(kDrawPath_Verb, &paint, "drawPath(%s)", str.c_str());
|
||||
|
@ -187,7 +187,7 @@ void SkLuaCanvas::drawOval(const SkRect& rect, const SkPaint& paint) {
|
||||
lua.pushPaint(paint, "paint");
|
||||
}
|
||||
|
||||
void SkLuaCanvas::drawRect(const SkRect& rect, const SkPaint& paint) {
|
||||
void SkLuaCanvas::onDrawRect(const SkRect& rect, const SkPaint& paint) {
|
||||
AUTO_LUA("drawRect");
|
||||
lua.pushRect(rect, "rect");
|
||||
lua.pushPaint(paint, "paint");
|
||||
@ -199,7 +199,7 @@ void SkLuaCanvas::drawRRect(const SkRRect& rrect, const SkPaint& paint) {
|
||||
lua.pushPaint(paint, "paint");
|
||||
}
|
||||
|
||||
void SkLuaCanvas::drawPath(const SkPath& path, const SkPaint& paint) {
|
||||
void SkLuaCanvas::onDrawPath(const SkPath& path, const SkPaint& paint) {
|
||||
AUTO_LUA("drawPath");
|
||||
lua.pushPath(path, "path");
|
||||
lua.pushPaint(paint, "paint");
|
||||
|
@ -190,7 +190,7 @@ void SkNWayCanvas::drawOval(const SkRect& rect, const SkPaint& paint) {
|
||||
}
|
||||
}
|
||||
|
||||
void SkNWayCanvas::drawRect(const SkRect& rect, const SkPaint& paint) {
|
||||
void SkNWayCanvas::onDrawRect(const SkRect& rect, const SkPaint& paint) {
|
||||
Iter iter(fList);
|
||||
while (iter.next()) {
|
||||
iter->drawRect(rect, paint);
|
||||
@ -204,7 +204,7 @@ void SkNWayCanvas::drawRRect(const SkRRect& rrect, const SkPaint& paint) {
|
||||
}
|
||||
}
|
||||
|
||||
void SkNWayCanvas::drawPath(const SkPath& path, const SkPaint& paint) {
|
||||
void SkNWayCanvas::onDrawPath(const SkPath& path, const SkPaint& paint) {
|
||||
Iter iter(fList);
|
||||
while (iter.next()) {
|
||||
iter->drawPath(path, paint);
|
||||
|
@ -87,7 +87,7 @@ void SkProxyCanvas::drawOval(const SkRect& rect, const SkPaint& paint) {
|
||||
fProxy->drawOval(rect, paint);
|
||||
}
|
||||
|
||||
void SkProxyCanvas::drawRect(const SkRect& rect, const SkPaint& paint) {
|
||||
void SkProxyCanvas::onDrawRect(const SkRect& rect, const SkPaint& paint) {
|
||||
fProxy->drawRect(rect, paint);
|
||||
}
|
||||
|
||||
@ -95,7 +95,7 @@ void SkProxyCanvas::drawRRect(const SkRRect& rrect, const SkPaint& paint) {
|
||||
fProxy->drawRRect(rrect, paint);
|
||||
}
|
||||
|
||||
void SkProxyCanvas::drawPath(const SkPath& path, const SkPaint& paint) {
|
||||
void SkProxyCanvas::onDrawPath(const SkPath& path, const SkPaint& paint) {
|
||||
fProxy->drawPath(path, paint);
|
||||
}
|
||||
|
||||
|
@ -321,7 +321,7 @@ void SkDebugCanvas::drawPaint(const SkPaint& paint) {
|
||||
addDrawCommand(new SkDrawPaintCommand(paint));
|
||||
}
|
||||
|
||||
void SkDebugCanvas::drawPath(const SkPath& path, const SkPaint& paint) {
|
||||
void SkDebugCanvas::onDrawPath(const SkPath& path, const SkPaint& paint) {
|
||||
addDrawCommand(new SkDrawPathCommand(path, paint));
|
||||
}
|
||||
|
||||
@ -345,7 +345,7 @@ void SkDebugCanvas::drawPosTextH(const void* text, size_t byteLength,
|
||||
new SkDrawPosTextHCommand(text, byteLength, xpos, constY, paint));
|
||||
}
|
||||
|
||||
void SkDebugCanvas::drawRect(const SkRect& rect, const SkPaint& paint) {
|
||||
void SkDebugCanvas::onDrawRect(const SkRect& rect, const SkPaint& paint) {
|
||||
// NOTE(chudy): Messing up when renamed to DrawRect... Why?
|
||||
addDrawCommand(new SkDrawRectCommand(rect, paint));
|
||||
}
|
||||
|
@ -182,8 +182,6 @@ public:
|
||||
|
||||
virtual void drawPaint(const SkPaint& paint) SK_OVERRIDE;
|
||||
|
||||
virtual void drawPath(const SkPath& path, const SkPaint&) SK_OVERRIDE;
|
||||
|
||||
virtual void drawPicture(SkPicture& picture) SK_OVERRIDE;
|
||||
|
||||
virtual void drawPoints(PointMode, size_t count, const SkPoint pts[],
|
||||
@ -196,8 +194,6 @@ public:
|
||||
const SkScalar xpos[], SkScalar constY,
|
||||
const SkPaint&) SK_OVERRIDE;
|
||||
|
||||
virtual void drawRect(const SkRect& rect, const SkPaint&) SK_OVERRIDE;
|
||||
|
||||
virtual void drawRRect(const SkRRect& rrect, const SkPaint& paint) SK_OVERRIDE;
|
||||
|
||||
virtual void drawSprite(const SkBitmap&, int left, int top,
|
||||
@ -235,6 +231,11 @@ public:
|
||||
static const int kVizImageHeight = 256;
|
||||
static const int kVizImageWidth = 256;
|
||||
|
||||
protected:
|
||||
virtual void onDrawRect(const SkRect& rect, const SkPaint&) SK_OVERRIDE;
|
||||
|
||||
virtual void onDrawPath(const SkPath& path, const SkPaint&) SK_OVERRIDE;
|
||||
|
||||
private:
|
||||
SkTDArray<SkDrawCommand*> fCommandVector;
|
||||
int fHeight;
|
||||
|
@ -25,13 +25,14 @@ public:
|
||||
MockCanvas(SkBaseDevice* device) : SkCanvas(device)
|
||||
{}
|
||||
|
||||
virtual void drawRect(const SkRect& rect, const SkPaint&)
|
||||
SkTDArray<SkRect> fRects;
|
||||
|
||||
protected:
|
||||
virtual void onDrawRect(const SkRect& rect, const SkPaint&)
|
||||
{
|
||||
// This capture occurs before quick reject.
|
||||
fRects.push(rect);
|
||||
}
|
||||
|
||||
SkTDArray<SkRect> fRects;
|
||||
};
|
||||
|
||||
class TileGridTest {
|
||||
|
Loading…
Reference in New Issue
Block a user