diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/core/SkCanvas.cpp | 79 | ||||
-rw-r--r-- | src/core/SkPath.cpp | 17 | ||||
-rw-r--r-- | src/core/SkPictureFlat.h | 3 | ||||
-rw-r--r-- | src/core/SkPicturePlayback.cpp | 37 | ||||
-rw-r--r-- | src/core/SkPicturePlayback.h | 3 | ||||
-rw-r--r-- | src/core/SkPictureRecord.cpp | 53 | ||||
-rw-r--r-- | src/core/SkPictureRecord.h | 6 | ||||
-rw-r--r-- | src/core/SkRRect.cpp | 24 | ||||
-rw-r--r-- | src/pipe/SkGPipePriv.h | 3 | ||||
-rw-r--r-- | src/pipe/SkGPipeRead.cpp | 29 | ||||
-rw-r--r-- | src/pipe/SkGPipeWrite.cpp | 40 | ||||
-rw-r--r-- | src/utils/SkDeferredCanvas.cpp | 30 | ||||
-rw-r--r-- | src/utils/SkDumpCanvas.cpp | 46 | ||||
-rw-r--r-- | src/utils/SkNWayCanvas.cpp | 22 | ||||
-rw-r--r-- | src/utils/SkProxyCanvas.cpp | 12 |
15 files changed, 41 insertions, 363 deletions
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp index 3efdd22c3c..34310c8248 100644 --- a/src/core/SkCanvas.cpp +++ b/src/core/SkCanvas.cpp @@ -17,7 +17,6 @@ #include "SkMetaData.h" #include "SkPicture.h" #include "SkRasterClip.h" -#include "SkRRect.h" #include "SkScalarCompare.h" #include "SkSurface_Base.h" #include "SkTemplates.h" @@ -1126,18 +1125,6 @@ static bool clipPathHelper(const SkCanvas* canvas, SkRasterClip* currClip, } } -bool SkCanvas::clipRRect(const SkRRect& rrect, SkRegion::Op op, bool doAA) { - if (rrect.isRect()) { - // call the non-virtual version - return this->SkCanvas::clipRect(rrect.getBounds(), op, doAA); - } else { - SkPath path; - path.addRRect(rrect); - // call the non-virtual version - return this->SkCanvas::clipPath(path, op, doAA); - } -} - bool SkCanvas::clipPath(const SkPath& path, SkRegion::Op op, bool doAA) { #ifdef SK_ENABLE_CLIP_QUICKREJECT if (SkRegion::kIntersect_Op == op && !path.isInverseFillType()) { @@ -1479,40 +1466,6 @@ void SkCanvas::drawRect(const SkRect& r, const SkPaint& paint) { LOOPER_END } -void SkCanvas::drawOval(const SkRect& oval, const SkPaint& paint) { - if (paint.canComputeFastBounds()) { - SkRect storage; - if (this->quickReject(paint.computeFastBounds(oval, &storage))) { - return; - } - } - - SkPath path; - path.addOval(oval); - // call the non-virtual version - this->SkCanvas::drawPath(path, paint); -} - -void SkCanvas::drawRRect(const SkRRect& rrect, const SkPaint& paint) { - if (paint.canComputeFastBounds()) { - SkRect storage; - if (this->quickReject(paint.computeFastBounds(rrect.getBounds(), &storage))) { - return; - } - } - - if (rrect.isRect()) { - // call the non-virtual version - this->SkCanvas::drawRect(rrect.getBounds(), paint); - } else { - SkPath path; - path.addRRect(rrect); - // call the non-virtual version - this->SkCanvas::drawPath(path, paint); - } -} - - void SkCanvas::drawPath(const SkPath& path, const SkPaint& paint) { if (!path.isFinite()) { return; @@ -1945,7 +1898,17 @@ void SkCanvas::drawCircle(SkScalar cx, SkScalar cy, SkScalar radius, SkRect r; r.set(cx - radius, cy - radius, cx + radius, cy + radius); - this->drawOval(r, paint); + + if (paint.canComputeFastBounds()) { + SkRect storage; + if (this->quickReject(paint.computeFastBounds(r, &storage))) { + return; + } + } + + SkPath path; + path.addOval(r); + this->drawPath(path, paint); } void SkCanvas::drawRoundRect(const SkRect& r, SkScalar rx, SkScalar ry, @@ -1957,14 +1920,28 @@ void SkCanvas::drawRoundRect(const SkRect& r, SkScalar rx, SkScalar ry, return; } } - SkRRect rrect; - rrect.setRectXY(r, rx, ry); - this->drawRRect(rrect, paint); + + SkPath path; + path.addRoundRect(r, rx, ry, SkPath::kCW_Direction); + this->drawPath(path, paint); } else { this->drawRect(r, paint); } } +void SkCanvas::drawOval(const SkRect& oval, const SkPaint& paint) { + if (paint.canComputeFastBounds()) { + SkRect storage; + if (this->quickReject(paint.computeFastBounds(oval, &storage))) { + return; + } + } + + SkPath path; + path.addOval(oval); + this->drawPath(path, paint); +} + void SkCanvas::drawArc(const SkRect& oval, SkScalar startAngle, SkScalar sweepAngle, bool useCenter, const SkPaint& paint) { diff --git a/src/core/SkPath.cpp b/src/core/SkPath.cpp index ae1d187d0d..fe9551492d 100644 --- a/src/core/SkPath.cpp +++ b/src/core/SkPath.cpp @@ -11,9 +11,9 @@ #include "SkBuffer.h" #include "SkMath.h" #include "SkPathRef.h" -#include "SkRRect.h" #include "SkThread.h" + //////////////////////////////////////////////////////////////////////////// #if SK_DEBUG_PATH_REF @@ -1088,21 +1088,6 @@ void SkPath::addRoundRect(const SkRect& rect, const SkScalar rad[], this->close(); } -void SkPath::addRRect(const SkRRect& rrect, Direction dir) { - const SkRect& bounds = rrect.getBounds(); - - if (rrect.isRect()) { - this->addRect(bounds, dir); - } else if (rrect.isOval()) { - this->addOval(bounds, dir); - } else if (rrect.isSimple()) { - const SkVector& rad = rrect.getSimpleRadii(); - this->addRoundRect(bounds, rad.x(), rad.y(), dir); - } else { - this->addRoundRect(bounds, (const SkScalar*)&rrect.fRadii[0], dir); - } -} - bool SkPath::hasOnlyMoveTos() const { int count = fPathRef->countVerbs(); const uint8_t* verbs = const_cast<const SkPathRef*>(fPathRef.get())->verbsMemBegin(); diff --git a/src/core/SkPictureFlat.h b/src/core/SkPictureFlat.h index 9594a594dd..429236150b 100644 --- a/src/core/SkPictureFlat.h +++ b/src/core/SkPictureFlat.h @@ -29,7 +29,6 @@ enum DrawType { CLIP_PATH, CLIP_REGION, CLIP_RECT, - CLIP_RRECT, CONCAT, DRAW_BITMAP, DRAW_BITMAP_MATRIX, @@ -37,7 +36,6 @@ enum DrawType { DRAW_BITMAP_RECT_TO_RECT, DRAW_CLEAR, DRAW_DATA, - DRAW_OVAL, DRAW_PAINT, DRAW_PATH, DRAW_PICTURE, @@ -47,7 +45,6 @@ enum DrawType { DRAW_POS_TEXT_H, DRAW_POS_TEXT_H_TOP_BOTTOM, // fast variant of DRAW_POS_TEXT_H DRAW_RECT, - DRAW_RRECT, DRAW_SPRITE, DRAW_TEXT, DRAW_TEXT_ON_PATH, diff --git a/src/core/SkPicturePlayback.cpp b/src/core/SkPicturePlayback.cpp index 31ee3ece3a..9a8f133d8a 100644 --- a/src/core/SkPicturePlayback.cpp +++ b/src/core/SkPicturePlayback.cpp @@ -634,7 +634,7 @@ void SkPicturePlayback::draw(SkCanvas& canvas) { #endif #ifdef SPEW_CLIP_SKIPPING - SkipClipRec skipRect, skipRRect, skipRegion, skipPath; + SkipClipRec skipRect, skipRegion, skipPath; #endif #ifdef SK_BUILD_FOR_ANDROID @@ -731,7 +731,7 @@ void SkPicturePlayback::draw(SkCanvas& canvas) { bool doAA = ClipParams_unpackDoAA(packed); size_t offsetToRestore = reader.readInt(); SkASSERT(!offsetToRestore || \ - offsetToRestore >= reader.offset()); + offsetToRestore >= reader.offset()); if (!canvas.clipRect(rect, op, doAA) && offsetToRestore) { #ifdef SPEW_CLIP_SKIPPING skipRect.recordSkip(offsetToRestore - reader.offset()); @@ -739,22 +739,6 @@ void SkPicturePlayback::draw(SkCanvas& canvas) { reader.setOffset(offsetToRestore); } } break; - case CLIP_RRECT: { - SkRRect rrect; - reader.readRRect(&rrect); - uint32_t packed = reader.readInt(); - SkRegion::Op op = ClipParams_unpackRegionOp(packed); - bool doAA = ClipParams_unpackDoAA(packed); - size_t offsetToRestore = reader.readInt(); - SkASSERT(!offsetToRestore || \ - offsetToRestore >= reader.offset()); - if (!canvas.clipRRect(rrect, op, doAA) && offsetToRestore) { -#ifdef SPEW_CLIP_SKIPPING - skipRRect.recordSkip(offsetToRestore - reader.offset()); -#endif - reader.setOffset(offsetToRestore); - } - } break; case CONCAT: canvas.concat(*getMatrix(reader)); break; @@ -792,10 +776,6 @@ void SkPicturePlayback::draw(SkCanvas& canvas) { canvas.drawData(reader.skip(length), length); // skip handles padding the read out to a multiple of 4 } break; - case DRAW_OVAL: { - const SkPaint& paint = *getPaint(reader); - canvas.drawOval(reader.skipT<SkRect>(), paint); - } break; case DRAW_PAINT: canvas.drawPaint(*getPaint(reader)); break; @@ -857,11 +837,6 @@ void SkPicturePlayback::draw(SkCanvas& canvas) { const SkPaint& paint = *getPaint(reader); canvas.drawRect(reader.skipT<SkRect>(), paint); } break; - case DRAW_RRECT: { - const SkPaint& paint = *getPaint(reader); - SkRRect rrect; - canvas.drawRRect(*reader.readRRect(&rrect), paint); - } break; case DRAW_SPRITE: { const SkPaint* paint = getPaint(reader); const SkBitmap& bitmap = getBitmap(reader); @@ -977,10 +952,10 @@ void SkPicturePlayback::draw(SkCanvas& canvas) { #ifdef SPEW_CLIP_SKIPPING { - size_t size = skipRect.fSize + skipRRect.fSize + skipPath.fSize + skipRegion.fSize; - SkDebugf("--- Clip skips %d%% rect:%d rrect:%d path:%d rgn:%d\n", - size * 100 / reader.offset(), skipRect.fCount, skipRRect.fCount, - skipPath.fCount, skipRegion.fCount); + size_t size = skipRect.fSize + skipPath.fSize + skipRegion.fSize; + SkDebugf("--- Clip skips %d%% rect:%d path:%d rgn:%d\n", + size * 100 / reader.offset(), skipRect.fCount, skipPath.fCount, + skipRegion.fCount); } #endif // this->dumpSize(); diff --git a/src/core/SkPicturePlayback.h b/src/core/SkPicturePlayback.h index 13a685fb92..8f52b19314 100644 --- a/src/core/SkPicturePlayback.h +++ b/src/core/SkPicturePlayback.h @@ -19,7 +19,6 @@ #include "SkPath.h" #include "SkPathHeap.h" #include "SkRegion.h" -#include "SkRRect.h" #include "SkPictureFlat.h" #include "SkSerializationHelpers.h" @@ -148,7 +147,7 @@ private: int index = reader.readInt(); return (*fRegions)[index - 1]; } - + void getText(SkReader32& reader, TextContainer* text) { size_t length = text->fByteLength = reader.readInt(); text->fText = (const char*)reader.skip(length); diff --git a/src/core/SkPictureRecord.cpp b/src/core/SkPictureRecord.cpp index 82257c8e57..3c4df53b1e 100644 --- a/src/core/SkPictureRecord.cpp +++ b/src/core/SkPictureRecord.cpp @@ -8,7 +8,6 @@ #include "SkPictureRecord.h" #include "SkTSearch.h" #include "SkPixelRef.h" -#include "SkRRect.h" #include "SkBBoxHierarchy.h" #include "SkPictureStateTree.h" @@ -112,7 +111,6 @@ static inline uint32_t getSkipableSize(unsigned drawType) { 4, // CLIP_PATH, 4, // CLIP_REGION, 7, // CLIP_RECT, - 15, // CLIP_RRECT, 2, // CONCAT, 0, // DRAW_BITMAP, 0, // DRAW_BITMAP_MATRIX, @@ -120,7 +118,6 @@ static inline uint32_t getSkipableSize(unsigned drawType) { 0, // DRAW_BITMAP_RECT, 0, // DRAW_CLEAR, 0, // DRAW_DATA, - 0, // DRAW_OVAL, 0, // DRAW_PAINT, 0, // DRAW_PATH, 0, // DRAW_PICTURE, @@ -130,7 +127,6 @@ static inline uint32_t getSkipableSize(unsigned drawType) { 0, // DRAW_POS_TEXT_H, 0, // DRAW_POS_TEXT_H_TOP_BOTTOM, // fast variant of DRAW_POS_TEXT_H 0, // DRAW_RECT, - 0, // DRAW_RRECT, 0, // DRAW_SPRITE, 0, // DRAW_TEXT, 0, // DRAW_TEXT_ON_PATH, @@ -356,28 +352,9 @@ bool SkPictureRecord::clipRect(const SkRect& rect, SkRegion::Op op, bool doAA) { addRect(rect); addInt(ClipParams_pack(op, doAA)); recordRestoreOffsetPlaceholder(op); - - validate(); - return this->INHERITED::clipRect(rect, op, doAA); -} -bool SkPictureRecord::clipRRect(const SkRRect& rrect, SkRegion::Op op, bool doAA) { - if (rrect.isRect()) { - return this->SkPictureRecord::clipRect(rrect.getBounds(), op, doAA); - } - - addDraw(CLIP_RRECT); - addRRect(rrect); - addInt(ClipParams_pack(op, doAA)); - recordRestoreOffsetPlaceholder(op); - validate(); - - if (fRecordFlags & SkPicture::kUsePathBoundsForClip_RecordingFlag) { - return this->INHERITED::clipRect(rrect.getBounds(), op, doAA); - } else { - return this->INHERITED::clipRRect(rrect, op, doAA); - } + return this->INHERITED::clipRect(rect, op, doAA); } bool SkPictureRecord::clipPath(const SkPath& path, SkRegion::Op op, bool doAA) { @@ -433,13 +410,6 @@ void SkPictureRecord::drawPoints(PointMode mode, size_t count, const SkPoint pts validate(); } -void SkPictureRecord::drawOval(const SkRect& oval, const SkPaint& paint) { - addDraw(DRAW_OVAL); - addPaint(paint); - addRect(oval); - validate(); -} - void SkPictureRecord::drawRect(const SkRect& rect, const SkPaint& paint) { addDraw(DRAW_RECT); addPaint(paint); @@ -447,23 +417,6 @@ void SkPictureRecord::drawRect(const SkRect& rect, const SkPaint& paint) { validate(); } -void SkPictureRecord::drawRRect(const SkRRect& rrect, const SkPaint& paint) { - if (rrect.isRect()) { - addDraw(DRAW_RECT); - addPaint(paint); - addRect(rrect.getBounds()); - } else if (rrect.isOval()) { - addDraw(DRAW_OVAL); - addPaint(paint); - addRect(rrect.getBounds()); - } else { - addDraw(DRAW_RRECT); - addPaint(paint); - addRRect(rrect); - } - validate(); -} - void SkPictureRecord::drawPath(const SkPath& path, const SkPaint& paint) { addDraw(DRAW_PATH); addPaint(paint); @@ -801,10 +754,6 @@ void SkPictureRecord::addIRectPtr(const SkIRect* rect) { } } -void SkPictureRecord::addRRect(const SkRRect& rrect) { - fWriter.writeRRect(rrect); -} - void SkPictureRecord::addRegion(const SkRegion& region) { addInt(fRegions.find(region)); } diff --git a/src/core/SkPictureRecord.h b/src/core/SkPictureRecord.h index abaa22dd9d..77a6b04fc7 100644 --- a/src/core/SkPictureRecord.h +++ b/src/core/SkPictureRecord.h @@ -36,16 +36,13 @@ public: virtual bool concat(const SkMatrix& matrix) SK_OVERRIDE; virtual void setMatrix(const SkMatrix& matrix) SK_OVERRIDE; virtual bool clipRect(const SkRect&, SkRegion::Op, bool) SK_OVERRIDE; - virtual bool clipRRect(const SkRRect&, SkRegion::Op, bool) SK_OVERRIDE; virtual bool clipPath(const SkPath&, SkRegion::Op, bool) SK_OVERRIDE; virtual bool clipRegion(const SkRegion& region, SkRegion::Op op) SK_OVERRIDE; virtual void clear(SkColor) SK_OVERRIDE; virtual void drawPaint(const SkPaint& paint) SK_OVERRIDE; 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 drawRect(const SkRect& rect, 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; @@ -132,7 +129,6 @@ private: void addRectPtr(const SkRect* rect); void addIRect(const SkIRect& rect); void addIRectPtr(const SkIRect* rect); - void addRRect(const SkRRect&); void addRegion(const SkRegion& region); void addText(const void* text, size_t byteLength); diff --git a/src/core/SkRRect.cpp b/src/core/SkRRect.cpp index c409cd6fd7..5740a19c82 100644 --- a/src/core/SkRRect.cpp +++ b/src/core/SkRRect.cpp @@ -227,30 +227,6 @@ void SkRRect::computeType() const { fType = kComplex_Type; } -/////////////////////////////////////////////////////////////////////////////// - -uint32_t SkRRect::writeToMemory(void* buffer) const { - SkASSERT(kSizeInMemory == sizeof(SkRect) + sizeof(fRadii)); - - memcpy(buffer, &fRect, sizeof(SkRect)); - memcpy((char*)buffer + sizeof(SkRect), fRadii, sizeof(fRadii)); - return kSizeInMemory; -} - -uint32_t SkRRect::readFromMemory(const void* buffer) { - SkScalar storage[12]; - SkASSERT(sizeof(storage) == kSizeInMemory); - - // we make a local copy, to ensure alignment before we cast - memcpy(storage, buffer, kSizeInMemory); - - this->setRectRadii(*(const SkRect*)&storage[0], - (const SkVector*)&storage[4]); - return kSizeInMemory; -} - -/////////////////////////////////////////////////////////////////////////////// - #ifdef SK_DEBUG void SkRRect::validate() const { bool allRadiiZero = (0 == fRadii[0].fX && 0 == fRadii[0].fY); diff --git a/src/pipe/SkGPipePriv.h b/src/pipe/SkGPipePriv.h index b563652cb9..31803ea9b5 100644 --- a/src/pipe/SkGPipePriv.h +++ b/src/pipe/SkGPipePriv.h @@ -37,7 +37,6 @@ enum DrawOps { kClipPath_DrawOp, kClipRegion_DrawOp, kClipRect_DrawOp, - kClipRRect_DrawOp, kConcat_DrawOp, kDrawBitmap_DrawOp, kDrawBitmapMatrix_DrawOp, @@ -45,7 +44,6 @@ enum DrawOps { kDrawBitmapRectToRect_DrawOp, kDrawClear_DrawOp, kDrawData_DrawOp, - kDrawOval_DrawOp, kDrawPaint_DrawOp, kDrawPath_DrawOp, kDrawPicture_DrawOp, @@ -53,7 +51,6 @@ enum DrawOps { kDrawPosText_DrawOp, kDrawPosTextH_DrawOp, kDrawRect_DrawOp, - kDrawRRect_DrawOp, kDrawSprite_DrawOp, kDrawText_DrawOp, kDrawTextOnPath_DrawOp, diff --git a/src/pipe/SkGPipeRead.cpp b/src/pipe/SkGPipeRead.cpp index 8a86c582c2..1f13dafa7d 100644 --- a/src/pipe/SkGPipeRead.cpp +++ b/src/pipe/SkGPipeRead.cpp @@ -21,7 +21,6 @@ #include "SkOrderedReadBuffer.h" #include "SkPathEffect.h" #include "SkRasterizer.h" -#include "SkRRect.h" #include "SkShader.h" #include "SkTypeface.h" #include "SkXfermode.h" @@ -238,14 +237,6 @@ static void clipRect_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32, canvas->clipRect(*rect, (SkRegion::Op)DrawOp_unpackData(op32), doAA); } -static void clipRRect_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32, - SkGPipeState* state) { - SkRRect rrect; - reader->readRRect(&rrect); - bool doAA = SkToBool(DrawOp_unpackFlags(op32) & kClip_HasAntiAlias_DrawOpFlag); - canvas->clipRRect(rrect, (SkRegion::Op)DrawOp_unpackData(op32), doAA); -} - /////////////////////////////////////////////////////////////////////////////// static void setMatrix_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32, @@ -341,14 +332,6 @@ static void drawPoints_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32, } } -static void drawOval_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32, - SkGPipeState* state) { - const SkRect* rect = skip<SkRect>(reader); - if (state->shouldDraw()) { - canvas->drawOval(*rect, state->paint()); - } -} - static void drawRect_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32, SkGPipeState* state) { const SkRect* rect = skip<SkRect>(reader); @@ -357,15 +340,6 @@ static void drawRect_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32, } } -static void drawRRect_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32, - SkGPipeState* state) { - SkRRect rrect; - reader->readRRect(&rrect); - if (state->shouldDraw()) { - canvas->drawRRect(rrect, state->paint()); - } -} - static void drawPath_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32, SkGPipeState* state) { SkPath path; @@ -703,7 +677,6 @@ static const ReadProc gReadTable[] = { clipPath_rp, clipRegion_rp, clipRect_rp, - clipRRect_rp, concat_rp, drawBitmap_rp, drawBitmapMatrix_rp, @@ -711,7 +684,6 @@ static const ReadProc gReadTable[] = { drawBitmapRect_rp, drawClear_rp, drawData_rp, - drawOval_rp, drawPaint_rp, drawPath_rp, drawPicture_rp, @@ -719,7 +691,6 @@ static const ReadProc gReadTable[] = { drawPosText_rp, drawPosTextH_rp, drawRect_rp, - drawRRect_rp, drawSprite_rp, drawText_rp, drawTextOnPath_rp, diff --git a/src/pipe/SkGPipeWrite.cpp b/src/pipe/SkGPipeWrite.cpp index cfd1e7ceef..f0b4e0aee6 100644 --- a/src/pipe/SkGPipeWrite.cpp +++ b/src/pipe/SkGPipeWrite.cpp @@ -21,17 +21,12 @@ #include "SkPathEffect.h" #include "SkPictureFlat.h" #include "SkRasterizer.h" -#include "SkRRect.h" #include "SkShader.h" #include "SkStream.h" #include "SkTSearch.h" #include "SkTypeface.h" #include "SkWriter32.h" -enum { - kSizeOfFlatRRect = sizeof(SkRect) + 4 * sizeof(SkVector) -}; - static bool isCrossProcess(uint32_t flags) { return SkToBool(flags & SkGPipeWriter::kCrossProcess_Flag); } @@ -213,8 +208,8 @@ public: virtual bool skew(SkScalar sx, SkScalar sy) SK_OVERRIDE; virtual bool concat(const SkMatrix& matrix) SK_OVERRIDE; virtual void setMatrix(const SkMatrix& matrix) SK_OVERRIDE; - virtual bool clipRect(const SkRect&, SkRegion::Op op, bool doAntiAlias = false) SK_OVERRIDE; - virtual bool clipRRect(const SkRRect&, SkRegion::Op op, bool doAntiAlias = false) SK_OVERRIDE; + virtual bool clipRect(const SkRect& rect, SkRegion::Op op, + bool doAntiAlias = false) SK_OVERRIDE; virtual bool clipPath(const SkPath& path, SkRegion::Op op, bool doAntiAlias = false) SK_OVERRIDE; virtual bool clipRegion(const SkRegion& region, SkRegion::Op op) SK_OVERRIDE; @@ -222,9 +217,7 @@ public: virtual void drawPaint(const SkPaint& paint) SK_OVERRIDE; 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; @@ -632,17 +625,6 @@ bool SkGPipeCanvas::clipRect(const SkRect& rect, SkRegion::Op rgnOp, return this->INHERITED::clipRect(rect, rgnOp, doAntiAlias); } -bool SkGPipeCanvas::clipRRect(const SkRRect& rrect, SkRegion::Op rgnOp, - bool doAntiAlias) { - NOTIFY_SETUP(this); - if (this->needOpBytes(kSizeOfFlatRRect)) { - unsigned flags = doAntiAlias & kClip_HasAntiAlias_DrawOpFlag; - this->writeOp(kClipRRect_DrawOp, flags, rgnOp); - fWriter.writeRRect(rrect); - } - return this->INHERITED::clipRRect(rrect, rgnOp, doAntiAlias); -} - bool SkGPipeCanvas::clipPath(const SkPath& path, SkRegion::Op rgnOp, bool doAntiAlias) { NOTIFY_SETUP(this); @@ -701,15 +683,6 @@ void SkGPipeCanvas::drawPoints(PointMode mode, size_t count, } } -void SkGPipeCanvas::drawOval(const SkRect& rect, const SkPaint& paint) { - NOTIFY_SETUP(this); - this->writePaint(paint); - if (this->needOpBytes(sizeof(SkRect))) { - this->writeOp(kDrawOval_DrawOp); - fWriter.writeRect(rect); - } -} - void SkGPipeCanvas::drawRect(const SkRect& rect, const SkPaint& paint) { NOTIFY_SETUP(this); this->writePaint(paint); @@ -719,15 +692,6 @@ void SkGPipeCanvas::drawRect(const SkRect& rect, const SkPaint& paint) { } } -void SkGPipeCanvas::drawRRect(const SkRRect& rrect, const SkPaint& paint) { - NOTIFY_SETUP(this); - this->writePaint(paint); - if (this->needOpBytes(kSizeOfFlatRRect)) { - this->writeOp(kDrawRRect_DrawOp); - fWriter.writeRRect(rrect); - } -} - void SkGPipeCanvas::drawPath(const SkPath& path, const SkPaint& paint) { NOTIFY_SETUP(this); this->writePaint(paint); diff --git a/src/utils/SkDeferredCanvas.cpp b/src/utils/SkDeferredCanvas.cpp index c827be603c..7ea3bbbe30 100644 --- a/src/utils/SkDeferredCanvas.cpp +++ b/src/utils/SkDeferredCanvas.cpp @@ -14,7 +14,6 @@ #include "SkDrawFilter.h" #include "SkGPipe.h" #include "SkPaint.h" -#include "SkRRect.h" #include "SkShader.h" enum { @@ -783,15 +782,6 @@ bool SkDeferredCanvas::clipRect(const SkRect& rect, return val; } -bool SkDeferredCanvas::clipRRect(const SkRRect& rrect, - SkRegion::Op op, - bool doAntiAlias) { - this->drawingCanvas()->clipRRect(rrect, op, doAntiAlias); - bool val = this->INHERITED::clipRRect(rrect, op, doAntiAlias); - this->recordedDrawCommand(); - return val; -} - bool SkDeferredCanvas::clipPath(const SkPath& path, SkRegion::Op op, bool doAntiAlias) { @@ -836,35 +826,17 @@ void SkDeferredCanvas::drawPoints(PointMode mode, size_t count, this->recordedDrawCommand(); } -void SkDeferredCanvas::drawOval(const SkRect& rect, const SkPaint& paint) { - AutoImmediateDrawIfNeeded autoDraw(*this, &paint); - this->drawingCanvas()->drawOval(rect, paint); - this->recordedDrawCommand(); -} - void SkDeferredCanvas::drawRect(const SkRect& rect, const SkPaint& paint) { if (fDeferredDrawing && this->isFullFrame(&rect, &paint) && isPaintOpaque(&paint)) { this->getDeferredDevice()->skipPendingCommands(); } - + AutoImmediateDrawIfNeeded autoDraw(*this, &paint); this->drawingCanvas()->drawRect(rect, paint); this->recordedDrawCommand(); } -void SkDeferredCanvas::drawRRect(const SkRRect& rrect, const SkPaint& paint) { - if (rrect.isRect()) { - this->SkDeferredCanvas::drawRect(rrect.getBounds(), paint); - } else if (rrect.isOval()) { - this->SkDeferredCanvas::drawOval(rrect.getBounds(), paint); - } else { - AutoImmediateDrawIfNeeded autoDraw(*this, &paint); - this->drawingCanvas()->drawRRect(rrect, paint); - this->recordedDrawCommand(); - } -} - void SkDeferredCanvas::drawPath(const SkPath& path, const SkPaint& paint) { AutoImmediateDrawIfNeeded autoDraw(*this, &paint); this->drawingCanvas()->drawPath(path, paint); diff --git a/src/utils/SkDumpCanvas.cpp b/src/utils/SkDumpCanvas.cpp index 2722fb4c04..9135849208 100644 --- a/src/utils/SkDumpCanvas.cpp +++ b/src/utils/SkDumpCanvas.cpp @@ -8,7 +8,6 @@ #include "SkDumpCanvas.h" #include "SkPicture.h" #include "SkPixelRef.h" -#include "SkRRect.h" #include "SkString.h" #include <stdarg.h> @@ -32,31 +31,6 @@ static void toString(const SkIRect& r, SkString* str) { str->appendf("[%d,%d %d:%d]", r.fLeft, r.fTop, r.width(), r.height()); } -static void toString(const SkRRect& rrect, SkString* str) { - SkRect r = rrect.getBounds(); - str->appendf("[%g,%g %g:%g]", - SkScalarToFloat(r.fLeft), SkScalarToFloat(r.fTop), - SkScalarToFloat(r.width()), SkScalarToFloat(r.height())); - if (rrect.isOval()) { - str->append("()"); - } else if (rrect.isSimple()) { - const SkVector& rad = rrect.getSimpleRadii(); - str->appendf("(%g,%g)", rad.x(), rad.y()); - } else if (rrect.isComplex()) { - SkVector radii[4] = { - rrect.radii(SkRRect::kUpperLeft_Corner), - rrect.radii(SkRRect::kUpperRight_Corner), - rrect.radii(SkRRect::kLowerRight_Corner), - rrect.radii(SkRRect::kLowerLeft_Corner), - }; - str->appendf("(%g,%g %g,%g %g,%g %g,%g)", - radii[0].x(), radii[0].y(), - radii[1].x(), radii[1].y(), - radii[2].x(), radii[2].y(), - radii[3].x(), radii[3].y()); - } -} - static void dumpVerbs(const SkPath& path, SkString* str) { SkPath::Iter iter(path, false); SkPoint pts[4]; @@ -299,14 +273,6 @@ bool SkDumpCanvas::clipRect(const SkRect& rect, SkRegion::Op op, bool doAA) { return this->INHERITED::clipRect(rect, op, doAA); } -bool SkDumpCanvas::clipRRect(const SkRRect& rrect, SkRegion::Op op, bool doAA) { - SkString str; - toString(rrect, &str); - this->dump(kClip_Verb, NULL, "clipRRect(%s %s %s)", str.c_str(), toString(op), - bool_to_aastring(doAA)); - return this->INHERITED::clipRRect(rrect, op, doAA); -} - bool SkDumpCanvas::clipPath(const SkPath& path, SkRegion::Op op, bool doAA) { SkString str; toString(path, &str); @@ -335,24 +301,12 @@ void SkDumpCanvas::drawPoints(PointMode mode, size_t count, count); } -void SkDumpCanvas::drawOval(const SkRect& rect, const SkPaint& paint) { - SkString str; - toString(rect, &str); - this->dump(kDrawOval_Verb, &paint, "drawOval(%s)", str.c_str()); -} - void SkDumpCanvas::drawRect(const SkRect& rect, const SkPaint& paint) { SkString str; toString(rect, &str); this->dump(kDrawRect_Verb, &paint, "drawRect(%s)", str.c_str()); } -void SkDumpCanvas::drawRRect(const SkRRect& rrect, const SkPaint& paint) { - SkString str; - toString(rrect, &str); - this->dump(kDrawRRect_Verb, &paint, "drawRRect(%s)", str.c_str()); -} - void SkDumpCanvas::drawPath(const SkPath& path, const SkPaint& paint) { SkString str; toString(path, &str); diff --git a/src/utils/SkNWayCanvas.cpp b/src/utils/SkNWayCanvas.cpp index d59d559328..3b781631a3 100644 --- a/src/utils/SkNWayCanvas.cpp +++ b/src/utils/SkNWayCanvas.cpp @@ -144,14 +144,6 @@ bool SkNWayCanvas::clipRect(const SkRect& rect, SkRegion::Op op, bool doAA) { return this->INHERITED::clipRect(rect, op, doAA); } -bool SkNWayCanvas::clipRRect(const SkRRect& rrect, SkRegion::Op op, bool doAA) { - Iter iter(fList); - while (iter.next()) { - iter->clipRRect(rrect, op, doAA); - } - return this->INHERITED::clipRRect(rrect, op, doAA); -} - bool SkNWayCanvas::clipPath(const SkPath& path, SkRegion::Op op, bool doAA) { Iter iter(fList); while (iter.next()) { @@ -183,13 +175,6 @@ void SkNWayCanvas::drawPoints(PointMode mode, size_t count, const SkPoint pts[], } } -void SkNWayCanvas::drawOval(const SkRect& rect, const SkPaint& paint) { - Iter iter(fList); - while (iter.next()) { - iter->drawOval(rect, paint); - } -} - void SkNWayCanvas::drawRect(const SkRect& rect, const SkPaint& paint) { Iter iter(fList); while (iter.next()) { @@ -197,13 +182,6 @@ void SkNWayCanvas::drawRect(const SkRect& rect, const SkPaint& paint) { } } -void SkNWayCanvas::drawRRect(const SkRRect& rrect, const SkPaint& paint) { - Iter iter(fList); - while (iter.next()) { - iter->drawRRect(rrect, paint); - } -} - void SkNWayCanvas::drawPath(const SkPath& path, const SkPaint& paint) { Iter iter(fList); while (iter.next()) { diff --git a/src/utils/SkProxyCanvas.cpp b/src/utils/SkProxyCanvas.cpp index 4af509df4f..e245c73272 100644 --- a/src/utils/SkProxyCanvas.cpp +++ b/src/utils/SkProxyCanvas.cpp @@ -62,10 +62,6 @@ bool SkProxyCanvas::clipRect(const SkRect& rect, SkRegion::Op op, bool doAA) { return fProxy->clipRect(rect, op, doAA); } -bool SkProxyCanvas::clipRRect(const SkRRect& rrect, SkRegion::Op op, bool doAA) { - return fProxy->clipRRect(rrect, op, doAA); -} - bool SkProxyCanvas::clipPath(const SkPath& path, SkRegion::Op op, bool doAA) { return fProxy->clipPath(path, op, doAA); } @@ -83,18 +79,10 @@ void SkProxyCanvas::drawPoints(PointMode mode, size_t count, fProxy->drawPoints(mode, count, pts, paint); } -void SkProxyCanvas::drawOval(const SkRect& rect, const SkPaint& paint) { - fProxy->drawOval(rect, paint); -} - void SkProxyCanvas::drawRect(const SkRect& rect, const SkPaint& paint) { fProxy->drawRect(rect, paint); } -void SkProxyCanvas::drawRRect(const SkRRect& rrect, const SkPaint& paint) { - fProxy->drawRRect(rrect, paint); -} - void SkProxyCanvas::drawPath(const SkPath& path, const SkPaint& paint) { fProxy->drawPath(path, paint); } |