aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/xps
diff options
context:
space:
mode:
authorGravatar Mike Reed <reed@google.com>2017-03-04 21:47:47 +0000
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-03-04 21:48:01 +0000
commit27d07f0acb85eea4062075dfbe9148ce12d92c66 (patch)
tree7328000f52b82a4c1478ddc79b8d383f2b832bed /src/xps
parent5b4599f137ce0966a88d2ba2bdbb6aa72b1ae082 (diff)
Revert "Revert "Revert "Revert[2] "Remove SkDraw from device-draw methods, and enable device-centric clipping."""""
This reverts commit 025e2444c1f5a0c3cdc0bf60d1fa59941a0b5db4. Reason for revert: layouttest failures -- need to rebase these (tiny diffs in gradients) https://storage.googleapis.com/chromium-layout-test-archives/linux_trusty_blink_rel/6018/layout-test-results/results.html Original change's description: > 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> > TBR=mtklein@chromium.org,bsalomon@google.com,reviews@skia.org,caryclark@google.com,reed@google.com NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia: Change-Id: I58f810a8ff241dbaf3133e2fe844548fcd0fa67a Reviewed-on: https://skia-review.googlesource.com/9245 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.cpp168
-rw-r--r--src/xps/SkXPSDevice.h120
2 files changed, 172 insertions, 116 deletions
diff --git a/src/xps/SkXPSDevice.cpp b/src/xps/SkXPSDevice.cpp
index 514c9332ba..bf93302d51 100644
--- a/src/xps/SkXPSDevice.cpp
+++ b/src/xps/SkXPSDevice.cpp
@@ -1139,34 +1139,23 @@ HRESULT SkXPSDevice::createXpsQuad(const SkPoint (&points)[4],
return S_OK;
}
-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,
+void SkXPSDevice::drawPoints(const SkDraw& d, SkCanvas::PointMode mode,
size_t count, const SkPoint points[],
const SkPaint& paint) {
- draw(this, &SkDraw::drawPoints, mode, count, points, paint, this);
+ //This will call back into the device to do the drawing.
+ d.drawPoints(mode, count, points, paint, this);
}
-void SkXPSDevice::drawVertices(SkCanvas::VertexMode vertexMode,
+void SkXPSDevice::drawVertices(const SkDraw&, SkCanvas::VertexMode,
int vertexCount, const SkPoint verts[],
const SkPoint texs[], const SkColor colors[],
- SkBlendMode blendMode, const uint16_t indices[],
+ SkBlendMode, const uint16_t indices[],
int indexCount, const SkPaint& paint) {
- draw(this, &SkDraw::drawVertices, vertexMode, vertexCount, verts, texs, colors,
- blendMode, indices, indexCount, paint);
+ //TODO: override this for XPS
+ SkDEBUGF(("XPS drawVertices not yet implemented."));
}
-void SkXPSDevice::drawPaint(const SkPaint& origPaint) {
+void SkXPSDevice::drawPaint(const SkDraw& d, const SkPaint& origPaint) {
const SkRect r = SkRect::MakeSize(this->fCurrentCanvasSize);
//If trying to paint with a stroke, ignore that and fill.
@@ -1176,38 +1165,39 @@ void SkXPSDevice::drawPaint(const SkPaint& origPaint) {
paint.writable()->setStyle(SkPaint::kFill_Style);
}
- this->internalDrawRect(r, false, *fillPaint);
+ this->internalDrawRect(d, r, false, *fillPaint);
}
-void SkXPSDevice::drawRect(const SkRect& r,
+void SkXPSDevice::drawRect(const SkDraw& d,
+ const SkRect& r,
const SkPaint& paint) {
- this->internalDrawRect(r, true, paint);
+ this->internalDrawRect(d, r, true, paint);
}
-void SkXPSDevice::drawRRect(const SkRRect& rr,
+void SkXPSDevice::drawRRect(const SkDraw& d,
+ const SkRRect& rr,
const SkPaint& paint) {
SkPath path;
path.addRRect(rr);
- this->drawPath(path, paint, nullptr, true);
+ this->drawPath(d, path, paint, nullptr, true);
}
-static SkIRect size(const SkBaseDevice& dev) { return {0, 0, dev.width(), dev.height()}; }
-
-void SkXPSDevice::internalDrawRect(const SkRect& r,
+void SkXPSDevice::internalDrawRect(const SkDraw& d,
+ const SkRect& r,
bool transformRect,
const SkPaint& paint) {
//Exit early if there is nothing to draw.
- if (this->cs().isEmpty(size(*this)) ||
+ if (d.fRC->isEmpty() ||
(paint.getAlpha() == 0 && paint.isSrcOver())) {
return;
}
//Path the rect if we can't optimize it.
- if (rect_must_be_pathed(paint, this->ctm())) {
+ if (rect_must_be_pathed(paint, *d.fMatrix)) {
SkPath tmp;
tmp.addRect(r);
tmp.setFillType(SkPath::kWinding_FillType);
- this->drawPath(tmp, paint, nullptr, true);
+ this->drawPath(d, tmp, paint, nullptr, true);
return;
}
@@ -1228,13 +1218,13 @@ void SkXPSDevice::internalDrawRect(const SkRect& r,
//Set the brushes.
BOOL fill = FALSE;
BOOL stroke = FALSE;
- HRV(this->shadePath(shadedPath.get(), paint, this->ctm(), &fill, &stroke));
+ HRV(this->shadePath(shadedPath.get(), paint, *d.fMatrix, &fill, &stroke));
bool xpsTransformsPath = true;
//Transform the geometry.
if (transformRect && xpsTransformsPath) {
SkTScopedComPtr<IXpsOMMatrixTransform> xpsTransform;
- HRV(this->createXpsTransform(this->ctm(), &xpsTransform));
+ HRV(this->createXpsTransform(*d.fMatrix, &xpsTransform));
if (xpsTransform.get()) {
HRVM(shadedGeometry->SetTransformLocal(xpsTransform.get()),
"Could not set transform for rect.");
@@ -1253,7 +1243,7 @@ void SkXPSDevice::internalDrawRect(const SkRect& r,
{ r.fRight, r.fTop },
};
if (!xpsTransformsPath && transformRect) {
- this->ctm().mapPoints(points, SK_ARRAY_COUNT(points));
+ d.fMatrix->mapPoints(points, SK_ARRAY_COUNT(points));
}
HRV(this->createXpsQuad(points, stroke, fill, &rectFigure));
}
@@ -1267,7 +1257,7 @@ void SkXPSDevice::internalDrawRect(const SkRect& r,
HRVM(shadedFigures->Append(rectFigure.get()),
"Could not add shaded figure for rect.");
- HRV(this->clip(shadedPath.get()));
+ HRV(this->clip(shadedPath.get(), d));
//Add the shaded path to the current visuals.
SkTScopedComPtr<IXpsOMVisualCollection> currentVisuals;
@@ -1404,7 +1394,8 @@ void SkXPSDevice::convertToPpm(const SkMaskFilter* filter,
clipRect.roundOut(clipIRect);
}
-HRESULT SkXPSDevice::applyMask(const SkMask& mask,
+HRESULT SkXPSDevice::applyMask(const SkDraw& d,
+ const SkMask& mask,
const SkVector& ppuScale,
IXpsOMPath* shadedPath) {
//Get the geometry object.
@@ -1443,7 +1434,7 @@ HRESULT SkXPSDevice::applyMask(const SkMask& mask,
HRM(shadedFigures->Append(shadedFigure.get()),
"Could not add mask shaded figure.");
- HR(this->clip(shadedPath));
+ HR(this->clip(shadedPath, d));
//Add the path to the active visual collection.
SkTScopedComPtr<IXpsOMVisualCollection> currentVisuals;
@@ -1503,14 +1494,15 @@ HRESULT SkXPSDevice::shadePath(IXpsOMPath* shadedPath,
return S_OK;
}
-void SkXPSDevice::drawPath(const SkPath& platonicPath,
+void SkXPSDevice::drawPath(const SkDraw& d,
+ const SkPath& platonicPath,
const SkPaint& origPaint,
const SkMatrix* prePathMatrix,
bool pathIsMutable) {
SkTCopyOnFirstWrite<SkPaint> paint(origPaint);
// nothing to draw
- if (this->cs().isEmpty(size(*this)) ||
+ if (d.fRC->isEmpty() ||
(paint->getAlpha() == 0 && paint->isSrcOver())) {
return;
}
@@ -1520,7 +1512,7 @@ void SkXPSDevice::drawPath(const SkPath& platonicPath,
|| paint->getStyle() != SkPaint::kFill_Style;
//Apply pre-path matrix [Platonic-path -> Skeletal-path].
- SkMatrix matrix = this->ctm();
+ SkMatrix matrix = *d.fMatrix;
SkPath* skeletalPath = const_cast<SkPath*>(&platonicPath);
if (prePathMatrix) {
if (paintHasPathEffect || paint->getRasterizer()) {
@@ -1582,7 +1574,7 @@ void SkXPSDevice::drawPath(const SkPath& platonicPath,
BOOL stroke;
HRV(this->shadePath(shadedPath.get(),
*paint,
- this->ctm(),
+ *d.fMatrix,
&fill,
&stroke));
@@ -1593,7 +1585,7 @@ void SkXPSDevice::drawPath(const SkPath& platonicPath,
this->convertToPpm(filter,
&matrix,
&ppuScale,
- this->cs().bounds(size(*this)).roundOut(),
+ d.fRC->getBounds(),
&clipIRect);
SkMask* mask = nullptr;
@@ -1613,13 +1605,13 @@ void SkXPSDevice::drawPath(const SkPath& platonicPath,
//[Mask -> Mask]
SkMask filteredMask;
- if (filter && filter->filterMask(&filteredMask, *mask, this->ctm(), nullptr)) {
+ if (filter && filter->filterMask(&filteredMask, *mask, *d.fMatrix, nullptr)) {
mask = &filteredMask;
}
SkAutoMaskFreeImage filteredAmi(filteredMask.fImage);
//Draw mask.
- HRV(this->applyMask(*mask, ppuScale, shadedPath.get()));
+ HRV(this->applyMask(d, *mask, ppuScale, shadedPath.get()));
}
return;
}
@@ -1631,7 +1623,7 @@ void SkXPSDevice::drawPath(const SkPath& platonicPath,
this->convertToPpm(filter,
&matrix,
&ppuScale,
- this->cs().bounds(size(*this)).roundOut(),
+ d.fRC->getBounds(),
&clipIRect);
//[Fillable-path -> Pixel-path]
@@ -1667,7 +1659,7 @@ void SkXPSDevice::drawPath(const SkPath& platonicPath,
SkAutoMaskFreeImage filteredAmi(filteredMask.fImage);
//Draw mask.
- HRV(this->applyMask(*mask, ppuScale, shadedPath.get()));
+ HRV(this->applyMask(d, *mask, ppuScale, shadedPath.get()));
}
return;
}
@@ -1742,7 +1734,7 @@ void SkXPSDevice::drawPath(const SkPath& platonicPath,
HRV(this->addXpsPathGeometry(shadedFigures.get(),
stroke, fill, *devicePath));
- HRV(this->clip(shadedPath.get()));
+ HRV(this->clip(shadedPath.get(), d));
//Add the path to the active visual collection.
SkTScopedComPtr<IXpsOMVisualCollection> currentVisuals;
@@ -1752,10 +1744,16 @@ void SkXPSDevice::drawPath(const SkPath& platonicPath,
"Could not add shaded path to current visuals.");
}
-HRESULT SkXPSDevice::clip(IXpsOMVisual* xpsVisual) {
+HRESULT SkXPSDevice::clip(IXpsOMVisual* xpsVisual, const SkDraw& d) {
SkPath clipPath;
- // clipPath.addRect(this->cs().bounds(size(*this)));
- (void)this->cs().asPath(&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()));
+ }
+
return this->clipToPath(xpsVisual, clipPath, XPS_FILL_RULE_EVENODD);
}
HRESULT SkXPSDevice::clipToPath(IXpsOMVisual* xpsVisual,
@@ -1784,9 +1782,9 @@ HRESULT SkXPSDevice::clipToPath(IXpsOMVisual* xpsVisual,
return S_OK;
}
-void SkXPSDevice::drawBitmap(const SkBitmap& bitmap,
+void SkXPSDevice::drawBitmap(const SkDraw& d, const SkBitmap& bitmap,
const SkMatrix& matrix, const SkPaint& paint) {
- if (this->cs().isEmpty(size(*this))) {
+ if (d.fRC->isEmpty()) {
return;
}
@@ -1813,7 +1811,7 @@ void SkXPSDevice::drawBitmap(const SkBitmap& bitmap,
"Could not get the figures for bitmap.");
SkMatrix transform = matrix;
- transform.postConcat(this->ctm());
+ transform.postConcat(*d.fMatrix);
SkTScopedComPtr<IXpsOMMatrixTransform> xpsTransform;
HRV(this->createXpsTransform(transform, &xpsTransform));
@@ -1853,10 +1851,12 @@ void SkXPSDevice::drawBitmap(const SkBitmap& bitmap,
HRVM(currentVisuals->Append(shadedPath.get()),
"Could not add bitmap to current visuals.");
- HRV(this->clip(shadedPath.get()));
+ HRV(this->clip(shadedPath.get(), d));
}
-void SkXPSDevice::drawSprite(const SkBitmap& bitmap, int x, int y, const SkPaint& paint) {
+void SkXPSDevice::drawSprite(const SkDraw&, const SkBitmap& bitmap,
+ int x, int y,
+ const SkPaint& paint) {
//TODO: override this for XPS
SkDEBUGF(("XPS drawSprite not yet implemented."));
}
@@ -1929,7 +1929,8 @@ HRESULT SkXPSDevice::CreateTypefaceUse(const SkPaint& paint,
return S_OK;
}
-HRESULT SkXPSDevice::AddGlyphs(IXpsOMObjectFactory* xpsFactory,
+HRESULT SkXPSDevice::AddGlyphs(const SkDraw& d,
+ IXpsOMObjectFactory* xpsFactory,
IXpsOMCanvas* canvas,
TypefaceUse* font,
LPCWSTR text,
@@ -2000,7 +2001,7 @@ HRESULT SkXPSDevice::AddGlyphs(IXpsOMObjectFactory* xpsFactory,
HRM(canvas->GetVisuals(&visuals), "Could not get glyph canvas visuals.");
if (!useCanvasForClip) {
- HR(this->clip(glyphs.get()));
+ HR(this->clip(glyphs.get(), d));
HRM(visuals->Append(glyphs.get()), "Could not add glyphs to canvas.");
} else {
SkTScopedComPtr<IXpsOMCanvas> glyphCanvas;
@@ -2013,7 +2014,7 @@ HRESULT SkXPSDevice::AddGlyphs(IXpsOMObjectFactory* xpsFactory,
HRM(glyphCanvasVisuals->Append(glyphs.get()),
"Could not add glyphs to page.");
- HR(this->clip(glyphCanvas.get()));
+ HR(this->clip(glyphCanvas.get(), d));
HRM(visuals->Append(glyphCanvas.get()),
"Could not add glyph canvas to page.");
@@ -2090,15 +2091,16 @@ private:
GlyphRun* const fXpsGlyphs;
};
-void SkXPSDevice::drawText(const void* text, size_t byteLen,
+void SkXPSDevice::drawText(const SkDraw& d,
+ const void* text, size_t byteLen,
SkScalar x, SkScalar y,
const SkPaint& paint) {
if (byteLen < 1) return;
- if (text_must_be_pathed(paint, this->ctm())) {
+ if (text_must_be_pathed(paint, *d.fMatrix)) {
SkPath path;
paint.getTextPath(text, byteLen, x, y, &path);
- this->drawPath(path, paint, nullptr, true);
+ this->drawPath(d, path, paint, nullptr, true);
//TODO: add automation "text"
return;
}
@@ -2135,7 +2137,8 @@ void SkXPSDevice::drawText(const void* text, size_t byteLen,
xpsGlyphs[0].horizontalOffset = 0.0f;
xpsGlyphs[0].verticalOffset = 0.0f;
- HRV(AddGlyphs(this->fXpsFactory.get(),
+ HRV(AddGlyphs(d,
+ this->fXpsFactory.get(),
this->fCurrentXpsCanvas.get(),
typeface,
nullptr,
@@ -2143,20 +2146,21 @@ void SkXPSDevice::drawText(const void* text, size_t byteLen,
&origin,
SkScalarToFLOAT(paint.getTextSize()),
XPS_STYLE_SIMULATION_NONE,
- this->ctm(),
+ *d.fMatrix,
paint));
}
-void SkXPSDevice::drawPosText(const void* text, size_t byteLen,
+void SkXPSDevice::drawPosText(const SkDraw& d,
+ 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, this->ctm())) {
+ if (text_must_be_pathed(paint, *d.fMatrix)) {
SkPath path;
//TODO: make this work, Draw currently does not handle as well.
//paint.getTextPath(text, byteLength, x, y, &path);
- //this->drawPath(path, paint, nullptr, true);
+ //this->drawPath(d, path, paint, nullptr, true);
//TODO: add automation "text"
return;
}
@@ -2193,7 +2197,8 @@ void SkXPSDevice::drawPosText(const void* text, size_t byteLen,
xpsGlyphs[0].horizontalOffset = 0.0f;
xpsGlyphs[0].verticalOffset = 0.0f;
- HRV(AddGlyphs(this->fXpsFactory.get(),
+ HRV(AddGlyphs(d,
+ this->fXpsFactory.get(),
this->fCurrentXpsCanvas.get(),
typeface,
nullptr,
@@ -2201,18 +2206,24 @@ void SkXPSDevice::drawPosText(const void* text, size_t byteLen,
&origin,
SkScalarToFLOAT(paint.getTextSize()),
XPS_STYLE_SIMULATION_NONE,
- this->ctm(),
+ *d.fMatrix,
paint));
}
-void SkXPSDevice::drawDevice( SkBaseDevice* dev,
+void SkXPSDevice::drawDevice(const SkDraw& d, SkBaseDevice* dev,
int x, int y,
const SkPaint&) {
SkXPSDevice* that = static_cast<SkXPSDevice*>(dev);
SkTScopedComPtr<IXpsOMMatrixTransform> xpsTransform;
- // 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};
+ XPS_MATRIX rawTransform = {
+ 1.0f,
+ 0.0f,
+ 0.0f,
+ 1.0f,
+ static_cast<FLOAT>(x),
+ static_cast<FLOAT>(y),
+ };
HRVM(this->fXpsFactory->CreateMatrixTransform(&rawTransform, &xpsTransform),
"Could not create layer transform.");
HRVM(that->fCurrentXpsCanvas->SetTransformLocal(xpsTransform.get()),
@@ -2245,17 +2256,18 @@ SkBaseDevice* SkXPSDevice::onCreateDevice(const CreateInfo& info, const SkPaint*
return dev;
}
-void SkXPSDevice::drawOval( const SkRect& o, const SkPaint& p) {
+void SkXPSDevice::drawOval(const SkDraw& d, const SkRect& o, const SkPaint& p) {
SkPath path;
path.addOval(o);
- this->drawPath(path, p, nullptr, true);
+ this->drawPath(d, path, p, nullptr, true);
}
-void SkXPSDevice::drawBitmapRect(const SkBitmap& bitmap,
- const SkRect* src,
- const SkRect& dst,
- const SkPaint& paint,
- SkCanvas::SrcRectConstraint constraint) {
+void SkXPSDevice::drawBitmapRect(const SkDraw& draw,
+ 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);
@@ -2267,6 +2279,6 @@ void SkXPSDevice::drawBitmapRect(const SkBitmap& bitmap,
SkPaint paintWithShader(paint);
paintWithShader.setStyle(SkPaint::kFill_Style);
paintWithShader.setShader(std::move(bitmapShader));
- this->drawRect(dst, paintWithShader);
+ this->drawRect(draw, dst, paintWithShader);
}
#endif//defined(SK_BUILD_FOR_WIN32)
diff --git a/src/xps/SkXPSDevice.h b/src/xps/SkXPSDevice.h
index a03b2932ca..0ad9939509 100644
--- a/src/xps/SkXPSDevice.h
+++ b/src/xps/SkXPSDevice.h
@@ -16,10 +16,9 @@
#include <XpsObjectModel.h>
#include "SkAutoCoInitialize.h"
-#include "SkBitSet.h"
#include "SkBitmapDevice.h"
+#include "SkBitSet.h"
#include "SkCanvas.h"
-#include "SkClipStackDevice.h"
#include "SkColor.h"
#include "SkPaint.h"
#include "SkPath.h"
@@ -36,7 +35,7 @@
The drawing context for the XPS backend.
*/
-class SkXPSDevice : public SkClipStackDevice {
+class SkXPSDevice : public SkBaseDevice {
public:
SK_API SkXPSDevice(SkISize);
SK_API virtual ~SkXPSDevice();
@@ -74,39 +73,79 @@ public:
bool endPortfolio();
protected:
- 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,
+ 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&,
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 {
@@ -159,6 +198,7 @@ private:
IXpsOMImageResource** image);
void internalDrawRect(
+ const SkDraw&,
const SkRect& r,
bool transformRect,
const SkPaint& paint);
@@ -217,6 +257,7 @@ private:
TypefaceUse** fontResource);
HRESULT AddGlyphs(
+ const SkDraw& d,
IXpsOMObjectFactory* xpsFactory,
IXpsOMCanvas* canvas,
TypefaceUse* font,
@@ -248,14 +289,16 @@ private:
const SkColor color,
IXpsOMVisualCollection* visuals);
- HRESULT clip(IXpsOMVisual* xpsVisual);
-
+ HRESULT clip(
+ IXpsOMVisual* xpsVisual,
+ const SkDraw& d);
HRESULT clipToPath(
IXpsOMVisual* xpsVisual,
const SkPath& clipPath,
XPS_FILL_RULE fillRule);
HRESULT drawInverseWindingPath(
+ const SkDraw& d,
const SkPath& devicePath,
IXpsOMPath* xpsPath);
@@ -272,6 +315,7 @@ private:
const SkIRect& clip, SkIRect* clipIRect);
HRESULT applyMask(
+ const SkDraw& d,
const SkMask& mask,
const SkVector& ppuScale,
IXpsOMPath* shadedPath);
@@ -282,7 +326,7 @@ private:
SkXPSDevice(const SkXPSDevice&);
void operator=(const SkXPSDevice&);
- typedef SkClipStackDevice INHERITED;
+ typedef SkBaseDevice INHERITED;
};
#endif // SK_BUILD_FOR_WIN