diff options
author | Mike Reed <reed@google.com> | 2017-03-04 19:43:23 +0000 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-03-04 19:43:35 +0000 |
commit | 025e2444c1f5a0c3cdc0bf60d1fa59941a0b5db4 (patch) | |
tree | c353105999aa71c22d41879e2b0beb2aba5df5d9 /src/xps | |
parent | 12da890fbdafb2a2e33ced24e207ffc8cdec54c7 (diff) |
Revert "Revert "Revert[2] "Remove SkDraw from device-draw methods, and enable device-centric clipping.""""
This reverts commit baf06bc89a0ee2ac4033281e7310f6c727faab79.
Reason for revert: reland to diagnose possible g3 failure
Original change's description:
> Revert "Revert[2] "Remove SkDraw from device-draw methods, and enable device-centric clipping."""
>
> This reverts commit cfaa63237b152ae216f1351207bce3ea9808814c.
>
> Reason for revert: speculative revert to fix Google3
>
> Original change's description:
> > Revert[2] "Remove SkDraw from device-draw methods, and enable device-centric clipping.""
> >
> > passes new (augmented) CanvasClipType unittest
> > fixed rasterclipstack::setnewsize
> >
> > This reverts commit ea5e676a7b75600edcde3912886486004ccd7626.
> >
> > BUG=skia:
> >
> > Change-Id: I004653e0f4d01454662f8516fccab0046486f273
> > Reviewed-on: https://skia-review.googlesource.com/9185
> > Reviewed-by: Brian Salomon <bsalomon@google.com>
> > Commit-Queue: Mike Reed <reed@google.com>
> >
>
> TBR=bsalomon@google.com,reed@google.com,reviews@skia.org
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=skia:
>
> Change-Id: Ibd7ee6383999f008eb6ee59c1c3f1c06a86044ea
> Reviewed-on: https://skia-review.googlesource.com/9230
> Reviewed-by: Cary Clark <caryclark@google.com>
> Commit-Queue: Cary Clark <caryclark@google.com>
>
TBR=bsalomon@google.com,reviews@skia.org,caryclark@google.com,reed@google.com,mtklein@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:
Change-Id: I093fa8788056be39af01191bbf3a9e5de9f73954
Reviewed-on: https://skia-review.googlesource.com/9244
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Diffstat (limited to 'src/xps')
-rw-r--r-- | src/xps/SkXPSDevice.cpp | 168 | ||||
-rw-r--r-- | src/xps/SkXPSDevice.h | 120 |
2 files changed, 116 insertions, 172 deletions
diff --git a/src/xps/SkXPSDevice.cpp b/src/xps/SkXPSDevice.cpp index bf93302d51..514c9332ba 100644 --- a/src/xps/SkXPSDevice.cpp +++ b/src/xps/SkXPSDevice.cpp @@ -1139,23 +1139,34 @@ HRESULT SkXPSDevice::createXpsQuad(const SkPoint (&points)[4], return S_OK; } -void SkXPSDevice::drawPoints(const SkDraw& d, SkCanvas::PointMode mode, +template <typename F, typename... Args> +void draw(SkClipStackDevice* dev, F f, Args&&... args) { + SkIRect r = dev->devClipBounds(); + SkRasterClip rc(r); + SkDraw draw; + draw.fMatrix = &dev->ctm(); + draw.fDst = SkPixmap(SkImageInfo::MakeUnknown(r.right(), r.bottom()), nullptr, 0); + draw.fRC = &rc; + (draw.*f)(std::forward<Args>(args)...); +} + + +void SkXPSDevice::drawPoints(SkCanvas::PointMode mode, size_t count, const SkPoint points[], const SkPaint& paint) { - //This will call back into the device to do the drawing. - d.drawPoints(mode, count, points, paint, this); + draw(this, &SkDraw::drawPoints, mode, count, points, paint, this); } -void SkXPSDevice::drawVertices(const SkDraw&, SkCanvas::VertexMode, +void SkXPSDevice::drawVertices(SkCanvas::VertexMode vertexMode, int vertexCount, const SkPoint verts[], const SkPoint texs[], const SkColor colors[], - SkBlendMode, const uint16_t indices[], + SkBlendMode blendMode, const uint16_t indices[], int indexCount, const SkPaint& paint) { - //TODO: override this for XPS - SkDEBUGF(("XPS drawVertices not yet implemented.")); + draw(this, &SkDraw::drawVertices, vertexMode, vertexCount, verts, texs, colors, + blendMode, indices, indexCount, paint); } -void SkXPSDevice::drawPaint(const SkDraw& d, const SkPaint& origPaint) { +void SkXPSDevice::drawPaint(const SkPaint& origPaint) { const SkRect r = SkRect::MakeSize(this->fCurrentCanvasSize); //If trying to paint with a stroke, ignore that and fill. @@ -1165,39 +1176,38 @@ void SkXPSDevice::drawPaint(const SkDraw& d, const SkPaint& origPaint) { paint.writable()->setStyle(SkPaint::kFill_Style); } - this->internalDrawRect(d, r, false, *fillPaint); + this->internalDrawRect(r, false, *fillPaint); } -void SkXPSDevice::drawRect(const SkDraw& d, - const SkRect& r, +void SkXPSDevice::drawRect(const SkRect& r, const SkPaint& paint) { - this->internalDrawRect(d, r, true, paint); + this->internalDrawRect(r, true, paint); } -void SkXPSDevice::drawRRect(const SkDraw& d, - const SkRRect& rr, +void SkXPSDevice::drawRRect(const SkRRect& rr, const SkPaint& paint) { SkPath path; path.addRRect(rr); - this->drawPath(d, path, paint, nullptr, true); + this->drawPath(path, paint, nullptr, true); } -void SkXPSDevice::internalDrawRect(const SkDraw& d, - const SkRect& r, +static SkIRect size(const SkBaseDevice& dev) { return {0, 0, dev.width(), dev.height()}; } + +void SkXPSDevice::internalDrawRect(const SkRect& r, bool transformRect, const SkPaint& paint) { //Exit early if there is nothing to draw. - if (d.fRC->isEmpty() || + if (this->cs().isEmpty(size(*this)) || (paint.getAlpha() == 0 && paint.isSrcOver())) { return; } //Path the rect if we can't optimize it. - if (rect_must_be_pathed(paint, *d.fMatrix)) { + if (rect_must_be_pathed(paint, this->ctm())) { SkPath tmp; tmp.addRect(r); tmp.setFillType(SkPath::kWinding_FillType); - this->drawPath(d, tmp, paint, nullptr, true); + this->drawPath(tmp, paint, nullptr, true); return; } @@ -1218,13 +1228,13 @@ void SkXPSDevice::internalDrawRect(const SkDraw& d, //Set the brushes. BOOL fill = FALSE; BOOL stroke = FALSE; - HRV(this->shadePath(shadedPath.get(), paint, *d.fMatrix, &fill, &stroke)); + HRV(this->shadePath(shadedPath.get(), paint, this->ctm(), &fill, &stroke)); bool xpsTransformsPath = true; //Transform the geometry. if (transformRect && xpsTransformsPath) { SkTScopedComPtr<IXpsOMMatrixTransform> xpsTransform; - HRV(this->createXpsTransform(*d.fMatrix, &xpsTransform)); + HRV(this->createXpsTransform(this->ctm(), &xpsTransform)); if (xpsTransform.get()) { HRVM(shadedGeometry->SetTransformLocal(xpsTransform.get()), "Could not set transform for rect."); @@ -1243,7 +1253,7 @@ void SkXPSDevice::internalDrawRect(const SkDraw& d, { r.fRight, r.fTop }, }; if (!xpsTransformsPath && transformRect) { - d.fMatrix->mapPoints(points, SK_ARRAY_COUNT(points)); + this->ctm().mapPoints(points, SK_ARRAY_COUNT(points)); } HRV(this->createXpsQuad(points, stroke, fill, &rectFigure)); } @@ -1257,7 +1267,7 @@ void SkXPSDevice::internalDrawRect(const SkDraw& d, HRVM(shadedFigures->Append(rectFigure.get()), "Could not add shaded figure for rect."); - HRV(this->clip(shadedPath.get(), d)); + HRV(this->clip(shadedPath.get())); //Add the shaded path to the current visuals. SkTScopedComPtr<IXpsOMVisualCollection> currentVisuals; @@ -1394,8 +1404,7 @@ void SkXPSDevice::convertToPpm(const SkMaskFilter* filter, clipRect.roundOut(clipIRect); } -HRESULT SkXPSDevice::applyMask(const SkDraw& d, - const SkMask& mask, +HRESULT SkXPSDevice::applyMask(const SkMask& mask, const SkVector& ppuScale, IXpsOMPath* shadedPath) { //Get the geometry object. @@ -1434,7 +1443,7 @@ HRESULT SkXPSDevice::applyMask(const SkDraw& d, HRM(shadedFigures->Append(shadedFigure.get()), "Could not add mask shaded figure."); - HR(this->clip(shadedPath, d)); + HR(this->clip(shadedPath)); //Add the path to the active visual collection. SkTScopedComPtr<IXpsOMVisualCollection> currentVisuals; @@ -1494,15 +1503,14 @@ HRESULT SkXPSDevice::shadePath(IXpsOMPath* shadedPath, return S_OK; } -void SkXPSDevice::drawPath(const SkDraw& d, - const SkPath& platonicPath, +void SkXPSDevice::drawPath(const SkPath& platonicPath, const SkPaint& origPaint, const SkMatrix* prePathMatrix, bool pathIsMutable) { SkTCopyOnFirstWrite<SkPaint> paint(origPaint); // nothing to draw - if (d.fRC->isEmpty() || + if (this->cs().isEmpty(size(*this)) || (paint->getAlpha() == 0 && paint->isSrcOver())) { return; } @@ -1512,7 +1520,7 @@ void SkXPSDevice::drawPath(const SkDraw& d, || paint->getStyle() != SkPaint::kFill_Style; //Apply pre-path matrix [Platonic-path -> Skeletal-path]. - SkMatrix matrix = *d.fMatrix; + SkMatrix matrix = this->ctm(); SkPath* skeletalPath = const_cast<SkPath*>(&platonicPath); if (prePathMatrix) { if (paintHasPathEffect || paint->getRasterizer()) { @@ -1574,7 +1582,7 @@ void SkXPSDevice::drawPath(const SkDraw& d, BOOL stroke; HRV(this->shadePath(shadedPath.get(), *paint, - *d.fMatrix, + this->ctm(), &fill, &stroke)); @@ -1585,7 +1593,7 @@ void SkXPSDevice::drawPath(const SkDraw& d, this->convertToPpm(filter, &matrix, &ppuScale, - d.fRC->getBounds(), + this->cs().bounds(size(*this)).roundOut(), &clipIRect); SkMask* mask = nullptr; @@ -1605,13 +1613,13 @@ void SkXPSDevice::drawPath(const SkDraw& d, //[Mask -> Mask] SkMask filteredMask; - if (filter && filter->filterMask(&filteredMask, *mask, *d.fMatrix, nullptr)) { + if (filter && filter->filterMask(&filteredMask, *mask, this->ctm(), nullptr)) { mask = &filteredMask; } SkAutoMaskFreeImage filteredAmi(filteredMask.fImage); //Draw mask. - HRV(this->applyMask(d, *mask, ppuScale, shadedPath.get())); + HRV(this->applyMask(*mask, ppuScale, shadedPath.get())); } return; } @@ -1623,7 +1631,7 @@ void SkXPSDevice::drawPath(const SkDraw& d, this->convertToPpm(filter, &matrix, &ppuScale, - d.fRC->getBounds(), + this->cs().bounds(size(*this)).roundOut(), &clipIRect); //[Fillable-path -> Pixel-path] @@ -1659,7 +1667,7 @@ void SkXPSDevice::drawPath(const SkDraw& d, SkAutoMaskFreeImage filteredAmi(filteredMask.fImage); //Draw mask. - HRV(this->applyMask(d, *mask, ppuScale, shadedPath.get())); + HRV(this->applyMask(*mask, ppuScale, shadedPath.get())); } return; } @@ -1734,7 +1742,7 @@ void SkXPSDevice::drawPath(const SkDraw& d, HRV(this->addXpsPathGeometry(shadedFigures.get(), stroke, fill, *devicePath)); - HRV(this->clip(shadedPath.get(), d)); + HRV(this->clip(shadedPath.get())); //Add the path to the active visual collection. SkTScopedComPtr<IXpsOMVisualCollection> currentVisuals; @@ -1744,16 +1752,10 @@ void SkXPSDevice::drawPath(const SkDraw& d, "Could not add shaded path to current visuals."); } -HRESULT SkXPSDevice::clip(IXpsOMVisual* xpsVisual, const SkDraw& d) { +HRESULT SkXPSDevice::clip(IXpsOMVisual* xpsVisual) { SkPath clipPath; - if (d.fRC->isBW()) { - SkAssertResult(d.fRC->bwRgn().getBoundaryPath(&clipPath)); - } else { - // Don't have a way to turn a AAClip into a path, so we just use the bounds. - // TODO: consider using fClipStack instead? - clipPath.addRect(SkRect::Make(d.fRC->getBounds())); - } - + // clipPath.addRect(this->cs().bounds(size(*this))); + (void)this->cs().asPath(&clipPath); return this->clipToPath(xpsVisual, clipPath, XPS_FILL_RULE_EVENODD); } HRESULT SkXPSDevice::clipToPath(IXpsOMVisual* xpsVisual, @@ -1782,9 +1784,9 @@ HRESULT SkXPSDevice::clipToPath(IXpsOMVisual* xpsVisual, return S_OK; } -void SkXPSDevice::drawBitmap(const SkDraw& d, const SkBitmap& bitmap, +void SkXPSDevice::drawBitmap(const SkBitmap& bitmap, const SkMatrix& matrix, const SkPaint& paint) { - if (d.fRC->isEmpty()) { + if (this->cs().isEmpty(size(*this))) { return; } @@ -1811,7 +1813,7 @@ void SkXPSDevice::drawBitmap(const SkDraw& d, const SkBitmap& bitmap, "Could not get the figures for bitmap."); SkMatrix transform = matrix; - transform.postConcat(*d.fMatrix); + transform.postConcat(this->ctm()); SkTScopedComPtr<IXpsOMMatrixTransform> xpsTransform; HRV(this->createXpsTransform(transform, &xpsTransform)); @@ -1851,12 +1853,10 @@ void SkXPSDevice::drawBitmap(const SkDraw& d, const SkBitmap& bitmap, HRVM(currentVisuals->Append(shadedPath.get()), "Could not add bitmap to current visuals."); - HRV(this->clip(shadedPath.get(), d)); + HRV(this->clip(shadedPath.get())); } -void SkXPSDevice::drawSprite(const SkDraw&, const SkBitmap& bitmap, - int x, int y, - const SkPaint& paint) { +void SkXPSDevice::drawSprite(const SkBitmap& bitmap, int x, int y, const SkPaint& paint) { //TODO: override this for XPS SkDEBUGF(("XPS drawSprite not yet implemented.")); } @@ -1929,8 +1929,7 @@ HRESULT SkXPSDevice::CreateTypefaceUse(const SkPaint& paint, return S_OK; } -HRESULT SkXPSDevice::AddGlyphs(const SkDraw& d, - IXpsOMObjectFactory* xpsFactory, +HRESULT SkXPSDevice::AddGlyphs(IXpsOMObjectFactory* xpsFactory, IXpsOMCanvas* canvas, TypefaceUse* font, LPCWSTR text, @@ -2001,7 +2000,7 @@ HRESULT SkXPSDevice::AddGlyphs(const SkDraw& d, HRM(canvas->GetVisuals(&visuals), "Could not get glyph canvas visuals."); if (!useCanvasForClip) { - HR(this->clip(glyphs.get(), d)); + HR(this->clip(glyphs.get())); HRM(visuals->Append(glyphs.get()), "Could not add glyphs to canvas."); } else { SkTScopedComPtr<IXpsOMCanvas> glyphCanvas; @@ -2014,7 +2013,7 @@ HRESULT SkXPSDevice::AddGlyphs(const SkDraw& d, HRM(glyphCanvasVisuals->Append(glyphs.get()), "Could not add glyphs to page."); - HR(this->clip(glyphCanvas.get(), d)); + HR(this->clip(glyphCanvas.get())); HRM(visuals->Append(glyphCanvas.get()), "Could not add glyph canvas to page."); @@ -2091,16 +2090,15 @@ private: GlyphRun* const fXpsGlyphs; }; -void SkXPSDevice::drawText(const SkDraw& d, - const void* text, size_t byteLen, +void SkXPSDevice::drawText(const void* text, size_t byteLen, SkScalar x, SkScalar y, const SkPaint& paint) { if (byteLen < 1) return; - if (text_must_be_pathed(paint, *d.fMatrix)) { + if (text_must_be_pathed(paint, this->ctm())) { SkPath path; paint.getTextPath(text, byteLen, x, y, &path); - this->drawPath(d, path, paint, nullptr, true); + this->drawPath(path, paint, nullptr, true); //TODO: add automation "text" return; } @@ -2137,8 +2135,7 @@ void SkXPSDevice::drawText(const SkDraw& d, xpsGlyphs[0].horizontalOffset = 0.0f; xpsGlyphs[0].verticalOffset = 0.0f; - HRV(AddGlyphs(d, - this->fXpsFactory.get(), + HRV(AddGlyphs(this->fXpsFactory.get(), this->fCurrentXpsCanvas.get(), typeface, nullptr, @@ -2146,21 +2143,20 @@ void SkXPSDevice::drawText(const SkDraw& d, &origin, SkScalarToFLOAT(paint.getTextSize()), XPS_STYLE_SIMULATION_NONE, - *d.fMatrix, + this->ctm(), paint)); } -void SkXPSDevice::drawPosText(const SkDraw& d, - const void* text, size_t byteLen, +void SkXPSDevice::drawPosText(const void* text, size_t byteLen, const SkScalar pos[], int scalarsPerPos, const SkPoint& offset, const SkPaint& paint) { if (byteLen < 1) return; - if (text_must_be_pathed(paint, *d.fMatrix)) { + if (text_must_be_pathed(paint, this->ctm())) { SkPath path; //TODO: make this work, Draw currently does not handle as well. //paint.getTextPath(text, byteLength, x, y, &path); - //this->drawPath(d, path, paint, nullptr, true); + //this->drawPath(path, paint, nullptr, true); //TODO: add automation "text" return; } @@ -2197,8 +2193,7 @@ void SkXPSDevice::drawPosText(const SkDraw& d, xpsGlyphs[0].horizontalOffset = 0.0f; xpsGlyphs[0].verticalOffset = 0.0f; - HRV(AddGlyphs(d, - this->fXpsFactory.get(), + HRV(AddGlyphs(this->fXpsFactory.get(), this->fCurrentXpsCanvas.get(), typeface, nullptr, @@ -2206,24 +2201,18 @@ void SkXPSDevice::drawPosText(const SkDraw& d, &origin, SkScalarToFLOAT(paint.getTextSize()), XPS_STYLE_SIMULATION_NONE, - *d.fMatrix, + this->ctm(), paint)); } -void SkXPSDevice::drawDevice(const SkDraw& d, SkBaseDevice* dev, +void SkXPSDevice::drawDevice( SkBaseDevice* dev, int x, int y, const SkPaint&) { SkXPSDevice* that = static_cast<SkXPSDevice*>(dev); SkTScopedComPtr<IXpsOMMatrixTransform> xpsTransform; - XPS_MATRIX rawTransform = { - 1.0f, - 0.0f, - 0.0f, - 1.0f, - static_cast<FLOAT>(x), - static_cast<FLOAT>(y), - }; + // TODO(halcanary): assert that current transform is identity rather than calling setter. + XPS_MATRIX rawTransform = {1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f}; HRVM(this->fXpsFactory->CreateMatrixTransform(&rawTransform, &xpsTransform), "Could not create layer transform."); HRVM(that->fCurrentXpsCanvas->SetTransformLocal(xpsTransform.get()), @@ -2256,18 +2245,17 @@ SkBaseDevice* SkXPSDevice::onCreateDevice(const CreateInfo& info, const SkPaint* return dev; } -void SkXPSDevice::drawOval(const SkDraw& d, const SkRect& o, const SkPaint& p) { +void SkXPSDevice::drawOval( const SkRect& o, const SkPaint& p) { SkPath path; path.addOval(o); - this->drawPath(d, path, p, nullptr, true); + this->drawPath(path, p, nullptr, true); } -void SkXPSDevice::drawBitmapRect(const SkDraw& draw, - const SkBitmap& bitmap, - const SkRect* src, - const SkRect& dst, - const SkPaint& paint, - SkCanvas::SrcRectConstraint constraint) { +void SkXPSDevice::drawBitmapRect(const SkBitmap& bitmap, + const SkRect* src, + const SkRect& dst, + const SkPaint& paint, + SkCanvas::SrcRectConstraint constraint) { SkRect srcBounds = src ? *src : SkRect::Make(bitmap.bounds()); SkMatrix matrix = SkMatrix::MakeRectToRect(srcBounds, dst, SkMatrix::kFill_ScaleToFit); @@ -2279,6 +2267,6 @@ void SkXPSDevice::drawBitmapRect(const SkDraw& draw, SkPaint paintWithShader(paint); paintWithShader.setStyle(SkPaint::kFill_Style); paintWithShader.setShader(std::move(bitmapShader)); - this->drawRect(draw, dst, paintWithShader); + this->drawRect(dst, paintWithShader); } #endif//defined(SK_BUILD_FOR_WIN32) diff --git a/src/xps/SkXPSDevice.h b/src/xps/SkXPSDevice.h index 0ad9939509..a03b2932ca 100644 --- a/src/xps/SkXPSDevice.h +++ b/src/xps/SkXPSDevice.h @@ -16,9 +16,10 @@ #include <XpsObjectModel.h> #include "SkAutoCoInitialize.h" -#include "SkBitmapDevice.h" #include "SkBitSet.h" +#include "SkBitmapDevice.h" #include "SkCanvas.h" +#include "SkClipStackDevice.h" #include "SkColor.h" #include "SkPaint.h" #include "SkPath.h" @@ -35,7 +36,7 @@ The drawing context for the XPS backend. */ -class SkXPSDevice : public SkBaseDevice { +class SkXPSDevice : public SkClipStackDevice { public: SK_API SkXPSDevice(SkISize); SK_API virtual ~SkXPSDevice(); @@ -73,79 +74,39 @@ public: bool endPortfolio(); protected: - void drawPaint(const SkDraw&, const SkPaint& paint) override; - - void drawPoints( - const SkDraw&, - SkCanvas::PointMode mode, - size_t count, const SkPoint[], - const SkPaint& paint) override; - - void drawRect( - const SkDraw&, - const SkRect& r, - const SkPaint& paint) override; - - void drawRRect( - const SkDraw&, - const SkRRect&, - const SkPaint& paint) override; - - void drawPath( - const SkDraw&, - const SkPath& platonicPath, - const SkPaint& paint, - const SkMatrix* prePathMatrix, - bool pathIsMutable) override; - - void drawBitmap( - const SkDraw&, - const SkBitmap& bitmap, - const SkMatrix& matrix, - const SkPaint& paint) override; - - void drawSprite( - const SkDraw&, - const SkBitmap& bitmap, - int x, int y, - const SkPaint& paint) override; - - void drawText( - const SkDraw&, - const void* text, size_t len, - SkScalar x, SkScalar y, - const SkPaint& paint) override; - - void drawPosText( - const SkDraw&, - const void* text, size_t len, - const SkScalar pos[], int scalarsPerPos, - const SkPoint& offset, const SkPaint& paint) override; - - void drawVertices( - const SkDraw&, - SkCanvas::VertexMode, - int vertexCount, const SkPoint verts[], - const SkPoint texs[], const SkColor colors[], - SkBlendMode, - const uint16_t indices[], int indexCount, - const SkPaint& paint) override; - - void drawDevice( - const SkDraw&, - SkBaseDevice* device, - int x, int y, - const SkPaint& paint) override; - - void drawOval(const SkDraw&, const SkRect&, const SkPaint&) override; - - void drawBitmapRect(const SkDraw&, - const SkBitmap&, - const SkRect*, - const SkRect&, - const SkPaint&, + void drawPaint(const SkPaint& paint) override; + void drawPoints(SkCanvas::PointMode mode, size_t count, + const SkPoint[], const SkPaint& paint) override; + void drawRect(const SkRect& r, + const SkPaint& paint) override; + void drawOval(const SkRect& oval, + const SkPaint& paint) override; + void drawRRect(const SkRRect& rr, + const SkPaint& paint) override; + void drawPath(const SkPath& path, + const SkPaint& paint, + const SkMatrix* prePathMatrix = NULL, + bool pathIsMutable = false) override; + void drawBitmap(const SkBitmap& bitmap, + const SkMatrix& matrix, const SkPaint& paint) override; + void drawSprite(const SkBitmap& bitmap, + int x, int y, const SkPaint& paint) override; + void drawBitmapRect(const SkBitmap&, + const SkRect* srcOrNull, const SkRect& dst, + const SkPaint& paint, SkCanvas::SrcRectConstraint) override; - + void drawText(const void* text, size_t len, + SkScalar x, SkScalar y, const SkPaint& paint) override; + void drawPosText(const void* text, size_t len, + const SkScalar pos[], int scalarsPerPos, + const SkPoint& offset, const SkPaint& paint) override; + void drawVertices(SkCanvas::VertexMode, int vertexCount, + const SkPoint verts[], const SkPoint texs[], + const SkColor colors[], SkBlendMode, + const uint16_t indices[], int indexCount, + const SkPaint& paint) override; + void drawDevice(SkBaseDevice*, int x, int y, + const SkPaint&) override; private: class TypefaceUse : ::SkNoncopyable { @@ -198,7 +159,6 @@ private: IXpsOMImageResource** image); void internalDrawRect( - const SkDraw&, const SkRect& r, bool transformRect, const SkPaint& paint); @@ -257,7 +217,6 @@ private: TypefaceUse** fontResource); HRESULT AddGlyphs( - const SkDraw& d, IXpsOMObjectFactory* xpsFactory, IXpsOMCanvas* canvas, TypefaceUse* font, @@ -289,16 +248,14 @@ private: const SkColor color, IXpsOMVisualCollection* visuals); - HRESULT clip( - IXpsOMVisual* xpsVisual, - const SkDraw& d); + HRESULT clip(IXpsOMVisual* xpsVisual); + HRESULT clipToPath( IXpsOMVisual* xpsVisual, const SkPath& clipPath, XPS_FILL_RULE fillRule); HRESULT drawInverseWindingPath( - const SkDraw& d, const SkPath& devicePath, IXpsOMPath* xpsPath); @@ -315,7 +272,6 @@ private: const SkIRect& clip, SkIRect* clipIRect); HRESULT applyMask( - const SkDraw& d, const SkMask& mask, const SkVector& ppuScale, IXpsOMPath* shadedPath); @@ -326,7 +282,7 @@ private: SkXPSDevice(const SkXPSDevice&); void operator=(const SkXPSDevice&); - typedef SkBaseDevice INHERITED; + typedef SkClipStackDevice INHERITED; }; #endif // SK_BUILD_FOR_WIN |