From 74b461961607fa57a150a9282c410ef0cab38764 Mon Sep 17 00:00:00 2001 From: "vandebo@chromium.org" Date: Sat, 28 Jan 2012 01:45:11 +0000 Subject: [PATCH] Formatting cleanup: remove extra whitespace Change by arthurhsu@chromium.org, original CL: http://codereview.appspot.com/5587049/ Review URL: https://codereview.appspot.com/5594043 git-svn-id: http://skia.googlecode.com/svn/trunk@3098 2bbb7eff-a529-9590-31e7-b0007b416f81 --- include/core/SkCanvas.h | 12 +- include/core/SkDevice.h | 14 +- include/device/xps/SkXPSDevice.h | 2 +- include/gpu/SkGpuDevice.h | 16 +- include/pdf/SkPDFDevice.h | 2 +- include/utils/SkDeferredCanvas.h | 22 +- include/utils/SkDumpCanvas.h | 28 +-- include/utils/SkNWayCanvas.h | 6 +- include/utils/SkProxyCanvas.h | 10 +- src/core/SkCanvas.cpp | 30 +-- src/core/SkDevice.cpp | 8 +- src/core/SkPicturePlayback.h | 4 +- src/core/SkPictureRecord.cpp | 2 +- src/core/SkPictureRecord.h | 22 +- src/device/xps/SkXPSDevice.cpp | 526 +++++++++++++++++++-------------------- src/gpu/SkGpuDevice.cpp | 42 ++-- src/pipe/SkGPipeWrite.cpp | 26 +- src/utils/SkNWayCanvas.cpp | 2 +- 18 files changed, 387 insertions(+), 387 deletions(-) diff --git a/include/core/SkCanvas.h b/include/core/SkCanvas.h index a6f7c78..6d3a24d 100644 --- a/include/core/SkCanvas.h +++ b/include/core/SkCanvas.h @@ -99,7 +99,7 @@ public: * Shortcut for getDevice()->createCompatibleDevice(...). * If getDevice() == NULL, this method does nothing, and returns NULL. */ - SkDevice* createCompatibleDevice(SkBitmap::Config config, + SkDevice* createCompatibleDevice(SkBitmap::Config config, int width, int height, bool isOpaque); @@ -152,7 +152,7 @@ public: * kARGB_8888_Config as SkPMColor * * If the bitmap has pixels already allocated, the canvas pixels will be - * written there. If not, bitmap->allocPixels() will be called + * written there. If not, bitmap->allocPixels() will be called * automatically. If the bitmap is backed by a texture readPixels will * fail. * @@ -438,7 +438,7 @@ public: then taking its bounds. */ bool getClipDeviceBounds(SkIRect* bounds) const; - + /** Fill the entire canvas' bitmap (restricted to the current clip) with the specified ARGB color, using the specified mode. @@ -921,7 +921,7 @@ public: }; protected: - // Returns the canvas to be used by DrawIter. Default implementation + // Returns the canvas to be used by DrawIter. Default implementation // returns this. Subclasses that encapsulate an indirect canvas may // need to overload this method. The impl must keep track of this, as it // is not released or deleted by the caller. @@ -953,7 +953,7 @@ private: friend class SkDrawIter; // needs setupDrawForLayerDevice() - SkDevice* createLayerDevice(SkBitmap::Config, int width, int height, + SkDevice* createLayerDevice(SkBitmap::Config, int width, int height, bool isOpaque); SkDevice* init(SkDevice*); @@ -968,7 +968,7 @@ private: const SkRect& dst, const SkPaint* paint); void internalDrawPaint(const SkPaint& paint); - + void drawDevice(SkDevice*, int x, int y, const SkPaint*); // shared by save() and saveLayer() int internalSave(SaveFlags flags); diff --git a/include/core/SkDevice.h b/include/core/SkDevice.h index c026a4b..6259fe4 100644 --- a/include/core/SkDevice.h +++ b/include/core/SkDevice.h @@ -62,7 +62,7 @@ public: * draw into this device such that all of the pixels will * be opaque. */ - SkDevice* createCompatibleDevice(SkBitmap::Config config, + SkDevice* createCompatibleDevice(SkBitmap::Config config, int width, int height, bool isOpaque); @@ -258,7 +258,7 @@ protected: * kARGB_8888_Config as SkPMColor * * If the bitmap has pixels already allocated, the device pixels will be - * written there. If not, bitmap->allocPixels() will be called + * written there. If not, bitmap->allocPixels() will be called * automatically. If the bitmap is backed by a texture readPixels will * fail. * @@ -291,7 +291,7 @@ protected: fBitmap.setPixelRef(pr, offset); return pr; } - + /** * Implements readPixels API. The caller will ensure that: * 1. bitmap has pixel config kARGB_8888_Config. @@ -327,7 +327,7 @@ protected: const SkMatrix& ctm, SkBitmap* result, SkIPoint* offset); - // This is equal kBGRA_Premul_Config8888 or kRGBA_Premul_Config8888 if + // This is equal kBGRA_Premul_Config8888 or kRGBA_Premul_Config8888 if // either is identical to kNative_Premul_Config8888. Otherwise, -1. static const SkCanvas::Config8888 kPMColorAlias; @@ -342,15 +342,15 @@ private: // just called by SkCanvas when built as a layer void setOrigin(int x, int y) { fOrigin.set(x, y); } // just called by SkCanvas for saveLayer - SkDevice* createCompatibleDeviceForSaveLayer(SkBitmap::Config config, + SkDevice* createCompatibleDeviceForSaveLayer(SkBitmap::Config config, int width, int height, bool isOpaque); /** * Subclasses should override this to implement createCompatibleDevice. */ - virtual SkDevice* onCreateCompatibleDevice(SkBitmap::Config config, - int width, int height, + virtual SkDevice* onCreateCompatibleDevice(SkBitmap::Config config, + int width, int height, bool isOpaque, Usage usage); diff --git a/include/device/xps/SkXPSDevice.h b/include/device/xps/SkXPSDevice.h index 686e168..228e905 100644 --- a/include/device/xps/SkXPSDevice.h +++ b/include/device/xps/SkXPSDevice.h @@ -153,7 +153,7 @@ private: SkStream* fontData; IXpsOMFontResource* xpsFont; SkBitSet* glyphsUsed; - + explicit TypefaceUse(); ~TypefaceUse(); }; diff --git a/include/gpu/SkGpuDevice.h b/include/gpu/SkGpuDevice.h index 6c4285e..6663ed5 100644 --- a/include/gpu/SkGpuDevice.h +++ b/include/gpu/SkGpuDevice.h @@ -35,7 +35,7 @@ public: * internally. */ SkGpuDevice(GrContext*, SkBitmap::Config, - int width, int height, + int width, int height, SkDevice::Usage usage = SkDevice::kGeneral_Usage); /** @@ -102,7 +102,7 @@ public: const SkPaint&) SK_OVERRIDE; virtual bool filterTextFlags(const SkPaint&, TextFlags*) SK_OVERRIDE; - virtual void flush(); + virtual void flush(); /** * Make's this device's rendertarget current in the underlying 3D API. @@ -113,7 +113,7 @@ public: virtual bool filterImage(SkImageFilter*, const SkBitmap& src, const SkMatrix& ctm, SkBitmap* result, SkIPoint* offset) SK_OVERRIDE; - + protected: typedef GrContext::TextureCacheEntry TexCache; enum TexType { @@ -144,7 +144,7 @@ protected: TexCache fTex; }; friend class SkAutoTexCache; - + // overrides from SkDevice virtual bool onReadPixels(const SkBitmap& bitmap, int x, int y, @@ -170,8 +170,8 @@ private: // caller needs to null out GrPaint's texture if // non-textured drawing is desired. // Set constantColor to true if a constant color - // will be used. This is an optimization, and can - // always be set to false. constantColor should + // will be used. This is an optimization, and can + // always be set to false. constantColor should // never be true if justAlpha is true. bool skPaint2GrPaintNoShader(const SkPaint& skPaint, bool justAlpha, @@ -191,8 +191,8 @@ private: bool constantColor); // override from SkDevice - virtual SkDevice* onCreateCompatibleDevice(SkBitmap::Config config, - int width, int height, + virtual SkDevice* onCreateCompatibleDevice(SkBitmap::Config config, + int width, int height, bool isOpaque, Usage usage); diff --git a/include/pdf/SkPDFDevice.h b/include/pdf/SkPDFDevice.h index 4551149..9d6b54c 100644 --- a/include/pdf/SkPDFDevice.h +++ b/include/pdf/SkPDFDevice.h @@ -156,7 +156,7 @@ public: const SkPDFGlyphSetMap& getFontGlyphUsage() const { return *(fFontGlyphUsage.get()); } - + protected: virtual bool onReadPixels(const SkBitmap& bitmap, int x, int y, SkCanvas::Config8888) SK_OVERRIDE; diff --git a/include/utils/SkDeferredCanvas.h b/include/utils/SkDeferredCanvas.h index 14951d9..9eabb7b 100644 --- a/include/utils/SkDeferredCanvas.h +++ b/include/utils/SkDeferredCanvas.h @@ -19,7 +19,7 @@ provided by SkPicture) is that this is a full drop-in replacement for SkCanvas, while SkPictureRecord only supports draw operations. SkDeferredCanvas will transparently trigger the flushing of deferred - draw operations when an attempt is made to access the pixel data. + draw operations when an attempt is made to access the pixel data. */ class SK_API SkDeferredCanvas : public SkCanvas { public: @@ -53,12 +53,12 @@ public: virtual SkDevice* setDevice(SkDevice* device); /** - * Specify a deviceContext to be used by this canvas. Calling + * Specify a deviceContext to be used by this canvas. Calling * setDeviceContext will release the previously set deviceContext, if any. * A deviceContext must be specified if the device uses a graphics context - * that requires some form of state initialization prior to drawing + * that requires some form of state initialization prior to drawing * and/or explicit flushing to synchronize the execution of rendering - * operations. + * operations. * Note: Must be called after the device is set with setDevice. * * @deviceContext interface for the device's the graphics context @@ -102,7 +102,7 @@ public: SK_OVERRIDE; virtual void drawPath(const SkPath& path, const SkPaint& paint) SK_OVERRIDE; - virtual void drawBitmap(const SkBitmap& bitmap, SkScalar left, + virtual void drawBitmap(const SkBitmap& bitmap, SkScalar left, SkScalar top, const SkPaint* paint) SK_OVERRIDE; virtual void drawBitmapRect(const SkBitmap& bitmap, const SkIRect* src, @@ -119,7 +119,7 @@ public: virtual void drawText(const void* text, size_t byteLength, SkScalar x, SkScalar y, const SkPaint& paint) SK_OVERRIDE; virtual void drawPosText(const void* text, size_t byteLength, - const SkPoint pos[], const SkPaint& paint) + const SkPoint pos[], const SkPaint& paint) SK_OVERRIDE; virtual void drawPosTextH(const void* text, size_t byteLength, const SkScalar xpos[], SkScalar constY, @@ -192,8 +192,8 @@ public: virtual int height() const SK_OVERRIDE; virtual SkGpuRenderTarget* accessRenderTarget() SK_OVERRIDE; - virtual SkDevice* onCreateCompatibleDevice(SkBitmap::Config config, - int width, int height, + virtual SkDevice* onCreateCompatibleDevice(SkBitmap::Config config, + int width, int height, bool isOpaque, Usage usage) SK_OVERRIDE; @@ -207,7 +207,7 @@ public: SkCanvas::Config8888 config8888) SK_OVERRIDE; // The following methods are no-ops on a deferred device - virtual bool filterTextFlags(const SkPaint& paint, TextFlags*) + virtual bool filterTextFlags(const SkPaint& paint, TextFlags*) SK_OVERRIDE {return false;} virtual void setMatrixClip(const SkMatrix&, const SkRegion&, @@ -257,10 +257,10 @@ public: virtual void drawPosTextOnPath(const SkDraw& draw, const void* text, size_t len, const SkPoint pos[], const SkPaint& paint, - const SkPath& path, + const SkPath& path, const SkMatrix* matrix) {SkASSERT(0);} - virtual void drawVertices(const SkDraw&, SkCanvas::VertexMode, + virtual void drawVertices(const SkDraw&, SkCanvas::VertexMode, int vertexCount, const SkPoint verts[], const SkPoint texs[], const SkColor colors[], SkXfermode* xmode, const uint16_t indices[], diff --git a/include/utils/SkDumpCanvas.h b/include/utils/SkDumpCanvas.h index 5bfd6f6..de2af04 100644 --- a/include/utils/SkDumpCanvas.h +++ b/include/utils/SkDumpCanvas.h @@ -12,7 +12,7 @@ /** This class overrides all the draw methods on SkCanvas, and formats them as text, and then sends that to a Dumper helper object. - + Typical use might be to dump a display list to a log file to see what is being drawn. */ @@ -22,17 +22,17 @@ public: explicit SkDumpCanvas(Dumper* = 0); virtual ~SkDumpCanvas(); - + enum Verb { kNULL_Verb, kSave_Verb, kRestore_Verb, - + kMatrix_Verb, - + kClip_Verb, - + kDrawPaint_Verb, kDrawPoints_Verb, kDrawRect_Verb, @@ -43,7 +43,7 @@ public: kDrawVertices_Verb, kDrawData_Verb }; - + /** Subclasses of this are installed on the DumpCanvas, and then called for each drawing command. */ @@ -52,12 +52,12 @@ public: virtual void dump(SkDumpCanvas*, SkDumpCanvas::Verb, const char str[], const SkPaint*) = 0; }; - + Dumper* getDumper() const { return fDumper; } void setDumper(Dumper*); - + int getNestLevel() const { return fNestLevel; } - + virtual int save(SaveFlags) SK_OVERRIDE; virtual int saveLayer(const SkRect* bounds, const SkPaint* paint, SaveFlags) SK_OVERRIDE; @@ -69,7 +69,7 @@ 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, bool) SK_OVERRIDE; virtual bool clipPath(const SkPath&, SkRegion::Op, bool) SK_OVERRIDE; virtual bool clipRegion(const SkRegion& deviceRgn, @@ -109,7 +109,7 @@ public: private: Dumper* fDumper; int fNestLevel; // for nesting recursive elements like pictures - + void dump(Verb, const SkPaint*, const char format[], ...); typedef SkCanvas INHERITED; @@ -121,16 +121,16 @@ private: class SkFormatDumper : public SkDumpCanvas::Dumper { public: SkFormatDumper(void (*)(const char text[], void* refcon), void* refcon); - + // override from baseclass that does the formatting, and in turn calls // the function pointer that was passed to the constructor virtual void dump(SkDumpCanvas*, SkDumpCanvas::Verb, const char str[], const SkPaint*) SK_OVERRIDE; - + private: void (*fProc)(const char*, void*); void* fRefcon; - + typedef SkDumpCanvas::Dumper INHERITED; }; diff --git a/include/utils/SkNWayCanvas.h b/include/utils/SkNWayCanvas.h index 4e39c6b..69c1fcf 100644 --- a/include/utils/SkNWayCanvas.h +++ b/include/utils/SkNWayCanvas.h @@ -15,7 +15,7 @@ class SkNWayCanvas : public SkCanvas { public: SkNWayCanvas(); virtual ~SkNWayCanvas(); - + void addCanvas(SkCanvas*); void removeCanvas(SkCanvas*); void removeAll(); @@ -70,10 +70,10 @@ public: virtual SkBounder* setBounder(SkBounder*) SK_OVERRIDE; virtual SkDrawFilter* setDrawFilter(SkDrawFilter*) SK_OVERRIDE; - + private: SkTDArray fList; - + class Iter; typedef SkCanvas INHERITED; diff --git a/include/utils/SkProxyCanvas.h b/include/utils/SkProxyCanvas.h index e96b9b2..720436b 100644 --- a/include/utils/SkProxyCanvas.h +++ b/include/utils/SkProxyCanvas.h @@ -13,7 +13,7 @@ /** This class overrides all virtual methods on SkCanvas, and redirects them to a "proxy", another SkCanvas instance. It can be the basis for intercepting (and possibly modifying) calls to a canvas. - + There must be a proxy installed before the proxycanvas can be used (i.e. before its virtual methods can be called). */ @@ -22,10 +22,10 @@ public: SkProxyCanvas() : fProxy(NULL) {} SkProxyCanvas(SkCanvas* proxy); virtual ~SkProxyCanvas(); - + SkCanvas* getProxy() const { return fProxy; } void setProxy(SkCanvas* proxy); - + virtual int save(SaveFlags flags = kMatrixClip_SaveFlag) SK_OVERRIDE; virtual int saveLayer(const SkRect* bounds, const SkPaint* paint, SaveFlags flags = kARGB_ClipLayer_SaveFlag) SK_OVERRIDE; @@ -37,7 +37,7 @@ 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, bool) SK_OVERRIDE; virtual bool clipPath(const SkPath&, SkRegion::Op, bool) SK_OVERRIDE; virtual bool clipRegion(const SkRegion& deviceRgn, @@ -79,7 +79,7 @@ public: private: SkCanvas* fProxy; - + typedef SkCanvas INHERITED; }; diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp index 9664ffa..2a5a748 100644 --- a/src/core/SkCanvas.cpp +++ b/src/core/SkCanvas.cpp @@ -289,18 +289,18 @@ public: fLooper->init(canvas); } } - + ~AutoDrawLooper() { SkASSERT(fCanvas->getSaveCount() == fSaveCount); } - + const SkPaint& paint() const { SkASSERT(fPaint); return *fPaint; } - + bool next(SkDrawFilter::Type drawType); - + private: SkLazyPaint fLazyPaint; SkCanvas* fCanvas; @@ -424,7 +424,7 @@ SkDevice* SkCanvas::init(SkDevice* device) { SkCanvas::SkCanvas() : fMCStack(sizeof(MCRec), fMCRecStorage, sizeof(fMCRecStorage)) { inc_canvas(); - + this->init(NULL); } @@ -566,7 +566,7 @@ bool SkCanvas::readPixels(SkBitmap* bitmap, bool SkCanvas::readPixels(const SkIRect& srcRect, SkBitmap* bitmap) { SkDevice* device = this->getDevice(); - + SkIRect bounds; bounds.set(0, 0, device->width(), device->height()); if (!bounds.intersect(srcRect)) { @@ -841,7 +841,7 @@ void SkCanvas::restoreToCount(int count) { if (count < 1) { count = 1; } - + int n = this->getSaveCount() - count; for (int i = 0; i < n; ++i) { this->restore(); @@ -881,7 +881,7 @@ void SkCanvas::internalDrawBitmap(const SkBitmap& bitmap, const SkIRect* srcRect class DeviceImageFilterProxy : public SkImageFilter::Proxy { public: DeviceImageFilterProxy(SkDevice* device) : fDevice(device) {} - + virtual SkDevice* createDevice(int w, int h) SK_OVERRIDE; virtual bool filterImage(SkImageFilter*, const SkBitmap& src, const SkMatrix& ctm, @@ -1287,7 +1287,7 @@ SkDevice* SkCanvas::createLayerDevice(SkBitmap::Config config, } } -SkDevice* SkCanvas::createCompatibleDevice(SkBitmap::Config config, +SkDevice* SkCanvas::createCompatibleDevice(SkBitmap::Config config, int width, int height, bool isOpaque) { SkDevice* device = this->getDevice(); @@ -1410,7 +1410,7 @@ void SkCanvas::internalDrawBitmapRect(const SkBitmap& bitmap, const SkIRect* src if (bitmap.width() == 0 || bitmap.height() == 0 || dst.isEmpty()) { return; } - + // do this now, to avoid the cost of calling extract for RLE bitmaps if (NULL == paint || paint->canComputeFastBounds()) { if (this->quickReject(dst, paint2EdgeType(paint))) { @@ -1419,7 +1419,7 @@ void SkCanvas::internalDrawBitmapRect(const SkBitmap& bitmap, const SkIRect* src } const SkBitmap* bitmapPtr = &bitmap; - + SkMatrix matrix; SkRect tmpSrc; if (src) { @@ -1439,7 +1439,7 @@ void SkCanvas::internalDrawBitmapRect(const SkBitmap& bitmap, const SkIRect* src SkIntToScalar(bitmap.height())); } matrix.setRectToRect(tmpSrc, dst, SkMatrix::kFill_ScaleToFit); - + // ensure that src is "valid" before we pass it to our internal routines // and to SkDevice. i.e. sure it is contained inside the original bitmap. SkIRect tmpISrc; @@ -1507,17 +1507,17 @@ void SkCanvas::internalDrawBitmapNine(const SkBitmap& bitmap, dst.fTop, dst.fTop + SkIntToScalar(c.fTop), dst.fBottom - SkIntToScalar(h - c.fBottom), dst.fBottom }; - + if (dstX[1] > dstX[2]) { dstX[1] = dstX[0] + (dstX[3] - dstX[0]) * c.fLeft / (w - c.width()); dstX[2] = dstX[1]; } - + if (dstY[1] > dstY[2]) { dstY[1] = dstY[0] + (dstY[3] - dstY[0]) * c.fTop / (h - c.height()); dstY[2] = dstY[1]; } - + SkIRect s; SkRect d; for (int y = 0; y < 3; y++) { diff --git a/src/core/SkDevice.cpp b/src/core/SkDevice.cpp index aaafb14..dc7feaf 100644 --- a/src/core/SkDevice.cpp +++ b/src/core/SkDevice.cpp @@ -34,7 +34,7 @@ SkDevice::~SkDevice() { delete fMetaData; } -SkDevice* SkDevice::createCompatibleDevice(SkBitmap::Config config, +SkDevice* SkDevice::createCompatibleDevice(SkBitmap::Config config, int width, int height, bool isOpaque) { return this->onCreateCompatibleDevice(config, width, height, @@ -48,8 +48,8 @@ SkDevice* SkDevice::createCompatibleDeviceForSaveLayer(SkBitmap::Config config, isOpaque, kSaveLayer_Usage); } -SkDevice* SkDevice::onCreateCompatibleDevice(SkBitmap::Config config, - int width, int height, +SkDevice* SkDevice::onCreateCompatibleDevice(SkBitmap::Config config, + int width, int height, bool isOpaque, Usage usage) { return SkNEW_ARGS(SkDevice,(config, width, height, isOpaque)); @@ -204,7 +204,7 @@ bool SkDevice::onReadPixels(const SkBitmap& bitmap, } if (SkBitmap::kARGB_8888_Config != subset.config()) { // It'd be preferable to do this directly to bitmap. - subset.copyTo(&subset, SkBitmap::kARGB_8888_Config); + subset.copyTo(&subset, SkBitmap::kARGB_8888_Config); } SkAutoLockPixels alp(bitmap); uint32_t* bmpPixels = reinterpret_cast(bitmap.getPixels()); diff --git a/src/core/SkPicturePlayback.h b/src/core/SkPicturePlayback.h index 88f86e2..f78f15e 100644 --- a/src/core/SkPicturePlayback.h +++ b/src/core/SkPicturePlayback.h @@ -41,7 +41,7 @@ public: void serialize(SkWStream*) const; void dumpSize() const; - + // Can be called in the middle of playback (the draw() call). WIll abort the // drawing and return from draw() after the "current" op code is done void abort(); @@ -83,7 +83,7 @@ private: SkASSERT(index > 0 && index <= fPictureCount); return *fPictureRefs[index - 1]; } - + const SkPaint* getPaint() { int index = getInt(); if (index == 0) { diff --git a/src/core/SkPictureRecord.cpp b/src/core/SkPictureRecord.cpp index 8813ee6..1c57c04 100644 --- a/src/core/SkPictureRecord.cpp +++ b/src/core/SkPictureRecord.cpp @@ -157,7 +157,7 @@ void SkPictureRecord::recordOffsetForRestore(SkRegion::Op op) { *peek = 0; } } - + size_t offset = fWriter.size(); addInt(fRestoreOffsetStack.top()); fRestoreOffsetStack.top() = offset; diff --git a/src/core/SkPictureRecord.h b/src/core/SkPictureRecord.h index 512f3ad..77f7173 100644 --- a/src/core/SkPictureRecord.h +++ b/src/core/SkPictureRecord.h @@ -49,14 +49,14 @@ public: const SkRect& dst, const SkPaint*) SK_OVERRIDE; virtual void drawSprite(const SkBitmap&, int left, int top, const SkPaint*) SK_OVERRIDE; - virtual void drawText(const void* text, size_t byteLength, SkScalar x, + virtual void drawText(const void* text, size_t byteLength, SkScalar x, SkScalar y, const SkPaint&) SK_OVERRIDE; - virtual void drawPosText(const void* text, size_t byteLength, + virtual void drawPosText(const void* text, size_t byteLength, const SkPoint pos[], const SkPaint&) SK_OVERRIDE; virtual void drawPosTextH(const void* text, size_t byteLength, const SkScalar xpos[], SkScalar constY, const SkPaint&) SK_OVERRIDE; - virtual void drawTextOnPath(const void* text, size_t byteLength, - const SkPath& path, const SkMatrix* matrix, + virtual void drawTextOnPath(const void* text, size_t byteLength, + const SkPath& path, const SkMatrix* matrix, const SkPaint&) SK_OVERRIDE; virtual void drawPicture(SkPicture& picture) SK_OVERRIDE; virtual void drawVertices(VertexMode, int vertexCount, @@ -67,7 +67,7 @@ public: virtual void drawData(const void*, size_t) SK_OVERRIDE; void addFontMetricsTopBottom(const SkPaint& paint, SkScalar baselineY); - + const SkTDArray& getBitmaps() const { return fBitmaps; } @@ -83,7 +83,7 @@ public: const SkTDArray& getRegions() const { return fRegions; } - + void reset(); const SkWriter32& writeStream() const { @@ -98,14 +98,14 @@ private: SkDebugf("add %s\n", DrawTypeToString(drawType)); #endif fWriter.writeInt(drawType); - } + } void addInt(int value) { fWriter.writeInt(value); } void addScalar(SkScalar scalar) { fWriter.writeScalar(scalar); } - + void addBitmap(const SkBitmap& bitmap); void addMatrix(const SkMatrix& matrix); void addMatrixPtr(const SkMatrix* matrix); @@ -137,14 +137,14 @@ public: #ifdef SK_DEBUG_SIZE public: - size_t size() const; + size_t size() const; int bitmaps(size_t* size) const; int matrices(size_t* size) const; int paints(size_t* size) const; int paths(size_t* size) const; int regions(size_t* size) const; size_t streamlen() const; - + size_t fPointBytes, fRectBytes, fTextBytes; int fPointWrites, fRectWrites, fTextWrites; #endif @@ -181,7 +181,7 @@ private: SkRefCntSet fRCSet; SkRefCntSet fTFSet; - + uint32_t fRecordFlags; // helper function to handle save/restore culling offsets diff --git a/src/device/xps/SkXPSDevice.cpp b/src/device/xps/SkXPSDevice.cpp index 84dcb8e..f287087 100644 --- a/src/device/xps/SkXPSDevice.cpp +++ b/src/device/xps/SkXPSDevice.cpp @@ -91,11 +91,11 @@ static HRESULT create_id(wchar_t* buffer, size_t bufferSize, wchar_t sep = '-') { GUID guid = {}; HRM(CoCreateGuid(&guid), "Could not create GUID for id."); - + if (format_guid(guid, buffer, bufferSize, sep) == -1) { HRM(E_UNEXPECTED, "Could not format GUID into id."); } - + return S_OK; } @@ -128,7 +128,7 @@ SkXPSDevice::TypefaceUse::~TypefaceUse() { bool SkXPSDevice::beginPortfolio(SkWStream* outputStream) { if (!this->fAutoCo.succeeded()) return false; - + //Create XPS Factory. HRBM(CoCreateInstance( CLSID_XpsOMObjectFactory, @@ -136,10 +136,10 @@ bool SkXPSDevice::beginPortfolio(SkWStream* outputStream) { CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&this->fXpsFactory)), "Could not create XPS factory."); - + HRBM(SkWIStream::CreateFromSkWStream(outputStream, &this->fOutputStream), "Could not convert SkStream to IStream."); - + return true; } @@ -152,17 +152,17 @@ bool SkXPSDevice::beginSheet( const SkRect* artBox, const SkRect* cropBox) { ++this->fCurrentPage; - + //For simplicity, just write everything out in geometry units, //then have a base canvas do the scale to physical units. this->fCurrentCanvasSize = trimSize; this->fCurrentUnitsPerMeter = unitsPerMeter; this->fCurrentPixelsPerMeter = pixelsPerMeter; - + this->fCurrentXpsCanvas.reset(); HRBM(this->fXpsFactory->CreateCanvas(&this->fCurrentXpsCanvas), "Could not create base canvas."); - + return true; } @@ -176,7 +176,7 @@ HRESULT SkXPSDevice::createXpsThumbnail(IXpsOMPage* page, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&thumbnailGenerator)), "Could not create thumbnail generator."); - + SkTScopedComPtr partUri; static const size_t size = SK_MAX( SK_ARRAY_COUNT(L"/Documents/1/Metadata/.png") + SK_DIGITS_IN(pageNum), @@ -192,14 +192,14 @@ HRESULT SkXPSDevice::createXpsThumbnail(IXpsOMPage* page, } HRM(this->fXpsFactory->CreatePartUri(buffer, &partUri), "Could not create thumbnail part uri."); - + HRM(thumbnailGenerator->GenerateThumbnail(page, XPS_IMAGE_TYPE_PNG, XPS_THUMBNAIL_SIZE_LARGE, partUri.get(), image), "Could not generate thumbnail."); - + return S_OK; } @@ -213,14 +213,14 @@ HRESULT SkXPSDevice::createXpsPage(const XPS_SIZE& pageSize, SkTScopedComPtr partUri; HRM(this->fXpsFactory->CreatePartUri(buffer, &partUri), "Could not create page part uri."); - + //If the language is unknown, use "und" (XPS Spec 2.3.5.1). HRM(this->fXpsFactory->CreatePage(&pageSize, L"und", partUri.get(), page), "Could not create page."); - + return S_OK; } @@ -243,7 +243,7 @@ HRESULT SkXPSDevice::initXpsDocumentWriter(IXpsOMImageResource* image) { &this->fPackageWriter), "Could not create package writer."); } - + //Begin the lone document. { SkTScopedComPtr partUri; @@ -258,7 +258,7 @@ HRESULT SkXPSDevice::initXpsDocumentWriter(IXpsOMImageResource* image) { NULL), "Could not start document."); } - + return S_OK; } @@ -271,7 +271,7 @@ bool SkXPSDevice::endSheet() { / SkScalarToFLOAT(this->fCurrentUnitsPerMeter.fX); const float scaleY = targetUnitsPerMeter / SkScalarToFLOAT(this->fCurrentUnitsPerMeter.fY); - + //Create the scale canvas. SkTScopedComPtr scaleCanvas; HRBM(this->fXpsFactory->CreateCanvas(&scaleCanvas), @@ -279,18 +279,18 @@ bool SkXPSDevice::endSheet() { SkTScopedComPtr scaleCanvasVisuals; HRBM(scaleCanvas->GetVisuals(&scaleCanvasVisuals), "Could not get scale canvas visuals."); - + SkTScopedComPtr geomToPhys; XPS_MATRIX rawGeomToPhys = { scaleX, 0, 0, scaleY, 0, 0, }; HRBM(this->fXpsFactory->CreateMatrixTransform(&rawGeomToPhys, &geomToPhys), "Could not create geometry to physical transform."); HRBM(scaleCanvas->SetTransformLocal(geomToPhys.get()), "Could not set transform on scale canvas."); - + //Add the content canvas to the scale canvas. HRBM(scaleCanvasVisuals->Append(this->fCurrentXpsCanvas.get()), "Could not add base canvas to scale canvas."); - + //Create the page. XPS_SIZE pageSize = { SkScalarToFLOAT(this->fCurrentCanvasSize.width()) * scaleX, @@ -298,23 +298,23 @@ bool SkXPSDevice::endSheet() { }; SkTScopedComPtr page; HRB(this->createXpsPage(pageSize, &page)); - + SkTScopedComPtr pageVisuals; HRBM(page->GetVisuals(&pageVisuals), "Could not get page visuals."); - + //Add the scale canvas to the page. HRBM(pageVisuals->Append(scaleCanvas.get()), "Could not add scale canvas to page."); - + //Create the package writer if it hasn't been created yet. if (NULL == this->fPackageWriter.get()) { SkTScopedComPtr image; //Ignore return, thumbnail is completely optional. this->createXpsThumbnail(page.get(), 0, &image); - + HRB(this->initXpsDocumentWriter(image.get())); } - + HRBM(this->fPackageWriter->AddPage(page.get(), &pageSize, NULL, @@ -323,7 +323,7 @@ bool SkXPSDevice::endSheet() { NULL), "Could not write the page."); this->fCurrentXpsCanvas.reset(); - + return true; } @@ -332,7 +332,7 @@ static HRESULT subset_typeface(SkXPSDevice::TypefaceUse* current) { //Microsoft, Y U NO stdint.h? SkTDArray keepList; current->glyphsUsed->exportTo(&keepList); - + //The following are declared with the types required by CreateFontPackage. unsigned char *puchFontPackageBuffer; unsigned long pulFontPackageBufferSize; @@ -359,26 +359,26 @@ static HRESULT subset_typeface(SkXPSDevice::TypefaceUse* current) { SkDEBUGF(("CreateFontPackage Error %lu", result)); return E_UNEXPECTED; } - + SkMemoryStream* newStream = new SkMemoryStream; newStream->setMemoryOwned(puchFontPackageBuffer, pulBytesWritten); SkTScopedComPtr newIStream; SkIStream::CreateFromSkStream(newStream, true, &newIStream); - + XPS_FONT_EMBEDDING embedding; HRM(current->xpsFont->GetEmbeddingOption(&embedding), "Could not get embedding option from font."); - + SkTScopedComPtr partUri; HRM(current->xpsFont->GetPartName(&partUri), "Could not get part uri from font."); - + HRM(current->xpsFont->SetContent( newIStream.get(), embedding, partUri.get()), "Could not set new stream for subsetted font."); - + return S_OK; } @@ -392,9 +392,9 @@ bool SkXPSDevice::endPortfolio() { subset_typeface(current); } } - + HRBM(this->fPackageWriter->Close(), "Could not close writer."); - + return true; } @@ -406,7 +406,7 @@ static XPS_COLOR xps_color(const SkColor skColor) { xpsColor.value.sRGB.red = SkColorGetR(skColor); xpsColor.value.sRGB.green = SkColorGetG(skColor); xpsColor.value.sRGB.blue = SkColorGetB(skColor); - + return xpsColor; } @@ -445,7 +445,7 @@ static void transform_offsets(SkScalar* stopOffsets, const int numOffsets, transform.mapXY(start.fX, start.fY, &startTransformed); SkPoint endTransformed; transform.mapXY(end.fX, end.fY, &endTransformed); - + //Manhattan distance between transformed start and end. SkScalar startToEnd = (endTransformed.fX - startTransformed.fX) + (endTransformed.fY - startTransformed.fY); @@ -455,15 +455,15 @@ static void transform_offsets(SkScalar* stopOffsets, const int numOffsets, } return; } - + for (int i = 0; i < numOffsets; ++i) { SkPoint stop; stop.fX = SkScalarMul(end.fX - start.fX, stopOffsets[i]); stop.fY = SkScalarMul(end.fY - start.fY, stopOffsets[i]); - + SkPoint stopTransformed; transform.mapXY(stop.fX, stop.fY, &stopTransformed); - + //Manhattan distance between transformed start and stop. SkScalar startToStop = (stopTransformed.fX - startTransformed.fX) + (stopTransformed.fY - startTransformed.fY); @@ -489,7 +489,7 @@ HRESULT SkXPSDevice::createXpsTransform(const SkMatrix& matrix, }; HRM(this->fXpsFactory->CreateMatrixTransform(&rawXpsMatrix, xpsTransform), "Could not create transform."); - + return S_OK; } @@ -499,14 +499,14 @@ HRESULT SkXPSDevice::createPath(IXpsOMGeometryFigure* figure, SkTScopedComPtr geometry; HRM(this->fXpsFactory->CreateGeometry(&geometry), "Could not create geometry."); - + SkTScopedComPtr figureCollection; HRM(geometry->GetFigures(&figureCollection), "Could not get figures."); HRM(figureCollection->Append(figure), "Could not add figure."); - + HRM(this->fXpsFactory->CreatePath(path), "Could not create path."); HRM((*path)->SetGeometryLocal(geometry.get()), "Could not set geometry"); - + HRM(visuals->Append(*path), "Could not add path to visuals."); return S_OK; } @@ -529,10 +529,10 @@ HRESULT SkXPSDevice::sideOfClamp(const SkRect& areaToFill, IXpsOMVisualCollection* visuals) { SkTScopedComPtr areaToFillFigure; HR(this->createXpsRect(areaToFill, FALSE, TRUE, &areaToFillFigure)); - + SkTScopedComPtr areaToFillPath; HR(this->createPath(areaToFillFigure.get(), visuals, &areaToFillPath)); - + SkTScopedComPtr areaToFillBrush; HRM(this->fXpsFactory->CreateImageBrush(image, &imageViewBox, @@ -543,7 +543,7 @@ HRESULT SkXPSDevice::sideOfClamp(const SkRect& areaToFill, "Could not set tile mode for side of clamp."); HRM(areaToFillPath->SetFillBrushLocal(areaToFillBrush.get()), "Could not set brush for side of clamp"); - + return S_OK; } @@ -552,15 +552,15 @@ HRESULT SkXPSDevice::cornerOfClamp(const SkRect& areaToFill, IXpsOMVisualCollection* visuals) { SkTScopedComPtr areaToFillFigure; HR(this->createXpsRect(areaToFill, FALSE, TRUE, &areaToFillFigure)); - + SkTScopedComPtr areaToFillPath; HR(this->createPath(areaToFillFigure.get(), visuals, &areaToFillPath)); - + SkTScopedComPtr areaToFillBrush; HR(this->createXpsSolidColorBrush(color, 0xFF, &areaToFillBrush)); HRM(areaToFillPath->SetFillBrushLocal(areaToFillBrush.get()), "Could not set brush for corner of clamp."); - + return S_OK; } @@ -598,18 +598,18 @@ HRESULT SkXPSDevice::createXpsImageBrush( SkTScopedComPtr readWrapper; HRM(SkIStream::CreateFromSkStream(read, true, &readWrapper), "Could not create stream from png data."); - + const size_t size = SK_ARRAY_COUNT(L"/Documents/1/Resources/Images/" L_GUID_ID L".png"); wchar_t buffer[size]; wchar_t id[GUID_ID_LEN]; HR(create_id(id, GUID_ID_LEN)); swprintf_s(buffer, size, L"/Documents/1/Resources/Images/%s.png", id); - + SkTScopedComPtr imagePartUri; HRM(this->fXpsFactory->CreatePartUri(buffer, &imagePartUri), "Could not create image part uri."); - + SkTScopedComPtr imageResource; HRM(this->fXpsFactory->CreateImageResource( readWrapper.get(), @@ -617,7 +617,7 @@ HRESULT SkXPSDevice::createXpsImageBrush( imagePartUri.get(), &imageResource), "Could not create image resource."); - + XPS_RECT bitmapRect = { 0.0, 0.0, static_cast(bitmap.width()), static_cast(bitmap.height()) @@ -627,10 +627,10 @@ HRESULT SkXPSDevice::createXpsImageBrush( &bitmapRect, &bitmapRect, &xpsImageBrush), "Could not create image brush."); - + if (SkShader::kClamp_TileMode != xy[0] && SkShader::kClamp_TileMode != xy[1]) { - + HRM(xpsImageBrush->SetTileMode(SkToXpsTileMode[xy[0]][xy[1]]), "Could not set image tile mode"); HRM(xpsImageBrush->SetOpacity(alpha / 255.0f), @@ -642,7 +642,7 @@ HRESULT SkXPSDevice::createXpsImageBrush( const FLOAT BIG_F = SkScalarToFLOAT(BIG); const SkScalar bWidth = SkIntToScalar(bitmap.width()); const SkScalar bHeight = SkIntToScalar(bitmap.height()); - + //create brush canvas SkTScopedComPtr brushCanvas; HRM(this->fXpsFactory->CreateCanvas(&brushCanvas), @@ -650,12 +650,12 @@ HRESULT SkXPSDevice::createXpsImageBrush( SkTScopedComPtr brushVisuals; HRM(brushCanvas->GetVisuals(&brushVisuals), "Could not get image brush canvas visuals collection."); - + //create central figure const SkRect bitmapPoints = SkRect::MakeLTRB(0, 0, bWidth, bHeight); SkTScopedComPtr centralFigure; HR(this->createXpsRect(bitmapPoints, FALSE, TRUE, ¢ralFigure)); - + SkTScopedComPtr centralPath; HR(this->createPath(centralFigure.get(), brushVisuals.get(), @@ -664,7 +664,7 @@ HRESULT SkXPSDevice::createXpsImageBrush( "Could not set tile mode for image brush central path."); HRM(centralPath->SetFillBrushLocal(xpsImageBrush.get()), "Could not set fill brush for image brush central path."); - + //add left/right if (SkShader::kClamp_TileMode == xy[0]) { SkRect leftArea = SkRect::MakeLTRB(-BIG, 0, 0, bHeight); @@ -685,7 +685,7 @@ HRESULT SkXPSDevice::createXpsImageBrush( imageResource.get(), brushVisuals.get())); } - + //add top/bottom if (SkShader::kClamp_TileMode == xy[1]) { SkRect topArea = SkRect::MakeLTRB(0, -BIG, bWidth, 0); @@ -696,7 +696,7 @@ HRESULT SkXPSDevice::createXpsImageBrush( HR(this->sideOfClamp(topArea, topImageViewBox, imageResource.get(), brushVisuals.get())); - + SkRect bottomArea = SkRect::MakeLTRB(0, bHeight, bWidth, BIG); XPS_RECT bottomImageViewBox = { 0.0f, bitmap.height() - 1.0f, @@ -706,36 +706,36 @@ HRESULT SkXPSDevice::createXpsImageBrush( imageResource.get(), brushVisuals.get())); } - + //add tl, tr, bl, br if (SkShader::kClamp_TileMode == xy[0] && SkShader::kClamp_TileMode == xy[1]) { - + SkAutoLockPixels alp(bitmap); - + const SkColor tlColor = bitmap.getColor(0,0); const SkRect tlArea = SkRect::MakeLTRB(-BIG, -BIG, 0, 0); HR(this->cornerOfClamp(tlArea, tlColor, brushVisuals.get())); - + const SkColor trColor = bitmap.getColor(bitmap.width()-1,0); const SkRect trArea = SkRect::MakeLTRB(bWidth, -BIG, BIG, 0); HR(this->cornerOfClamp(trArea, trColor, brushVisuals.get())); - + const SkColor brColor = bitmap.getColor(bitmap.width()-1, bitmap.height()-1); const SkRect brArea = SkRect::MakeLTRB(bWidth, bHeight, BIG, BIG); HR(this->cornerOfClamp(brArea, brColor, brushVisuals.get())); - + const SkColor blColor = bitmap.getColor(0,bitmap.height()-1); const SkRect blArea = SkRect::MakeLTRB(-BIG, bHeight, 0, BIG); HR(this->cornerOfClamp(blArea, blColor, brushVisuals.get())); } - + //create visual brush from canvas XPS_RECT bound = {}; if (SkShader::kClamp_TileMode == xy[0] && SkShader::kClamp_TileMode == xy[1]) { - + bound.x = BIG_F / -2; bound.y = BIG_F / -2; bound.width = BIG_F; @@ -760,10 +760,10 @@ HRESULT SkXPSDevice::createXpsImageBrush( "Could not set tile mode on visual brush for image brush."); HRM(clampBrush->SetOpacity(alpha / 255.0f), "Could not set opacity on visual brush for image brush."); - + HRM(clampBrush->QueryInterface(xpsBrush), "QI failed."); } - + SkTScopedComPtr xpsMatrixToUse; HR(this->createXpsTransform(localMatrix, &xpsMatrixToUse)); if (NULL != xpsMatrixToUse.get()) { @@ -772,7 +772,7 @@ HRESULT SkXPSDevice::createXpsImageBrush( } else { //TODO(bungeman): perspective bitmaps in general. } - + return S_OK; } @@ -805,17 +805,17 @@ HRESULT SkXPSDevice::createXpsLinearGradient(SkShader::GradientInfo info, startPoint = xps_point(info.fPoint[0], localMatrix); endPoint = xps_point(info.fPoint[1], localMatrix); } - + SkTScopedComPtr gradStop0; HR(createXpsGradientStop(info.fColors[0], info.fColorOffsets[0], &gradStop0)); - + SkTScopedComPtr gradStop1; HR(createXpsGradientStop(info.fColors[1], info.fColorOffsets[1], &gradStop1)); - + SkTScopedComPtr gradientBrush; HRM(this->fXpsFactory->CreateLinearGradientBrush(gradStop0.get(), gradStop1.get(), @@ -827,7 +827,7 @@ HRESULT SkXPSDevice::createXpsLinearGradient(SkShader::GradientInfo info, HRM(gradientBrush->SetTransformLocal(xpsMatrix), "Could not set transform on linear gradient brush."); } - + SkTScopedComPtr gradStopCollection; HRM(gradientBrush->GetGradientStops(&gradStopCollection), "Could not get linear gradient stop collection."); @@ -839,14 +839,14 @@ HRESULT SkXPSDevice::createXpsLinearGradient(SkShader::GradientInfo info, HRM(gradStopCollection->Append(gradStop.get()), "Could not add linear gradient stop."); } - + HRM(gradientBrush->SetSpreadMethod(xps_spread_method(info.fTileMode)), "Could not set spread method of linear gradient."); - + HRM(gradientBrush->SetOpacity(alpha / 255.0f), "Could not set opacity of linear gradient brush."); HRM(gradientBrush->QueryInterface(xpsBrush), "QI failed"); - + return S_OK; } @@ -859,12 +859,12 @@ HRESULT SkXPSDevice::createXpsRadialGradient(SkShader::GradientInfo info, HR(createXpsGradientStop(info.fColors[0], info.fColorOffsets[0], &gradStop0)); - + SkTScopedComPtr gradStop1; HR(createXpsGradientStop(info.fColors[1], info.fColorOffsets[1], &gradStop1)); - + //TODO: figure out how to fake better if not affine XPS_POINT centerPoint; XPS_POINT gradientOrigin; @@ -877,21 +877,21 @@ HRESULT SkXPSDevice::createXpsRadialGradient(SkShader::GradientInfo info, } else { centerPoint = xps_point(info.fPoint[0], localMatrix); gradientOrigin = xps_point(info.fPoint[0], localMatrix); - + SkScalar radius = info.fRadius[0]; SkVector vec[2]; - + vec[0].set(radius, 0); vec[1].set(0, radius); localMatrix.mapVectors(vec, 2); - + SkScalar d0 = vec[0].length(); SkScalar d1 = vec[1].length(); - + radiiSizes.width = SkScalarToFLOAT(d0); radiiSizes.height = SkScalarToFLOAT(d1); } - + SkTScopedComPtr gradientBrush; HRM(this->fXpsFactory->CreateRadialGradientBrush(gradStop0.get(), gradStop1.get(), @@ -904,7 +904,7 @@ HRESULT SkXPSDevice::createXpsRadialGradient(SkShader::GradientInfo info, HRM(gradientBrush->SetTransformLocal(xpsMatrix), "Could not set transform on radial gradient brush."); } - + SkTScopedComPtr gradStopCollection; HRM(gradientBrush->GetGradientStops(&gradStopCollection), "Could not get radial gradient stop collection."); @@ -916,14 +916,14 @@ HRESULT SkXPSDevice::createXpsRadialGradient(SkShader::GradientInfo info, HRM(gradStopCollection->Append(gradStop.get()), "Could not add radial gradient stop."); } - + HRM(gradientBrush->SetSpreadMethod(xps_spread_method(info.fTileMode)), "Could not set spread method of radial gradient."); - + HRM(gradientBrush->SetOpacity(alpha / 255.0f), "Could not set opacity of radial gradient brush."); HRM(gradientBrush->QueryInterface(xpsBrush), "QI failed."); - + return S_OK; } @@ -935,17 +935,17 @@ HRESULT SkXPSDevice::createXpsBrush(const SkPaint& skPaint, HR(this->createXpsSolidColorBrush(skPaint.getColor(), 0xFF, brush)); return S_OK; } - + //Gradient shaders. SkShader::GradientInfo info; info.fColorCount = 0; info.fColors = NULL; info.fColorOffsets = NULL; SkShader::GradientType gradientType = shader->asAGradient(&info); - + if (SkShader::kNone_GradientType == gradientType) { //Nothing to see, move along. - + } else if (SkShader::kColor_GradientType == gradientType) { SkASSERT(1 == info.fColorCount); SkColor color; @@ -954,27 +954,27 @@ HRESULT SkXPSDevice::createXpsBrush(const SkPaint& skPaint, SkAlpha alpha = skPaint.getAlpha(); HR(this->createXpsSolidColorBrush(color, alpha, brush)); return S_OK; - + } else { if (info.fColorCount == 0) { const SkColor color = skPaint.getColor(); HR(this->createXpsSolidColorBrush(color, 0xFF, brush)); return S_OK; } - + SkAutoTArray colors(info.fColorCount); SkAutoTArray colorOffsets(info.fColorCount); info.fColors = colors.get(); info.fColorOffsets = colorOffsets.get(); shader->asAGradient(&info); - + if (1 == info.fColorCount) { SkColor color = info.fColors[0]; SkAlpha alpha = skPaint.getAlpha(); HR(this->createXpsSolidColorBrush(color, alpha, brush)); return S_OK; } - + SkMatrix localMatrix; shader->getLocalMatrix(&localMatrix); if (NULL != parentTransform) { @@ -982,7 +982,7 @@ HRESULT SkXPSDevice::createXpsBrush(const SkPaint& skPaint, } SkTScopedComPtr xpsMatrixToUse; HR(this->createXpsTransform(localMatrix, &xpsMatrixToUse)); - + if (SkShader::kLinear_GradientType == gradientType) { HR(this->createXpsLinearGradient(info, skPaint.getAlpha(), @@ -991,7 +991,7 @@ HRESULT SkXPSDevice::createXpsBrush(const SkPaint& skPaint, brush)); return S_OK; } - + if (SkShader::kRadial_GradientType == gradientType) { HR(this->createXpsRadialGradient(info, skPaint.getAlpha(), @@ -1000,16 +1000,16 @@ HRESULT SkXPSDevice::createXpsBrush(const SkPaint& skPaint, brush)); return S_OK; } - + if (SkShader::kRadial2_GradientType == gradientType) { //simple if affine and one is 0, otherwise will have to fake } - + if (SkShader::kSweep_GradientType == gradientType) { //have to fake } } - + SkBitmap outTexture; SkMatrix outMatrix; SkShader::TileMode xy[2]; @@ -1028,16 +1028,16 @@ HRESULT SkXPSDevice::createXpsBrush(const SkPaint& skPaint, if (NULL != parentTransform) { localMatrix.preConcat(*parentTransform); } - + SkTScopedComPtr tileBrush; HR(this->createXpsImageBrush(outTexture, localMatrix, xy, skPaint.getAlpha(), &tileBrush)); - + HRM(tileBrush->QueryInterface(brush), "QI failed."); - + return S_OK; } case SkShader::kRadial_BitmapType: @@ -1046,7 +1046,7 @@ HRESULT SkXPSDevice::createXpsBrush(const SkPaint& skPaint, default: break; } - + HR(this->createXpsSolidColorBrush(skPaint.getColor(), 0xFF, brush)); return S_OK; } @@ -1054,7 +1054,7 @@ HRESULT SkXPSDevice::createXpsBrush(const SkPaint& skPaint, static bool rect_must_be_pathed(const SkPaint& paint, const SkMatrix& matrix) { const bool zeroWidth = (0 == paint.getStrokeWidth()); const bool stroke = (SkPaint::kFill_Style != paint.getStyle()); - + return paint.getPathEffect() || paint.getMaskFilter() || paint.getRasterizer() || @@ -1082,40 +1082,40 @@ HRESULT SkXPSDevice::createXpsQuad(const SkPoint (&points)[4], IXpsOMGeometryFigure** xpsQuad) { // Define the start point. XPS_POINT startPoint = xps_point(points[0]); - + // Create the figure. HRM(this->fXpsFactory->CreateGeometryFigure(&startPoint, xpsQuad), "Could not create quad geometry figure."); - + // Define the type of each segment. XPS_SEGMENT_TYPE segmentTypes[3] = { XPS_SEGMENT_TYPE_LINE, XPS_SEGMENT_TYPE_LINE, XPS_SEGMENT_TYPE_LINE, }; - + // Define the x and y coordinates of each corner of the figure. FLOAT segmentData[6] = { SkScalarToFLOAT(points[1].fX), SkScalarToFLOAT(points[1].fY), SkScalarToFLOAT(points[2].fX), SkScalarToFLOAT(points[2].fY), SkScalarToFLOAT(points[3].fX), SkScalarToFLOAT(points[3].fY), }; - + // Describe if the segments are stroked. BOOL segmentStrokes[3] = { stroke, stroke, stroke, }; - + // Add the segment data to the figure. HRM((*xpsQuad)->SetSegments( 3, 6, segmentTypes , segmentData, segmentStrokes), "Could not add segment data to quad."); - + // Set the closed and filled properties of the figure. HRM((*xpsQuad)->SetIsClosed(stroke), "Could not set quad close."); HRM((*xpsQuad)->SetIsFilled(fill), "Could not set quad fill."); - + return S_OK; } @@ -1146,7 +1146,7 @@ void SkXPSDevice::drawVertices(const SkDraw&, SkCanvas::VertexMode, void SkXPSDevice::drawPaint(const SkDraw& d, const SkPaint& paint) { const SkRect r = SkRect::MakeSize(this->fCurrentCanvasSize); - + //If trying to paint with a stroke, ignore that and fill. SkPaint* fillPaint = const_cast(&paint); SkTLazy modifiedPaint; @@ -1154,7 +1154,7 @@ void SkXPSDevice::drawPaint(const SkDraw& d, const SkPaint& paint) { fillPaint = modifiedPaint.set(paint); fillPaint->setStyle(SkPaint::kFill_Style); } - + this->internalDrawRect(d, r, false, *fillPaint); } @@ -1173,7 +1173,7 @@ void SkXPSDevice::internalDrawRect(const SkDraw& d, (paint.getAlpha() == 0 && paint.getXfermode() == NULL)) { return; } - + //Path the rect if we can't optimize it. if (rect_must_be_pathed(paint, *d.fMatrix)) { SkPath tmp; @@ -1182,26 +1182,26 @@ void SkXPSDevice::internalDrawRect(const SkDraw& d, this->drawPath(d, tmp, paint, NULL, true); return; } - + //Create the shaded path. SkTScopedComPtr shadedPath; HRVM(this->fXpsFactory->CreatePath(&shadedPath), "Could not create shaded path for rect."); - + //Create the shaded geometry. SkTScopedComPtr shadedGeometry; HRVM(this->fXpsFactory->CreateGeometry(&shadedGeometry), "Could not create shaded geometry for rect."); - + //Add the geometry to the shaded path. HRVM(shadedPath->SetGeometryLocal(shadedGeometry.get()), "Could not set shaded geometry for rect."); - + //Set the brushes. BOOL fill = FALSE; BOOL stroke = FALSE; HRV(this->shadePath(shadedPath.get(), paint, *d.fMatrix, &fill, &stroke)); - + bool xpsTransformsPath = true; //Transform the geometry. if (transformRect && xpsTransformsPath) { @@ -1214,7 +1214,7 @@ void SkXPSDevice::internalDrawRect(const SkDraw& d, xpsTransformsPath = false; } } - + //Create the figure. SkTScopedComPtr rectFigure; { @@ -1229,18 +1229,18 @@ void SkXPSDevice::internalDrawRect(const SkDraw& d, } HRV(this->createXpsQuad(points, stroke, fill, &rectFigure)); } - + //Get the figures of the shaded geometry. SkTScopedComPtr shadedFigures; HRVM(shadedGeometry->GetFigures(&shadedFigures), "Could not get shaded figures for rect."); - + //Add the figure to the shaded geometry figures. HRVM(shadedFigures->Append(rectFigure.get()), "Could not add shaded figure for rect."); - + HRV(this->clip(shadedPath.get(), d)); - + //Add the shaded path to the current visuals. SkTScopedComPtr currentVisuals; HRVM(this->fCurrentXpsCanvas->GetVisuals(¤tVisuals), @@ -1260,11 +1260,11 @@ static HRESULT close_figure(const SkTDArray& segmentTypes, segmentTypes.begin() , segmentData.begin(), segmentStrokes.begin()), "Could not set path segments."); - + // Set the closed and filled properties of the figure. HRM(figure->SetIsClosed(stroke), "Could not set path closed."); HRM(figure->SetIsFilled(fill), "Could not set path fill."); - + // Add the figure created above to this geometry. HRM(figures->Append(figure), "Could not add path to geometry."); return S_OK; @@ -1276,7 +1276,7 @@ HRESULT SkXPSDevice::addXpsPathGeometry( SkTDArray segmentTypes; SkTDArray segmentStrokes; SkTDArray segmentData; - + SkTScopedComPtr xpsFigure; SkPath::Iter iter(path, true); SkPoint points[4]; @@ -1348,26 +1348,26 @@ HRESULT SkXPSDevice::drawInverseWindingPath(const SkDraw& d, IXpsOMPath* shadedPath) { const SkRect universeRect = SkRect::MakeLTRB(0, 0, this->fCurrentCanvasSize.fWidth, this->fCurrentCanvasSize.fHeight); - + const XPS_RECT universeRectXps = { 0.0f, 0.0f, SkScalarToFLOAT(this->fCurrentCanvasSize.fWidth), SkScalarToFLOAT(this->fCurrentCanvasSize.fHeight), }; - + //Get the geometry. SkTScopedComPtr shadedGeometry; HRM(shadedPath->GetGeometry(&shadedGeometry), "Could not get shaded geometry for inverse path."); - + //Get the figures from the geometry. SkTScopedComPtr shadedFigures; HRM(shadedGeometry->GetFigures(&shadedFigures), "Could not get shaded figures for inverse path."); - + HRM(shadedGeometry->SetFillRule(XPS_FILL_RULE_NONZERO), "Could not set shaded fill rule for inverse path."); - + //Take everything drawn so far, and make a shared resource out of it. //Replace everything drawn so far with //inverse canvas @@ -1377,19 +1377,19 @@ HRESULT SkXPSDevice::drawInverseWindingPath(const SkDraw& d, //Note: this is not quite right when there is nothing solid in the //canvas of everything so far, as the bit on top will allow //the world paint to show through. - + //Create new canvas. SkTScopedComPtr newCanvas; HRM(this->fXpsFactory->CreateCanvas(&newCanvas), "Could not create inverse canvas."); - + //Save the old canvas to a dictionary on the new canvas. SkTScopedComPtr newDictionary; HRM(this->fXpsFactory->CreateDictionary(&newDictionary), "Could not create inverse dictionary."); HRM(newCanvas->SetDictionaryLocal(newDictionary.get()), "Could not set inverse dictionary."); - + const size_t size = SK_ARRAY_COUNT(L"ID" L_GUID_ID); wchar_t buffer[size]; wchar_t id[GUID_ID_LEN]; @@ -1397,32 +1397,32 @@ HRESULT SkXPSDevice::drawInverseWindingPath(const SkDraw& d, swprintf_s(buffer, size, L"ID%s", id); HRM(newDictionary->Append(buffer, this->fCurrentXpsCanvas.get()), "Could not add canvas to inverse dictionary."); - + //Start drawing SkTScopedComPtr newVisuals; HRM(newCanvas->GetVisuals(&newVisuals), "Could not get inverse canvas visuals."); - + //Draw old canvas from dictionary onto new canvas. SkTScopedComPtr oldGeometry; HRM(this->fXpsFactory->CreateGeometry(&oldGeometry), "Could not create old inverse geometry."); - + SkTScopedComPtr oldFigures; HRM(oldGeometry->GetFigures(&oldFigures), "Could not get old inverse figures."); - + SkTScopedComPtr oldFigure; HR(this->createXpsRect(universeRect, FALSE, TRUE, &oldFigure)); HRM(oldFigures->Append(oldFigure.get()), "Could not add old inverse figure."); - + SkTScopedComPtr oldBrush; HRM(this->fXpsFactory->CreateVisualBrush(&universeRectXps, &universeRectXps, &oldBrush), "Could not create old inverse brush."); - + SkTScopedComPtr oldPath; HRM(this->fXpsFactory->CreatePath(&oldPath), "Could not create old inverse path."); @@ -1435,7 +1435,7 @@ HRESULT SkXPSDevice::drawInverseWindingPath(const SkDraw& d, "Could not add old inverse path to new canvas visuals."); HRM(oldBrush->SetVisualLookup(buffer), "Could not set old inverse brush visual lookup."); - + //Draw the clip filling shader. SkTScopedComPtr shadedFigure; HR(this->createXpsRect(universeRect, FALSE, TRUE, &shadedFigure)); @@ -1445,7 +1445,7 @@ HRESULT SkXPSDevice::drawInverseWindingPath(const SkDraw& d, HR(this->clip(shadedPath, d)); HRM(newVisuals->Append(shadedPath), "Could not add inverse shaded path to canvas visuals."); - + //Draw the old canvas on top, clipped to the original path. SkTScopedComPtr topCanvas; HRM(this->fXpsFactory->CreateCanvas(&topCanvas), @@ -1453,26 +1453,26 @@ HRESULT SkXPSDevice::drawInverseWindingPath(const SkDraw& d, //Clip the canvas to prevent alpha spill. //This is the entire reason this canvas exists. HR(this->clip(topCanvas.get(), d)); - + SkTScopedComPtr topGeometry; HRM(this->fXpsFactory->CreateGeometry(&topGeometry), "Could not create top inverse geometry."); - + SkTScopedComPtr topFigures; HRM(topGeometry->GetFigures(&topFigures), "Could not get top inverse figures."); - + SkTScopedComPtr topFigure; HR(this->createXpsRect(universeRect, FALSE, TRUE, &topFigure)); HRM(topFigures->Append(topFigure.get()), "Could not add old inverse figure."); - + SkTScopedComPtr topBrush; HRM(this->fXpsFactory->CreateVisualBrush(&universeRectXps, &universeRectXps, &topBrush), "Could not create top inverse brush."); - + SkTScopedComPtr topPath; HRM(this->fXpsFactory->CreatePath(&topPath), "Could not create top inverse path."); @@ -1490,12 +1490,12 @@ HRESULT SkXPSDevice::drawInverseWindingPath(const SkDraw& d, "Could not add top inverse path to top canvas visuals."); HRM(topBrush->SetVisualLookup(buffer), "Could not set top inverse brush visual lookup."); - + HR(this->clipToPath(topPath.get(), devicePath, XPS_FILL_RULE_NONZERO)); - + //swap current canvas to new canvas this->fCurrentXpsCanvas.swap(newCanvas); - + return S_OK; } @@ -1507,7 +1507,7 @@ void SkXPSDevice::convertToPpm(const SkMaskFilter* filter, if (filter) { SkMaskFilter::BlurInfo blurInfo; SkMaskFilter::BlurType blurType = filter->asABlur(&blurInfo); - + if (SkMaskFilter::kNone_BlurType != blurType && blurInfo.fIgnoreTransform) { @@ -1517,15 +1517,15 @@ void SkXPSDevice::convertToPpm(const SkMaskFilter* filter, return; } } - + //This action is in unit space, but the ppm is specified in physical space. ppuScale->fX = SkScalarDiv(this->fCurrentPixelsPerMeter.fX, this->fCurrentUnitsPerMeter.fX); ppuScale->fY = SkScalarDiv(this->fCurrentPixelsPerMeter.fY, this->fCurrentUnitsPerMeter.fY); - + matrix->postScale(ppuScale->fX, ppuScale->fY); - + const SkIRect& irect = clip; SkRect clipRect = SkRect::MakeLTRB( SkScalarMul(SkIntToScalar(irect.fLeft), ppuScale->fX), @@ -1543,34 +1543,34 @@ HRESULT SkXPSDevice::applyMask(const SkDraw& d, SkTScopedComPtr shadedGeometry; HRM(shadedPath->GetGeometry(&shadedGeometry), "Could not get mask shaded geometry."); - + //Get the figures from the geometry. SkTScopedComPtr shadedFigures; HRM(shadedGeometry->GetFigures(&shadedFigures), "Could not get mask shaded figures."); - + SkMatrix m; m.reset(); m.setTranslate(SkIntToScalar(mask.fBounds.fLeft), SkIntToScalar(mask.fBounds.fTop)); m.postScale(SkScalarInvert(ppuScale.fX), SkScalarInvert(ppuScale.fY)); - + SkShader::TileMode xy[2]; xy[0] = (SkShader::TileMode)3; xy[1] = (SkShader::TileMode)3; - + SkBitmap bm; bm.setConfig(SkBitmap::kA8_Config, mask.fBounds.width(), mask.fBounds.height(), mask.fRowBytes); bm.setPixels(mask.fImage); - + SkTScopedComPtr maskBrush; HR(this->createXpsImageBrush(bm, m, xy, 0xFF, &maskBrush)); HRM(shadedPath->SetOpacityMaskBrushLocal(maskBrush.get()), "Could not set mask."); - + const SkRect universeRect = SkRect::MakeLTRB(0, 0, this->fCurrentCanvasSize.fWidth, this->fCurrentCanvasSize.fHeight); SkTScopedComPtr shadedFigure; @@ -1578,16 +1578,16 @@ HRESULT SkXPSDevice::applyMask(const SkDraw& d, "Could not create mask shaded figure."); HRM(shadedFigures->Append(shadedFigure.get()), "Could not add mask shaded figure."); - + HR(this->clip(shadedPath, d)); - + //Add the path to the active visual collection. SkTScopedComPtr currentVisuals; HRM(this->fCurrentXpsCanvas->GetVisuals(¤tVisuals), "Could not get mask current visuals."); HRM(currentVisuals->Append(shadedPath), "Could not add masked shaded path to current visuals."); - + return S_OK; } @@ -1597,13 +1597,13 @@ HRESULT SkXPSDevice::shadePath(IXpsOMPath* shadedPath, BOOL* fill, BOOL* stroke) { *fill = FALSE; *stroke = FALSE; - + const SkPaint::Style style = shaderPaint.getStyle(); const bool hasFill = SkPaint::kFill_Style == style || SkPaint::kStrokeAndFill_Style == style; const bool hasStroke = SkPaint::kStroke_Style == style || SkPaint::kStrokeAndFill_Style == style; - + //TODO(bungeman): use dictionaries and lookups. if (hasFill) { *fill = TRUE; @@ -1612,7 +1612,7 @@ HRESULT SkXPSDevice::shadePath(IXpsOMPath* shadedPath, HRM(shadedPath->SetFillBrushLocal(fillBrush.get()), "Could not set fill for shaded path."); } - + if (hasStroke) { *stroke = TRUE; SkTScopedComPtr strokeBrush; @@ -1622,7 +1622,7 @@ HRESULT SkXPSDevice::shadePath(IXpsOMPath* shadedPath, HRM(shadedPath->SetStrokeThickness( SkScalarToFLOAT(shaderPaint.getStrokeWidth())), "Could not set shaded path stroke thickness."); - + if (0 == shaderPaint.getStrokeWidth()) { //XPS hair width is a hack. (XPS Spec 11.6.12). SkTScopedComPtr dashes; @@ -1649,11 +1649,11 @@ void SkXPSDevice::drawPath(const SkDraw& d, (paint.getAlpha() == 0 && paint.getXfermode() == NULL)) { return; } - + SkPath modifiedPath; const bool paintHasPathEffect = paint.getPathEffect() || paint.getStyle() != SkPaint::kFill_Style; - + //Apply pre-path matrix [Platonic-path -> Skeletal-path]. SkMatrix matrix = *d.fMatrix; SkPath* skeletalPath = const_cast(&platonicPath); @@ -1670,10 +1670,10 @@ void SkXPSDevice::drawPath(const SkDraw& d, } } } - + SkTLazy modifiedPaint; SkPaint* shaderPaint = const_cast(&paint); - + //Apply path effect [Skeletal-path -> Fillable-path]. SkPath* fillablePath = skeletalPath; if (paintHasPathEffect) { @@ -1682,7 +1682,7 @@ void SkXPSDevice::drawPath(const SkDraw& d, pathIsMutable = true; } bool fill = paint.getFillPath(*skeletalPath, fillablePath); - + shaderPaint = modifiedPaint.set(paint); shaderPaint->setPathEffect(NULL); if (fill) { @@ -1692,21 +1692,21 @@ void SkXPSDevice::drawPath(const SkDraw& d, shaderPaint->setStrokeWidth(0); } } - + //Create the shaded path. This will be the path which is painted. SkTScopedComPtr shadedPath; HRVM(this->fXpsFactory->CreatePath(&shadedPath), "Could not create shaded path for path."); - + //Create the geometry for the shaded path. SkTScopedComPtr shadedGeometry; HRVM(this->fXpsFactory->CreateGeometry(&shadedGeometry), "Could not create shaded geometry for path."); - + //Add the geometry to the shaded path. HRVM(shadedPath->SetGeometryLocal(shadedGeometry.get()), "Could not add the shaded geometry to shaded path."); - + //Set the brushes. BOOL fill; BOOL stroke; @@ -1715,9 +1715,9 @@ void SkXPSDevice::drawPath(const SkDraw& d, *d.fMatrix, &fill, &stroke)); - + SkMaskFilter* filter = paint.getMaskFilter(); - + //Rasterizer if (paint.getRasterizer()) { SkIRect clipIRect; @@ -1727,9 +1727,9 @@ void SkXPSDevice::drawPath(const SkDraw& d, &ppuScale, d.fClip->getBounds(), &clipIRect); - + SkMask* mask = NULL; - + //[Fillable-path -> Mask] SkMask rasteredMask; if (paint.getRasterizer()->rasterize( @@ -1739,27 +1739,27 @@ void SkXPSDevice::drawPath(const SkDraw& d, filter, //just to compute how much to draw. &rasteredMask, SkMask::kComputeBoundsAndRenderImage_CreateMode)) { - + SkAutoMaskFreeImage rasteredAmi(rasteredMask.fImage); mask = &rasteredMask; - + //[Mask -> Mask] SkMask filteredMask; if (filter && filter->filterMask(&filteredMask, *mask, *d.fMatrix, NULL)) { - + mask = &filteredMask; } else { filteredMask.fImage = NULL; } SkAutoMaskFreeImage filteredAmi(filteredMask.fImage); - + //Draw mask. HRV(this->applyMask(d, *mask, ppuScale, shadedPath.get())); } return; } - + //Mask filter if (filter) { SkIRect clipIRect; @@ -1769,13 +1769,13 @@ void SkXPSDevice::drawPath(const SkDraw& d, &ppuScale, d.fClip->getBounds(), &clipIRect); - + //[Fillable-path -> Pixel-path] SkPath* pixelPath = pathIsMutable ? fillablePath : &modifiedPath; fillablePath->transform(matrix, pixelPath); - + SkMask* mask = NULL; - + //[Pixel-path -> Mask] SkMask rasteredMask; if (SkDraw::DrawToMask( @@ -1785,10 +1785,10 @@ void SkXPSDevice::drawPath(const SkDraw& d, &matrix, &rasteredMask, SkMask::kComputeBoundsAndRenderImage_CreateMode)) { - + SkAutoMaskFreeImage rasteredAmi(rasteredMask.fImage); mask = &rasteredMask; - + //[Mask -> Mask] SkMask filteredMask; if (filter->filterMask(&filteredMask, @@ -1800,20 +1800,20 @@ void SkXPSDevice::drawPath(const SkDraw& d, filteredMask.fImage = NULL; } SkAutoMaskFreeImage filteredAmi(filteredMask.fImage); - + //Draw mask. HRV(this->applyMask(d, *mask, ppuScale, shadedPath.get())); } return; } - + //Get the figures from the shaded geometry. SkTScopedComPtr shadedFigures; HRVM(shadedGeometry->GetFigures(&shadedFigures), "Could not get shaded figures for shaded path."); - + bool xpsTransformsPath = true; - + //Set the fill rule. XPS_FILL_RULE xpsFillRule; switch (platonicPath.getFillType()) { @@ -1827,7 +1827,7 @@ void SkXPSDevice::drawPath(const SkDraw& d, //[Fillable-path -> Device-path] SkPath* devicePath = pathIsMutable ? fillablePath : &modifiedPath; fillablePath->transform(matrix, devicePath); - + HRV(this->drawInverseWindingPath(d, *devicePath, shadedPath.get())); @@ -1851,12 +1851,12 @@ void SkXPSDevice::drawPath(const SkDraw& d, } HRVM(shadedGeometry->SetFillRule(xpsFillRule), "Could not set fill rule for shaded path."); - + //Create the XPS transform, if possible. if (xpsTransformsPath) { SkTScopedComPtr xpsTransform; HRV(this->createXpsTransform(matrix, &xpsTransform)); - + if (xpsTransform.get()) { HRVM(shadedGeometry->SetTransformLocal(xpsTransform.get()), "Could not set transform on shaded path."); @@ -1864,7 +1864,7 @@ void SkXPSDevice::drawPath(const SkDraw& d, xpsTransformsPath = false; } } - + SkPath* devicePath = fillablePath; if (!xpsTransformsPath) { //[Fillable-path -> Device-path] @@ -1873,9 +1873,9 @@ void SkXPSDevice::drawPath(const SkDraw& d, } HRV(this->addXpsPathGeometry(shadedFigures.get(), stroke, fill, *devicePath)); - + HRV(this->clip(shadedPath.get(), d)); - + //Add the path to the active visual collection. SkTScopedComPtr currentVisuals; HRVM(this->fCurrentXpsCanvas->GetVisuals(¤tVisuals), @@ -1887,7 +1887,7 @@ void SkXPSDevice::drawPath(const SkDraw& d, HRESULT SkXPSDevice::clip(IXpsOMVisual* xpsVisual, const SkDraw& d) { SkPath clipPath; SkAssertResult(d.fClip->getBoundaryPath(&clipPath)); - + return this->clipToPath(xpsVisual, clipPath, XPS_FILL_RULE_EVENODD); } HRESULT SkXPSDevice::clipToPath(IXpsOMVisual* xpsVisual, @@ -1897,22 +1897,22 @@ HRESULT SkXPSDevice::clipToPath(IXpsOMVisual* xpsVisual, SkTScopedComPtr clipGeometry; HRM(this->fXpsFactory->CreateGeometry(&clipGeometry), "Could not create clip geometry."); - + //Get the figure collection of the geometry. SkTScopedComPtr clipFigures; HRM(clipGeometry->GetFigures(&clipFigures), "Could not get the clip figures."); - + //Create the figures into the geometry. HR(this->addXpsPathGeometry( clipFigures.get(), FALSE, TRUE, clipPath)); - + HRM(clipGeometry->SetFillRule(fillRule), "Could not set fill rule."); HRM(xpsVisual->SetClipGeometryLocal(clipGeometry.get()), "Could not set clip geometry."); - + return S_OK; } @@ -1922,7 +1922,7 @@ void SkXPSDevice::drawBitmap(const SkDraw& d, const SkBitmap& bitmap, if (d.fClip->isEmpty()) { return; } - + SkIRect srcRect; SkBitmap tmp; const SkBitmap* bitmapPtr = &bitmap; @@ -1936,29 +1936,29 @@ void SkXPSDevice::drawBitmap(const SkDraw& d, const SkBitmap& bitmap, } bitmapPtr = &tmp; } - + //Create the new shaded path. SkTScopedComPtr shadedPath; HRVM(this->fXpsFactory->CreatePath(&shadedPath), "Could not create path for bitmap."); - + //Create the shaded geometry. SkTScopedComPtr shadedGeometry; HRVM(this->fXpsFactory->CreateGeometry(&shadedGeometry), "Could not create geometry for bitmap."); - + //Add the shaded geometry to the shaded path. HRVM(shadedPath->SetGeometryLocal(shadedGeometry.get()), "Could not set the geometry for bitmap."); - + //Get the shaded figures from the shaded geometry. SkTScopedComPtr shadedFigures; HRVM(shadedGeometry->GetFigures(&shadedFigures), "Could not get the figures for bitmap."); - + SkMatrix transform = matrix; transform.postConcat(*d.fMatrix); - + SkTScopedComPtr xpsTransform; HRV(this->createXpsTransform(transform, &xpsTransform)); if (xpsTransform.get()) { @@ -1967,7 +1967,7 @@ void SkXPSDevice::drawBitmap(const SkDraw& d, const SkBitmap& bitmap, } else { //TODO: perspective that bitmap! } - + SkTScopedComPtr rectFigure; if (NULL != xpsTransform.get()) { const SkShader::TileMode xy[2] = { @@ -1982,21 +1982,21 @@ void SkXPSDevice::drawBitmap(const SkDraw& d, const SkBitmap& bitmap, &xpsImageBrush)); HRVM(shadedPath->SetFillBrushLocal(xpsImageBrush.get()), "Could not set bitmap brush."); - + const SkRect bitmapRect = SkRect::MakeLTRB(0, 0, SkIntToScalar(srcRect.width()), SkIntToScalar(srcRect.height())); HRV(this->createXpsRect(bitmapRect, FALSE, TRUE, &rectFigure)); } HRVM(shadedFigures->Append(rectFigure.get()), "Could not add bitmap figure."); - + //Get the current visual collection and add the shaded path to it. SkTScopedComPtr currentVisuals; HRVM(this->fCurrentXpsCanvas->GetVisuals(¤tVisuals), "Could not get current visuals for bitmap"); HRVM(currentVisuals->Append(shadedPath.get()), "Could not add bitmap to current visuals."); - + HRV(this->clip(shadedPath.get(), d)); } @@ -2010,7 +2010,7 @@ void SkXPSDevice::drawSprite(const SkDraw&, const SkBitmap& bitmap, HRESULT SkXPSDevice::CreateTypefaceUse(const SkPaint& paint, TypefaceUse** typefaceUse) { const SkTypeface* typeface = paint.getTypeface(); - + //Check cache. const SkFontID typefaceID = SkTypeface::UniqueID(typeface); if (!this->fTypefaces.empty()) { @@ -2023,27 +2023,27 @@ HRESULT SkXPSDevice::CreateTypefaceUse(const SkPaint& paint, } } } - + //TODO: create glyph only fonts //and let the host deal with what kind of font we're looking at. XPS_FONT_EMBEDDING embedding = XPS_FONT_EMBEDDING_RESTRICTED; - + SkTScopedComPtr fontStream; SkStream* fontData = SkFontHost::OpenStream(typefaceID); HRM(SkIStream::CreateFromSkStream(fontData, true, &fontStream), "Could not create font stream."); - + const size_t size = SK_ARRAY_COUNT(L"/Resources/Fonts/" L_GUID_ID L".odttf"); wchar_t buffer[size]; wchar_t id[GUID_ID_LEN]; HR(create_id(id, GUID_ID_LEN)); swprintf_s(buffer, size, L"/Resources/Fonts/%s.odttf", id); - + SkTScopedComPtr partUri; HRM(this->fXpsFactory->CreatePartUri(buffer, &partUri), "Could not create font resource part uri."); - + SkTScopedComPtr xpsFontResource; HRM(this->fXpsFactory->CreateFontResource(fontStream.get(), embedding, @@ -2051,17 +2051,17 @@ HRESULT SkXPSDevice::CreateTypefaceUse(const SkPaint& paint, FALSE, &xpsFontResource), "Could not create font resource."); - + TypefaceUse& newTypefaceUse = this->fTypefaces.push_back(); newTypefaceUse.typefaceId = typefaceID; newTypefaceUse.fontData = fontData; newTypefaceUse.xpsFont = xpsFontResource.release(); - + SkAutoGlyphCache agc = SkAutoGlyphCache(paint, &SkMatrix::I()); SkGlyphCache* glyphCache = agc.getCache(); unsigned int glyphCount = glyphCache->getGlyphCount(); newTypefaceUse.glyphsUsed = new SkBitSet(glyphCount); - + *typefaceUse = &newTypefaceUse; return S_OK; } @@ -2080,7 +2080,7 @@ HRESULT SkXPSDevice::AddGlyphs(const SkDraw& d, const SkPaint& paint) { SkTScopedComPtr glyphs; HRM(xpsFactory->CreateGlyphs(font, &glyphs), "Could not create glyphs."); - + //XPS uses affine transformations for everything... //...except positioning text. bool useCanvasForClip; @@ -2100,42 +2100,42 @@ HRESULT SkXPSDevice::AddGlyphs(const SkDraw& d, useCanvasForClip = false; } } - + SkTScopedComPtr glyphsEditor; HRM(glyphs->GetGlyphsEditor(&glyphsEditor), "Could not get glyph editor."); - + if (NULL != text) { HRM(glyphsEditor->SetUnicodeString(text), "Could not set unicode string."); } - + if (NULL != xpsGlyphs) { HRM(glyphsEditor->SetGlyphIndices(xpsGlyphsLen, xpsGlyphs), "Could not set glyphs."); } - + HRM(glyphsEditor->ApplyEdits(), "Could not apply glyph edits."); - + SkTScopedComPtr xpsFillBrush; HR(this->createXpsBrush( paint, &xpsFillBrush, useCanvasForClip ? NULL : &transform)); - + HRM(glyphs->SetFillBrushLocal(xpsFillBrush.get()), "Could not set fill brush."); - + HRM(glyphs->SetOrigin(origin), "Could not set glyph origin."); - + HRM(glyphs->SetFontRenderingEmSize(fontSize), "Could not set font size."); - + HRM(glyphs->SetStyleSimulations(sims), "Could not set style simulations."); - + SkTScopedComPtr visuals; HRM(canvas->GetVisuals(&visuals), "Could not get glyph canvas visuals."); - + if (!useCanvasForClip) { HR(this->clip(glyphs.get(), d)); HRM(visuals->Append(glyphs.get()), "Could not add glyphs to canvas."); @@ -2143,19 +2143,19 @@ HRESULT SkXPSDevice::AddGlyphs(const SkDraw& d, SkTScopedComPtr glyphCanvas; HRM(this->fXpsFactory->CreateCanvas(&glyphCanvas), "Could not create glyph canvas."); - + SkTScopedComPtr glyphCanvasVisuals; HRM(glyphCanvas->GetVisuals(&glyphCanvasVisuals), "Could not get glyph visuals collection."); - + HRM(glyphCanvasVisuals->Append(glyphs.get()), "Could not add glyphs to page."); HR(this->clip(glyphCanvas.get(), d)); - + HRM(visuals->Append(glyphCanvas.get()), "Could not add glyph canvas to page."); } - + return S_OK; } @@ -2174,7 +2174,7 @@ static void xps_draw_1_glyph(const SkDraw1Glyph& state, SkFixed x, SkFixed y, const SkGlyph& skGlyph) { SkASSERT(skGlyph.fWidth > 0 && skGlyph.fHeight > 0); - + SkXPSDrawProcs* procs = static_cast(state.fDraw->fProcs); //Draw pre-adds half the sampling frequency for floor rounding. @@ -2185,7 +2185,7 @@ static void xps_draw_1_glyph(const SkDraw1Glyph& state, x -= SK_FixedHalf; y -= SK_FixedHalf; } - + XPS_GLYPH_INDEX* xpsGlyph = procs->xpsGlyphs.append(); uint16_t glyphID = skGlyph.getGlyphID(); procs->glyphUse->setBit(glyphID, true); @@ -2230,7 +2230,7 @@ static void text_draw_init(const SkPaint& paint, procs.xpsGlyphs.setReserve(numGlyphGuess); procs.glyphUse = &glyphsUsed; procs.centemPerUnit = 100.0f / SkScalarToFLOAT(paint.getTextSize()); - + myDraw.fProcs = &procs; myDraw.fMVMatrix = &SkMatrix::I(); myDraw.fExtMatrix = &SkMatrix::I(); @@ -2251,7 +2251,7 @@ void SkXPSDevice::drawText(const SkDraw& d, SkScalar x, SkScalar y, const SkPaint& paint) { if (byteLen < 1) return; - + if (text_must_be_pathed(paint, *d.fMatrix)) { SkPath path; paint.getTextPath(text, byteLen, x, y, &path); @@ -2259,14 +2259,14 @@ void SkXPSDevice::drawText(const SkDraw& d, //TODO: add automation "text" return; } - + TypefaceUse* typeface; HRV(CreateTypefaceUse(paint, &typeface)); - + SkDraw myDraw(d); SkXPSDrawProcs procs; text_draw_init(paint, text, byteLen, *typeface->glyphsUsed, myDraw, procs); - + myDraw.drawText(static_cast(text), byteLen, x, y, paint); // SkDraw may have clipped out the glyphs, so we need to check @@ -2280,7 +2280,7 @@ void SkXPSDevice::drawText(const SkDraw& d, }; procs.xpsGlyphs[0].horizontalOffset = 0.0f; procs.xpsGlyphs[0].verticalOffset = 0.0f; - + HRV(AddGlyphs(d, this->fXpsFactory.get(), this->fCurrentXpsCanvas.get(), @@ -2300,7 +2300,7 @@ void SkXPSDevice::drawPosText(const SkDraw& d, SkScalar constY, int scalarsPerPos, const SkPaint& paint) { if (byteLen < 1) return; - + if (text_must_be_pathed(paint, *d.fMatrix)) { SkPath path; //TODO: make this work, Draw currently does not handle as well. @@ -2309,18 +2309,18 @@ void SkXPSDevice::drawPosText(const SkDraw& d, //TODO: add automation "text" return; } - + TypefaceUse* typeface; HRV(CreateTypefaceUse(paint, &typeface)); - + SkDraw myDraw(d); SkXPSDrawProcs procs; text_draw_init(paint, text, byteLen, *typeface->glyphsUsed, myDraw, procs); - + myDraw.drawPosText(static_cast(text), byteLen, pos, constY, scalarsPerPos, paint); - + // SkDraw may have clipped out the glyphs, so we need to check if (procs.xpsGlyphs.count() == 0) { return; @@ -2332,7 +2332,7 @@ void SkXPSDevice::drawPosText(const SkDraw& d, }; procs.xpsGlyphs[0].horizontalOffset = 0.0f; procs.xpsGlyphs[0].verticalOffset = 0.0f; - + HRV(AddGlyphs(d, this->fXpsFactory.get(), this->fCurrentXpsCanvas.get(), @@ -2357,7 +2357,7 @@ void SkXPSDevice::drawDevice(const SkDraw& d, SkDevice* dev, int x, int y, const SkPaint&) { SkXPSDevice* that = static_cast(dev); - + SkTScopedComPtr xpsTransform; XPS_MATRIX rawTransform = { 1.0f, @@ -2371,7 +2371,7 @@ void SkXPSDevice::drawDevice(const SkDraw& d, SkDevice* dev, "Could not create layer transform."); HRVM(that->fCurrentXpsCanvas->SetTransformLocal(xpsTransform.get()), "Could not set layer transform."); - + //Get the current visual collection and add the layer to it. SkTScopedComPtr currentVisuals; HRVM(this->fCurrentXpsCanvas->GetVisuals(¤tVisuals), @@ -2398,21 +2398,21 @@ SkDevice* SkXPSDevice::onCreateCompatibleDevice(SkBitmap::Config config, //dev->BeginCanvas(s, s, SkMatrix::I()); //return dev; } - + return new SkXPSDevice(this->fXpsFactory.get()); } SkXPSDevice::SkXPSDevice(IXpsOMObjectFactory* xpsFactory) : SkDevice(make_fake_bitmap(10000, 10000)) , fCurrentPage(0) { - + HRVM(CoCreateInstance( CLSID_XpsOMObjectFactory, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&this->fXpsFactory)), "Could not create factory for layer."); - + HRVM(this->fXpsFactory->CreateCanvas(&this->fCurrentXpsCanvas), "Could not create canvas for layer."); } diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp index 25ded63..5a34ef2 100644 --- a/src/gpu/SkGpuDevice.cpp +++ b/src/gpu/SkGpuDevice.cpp @@ -149,18 +149,18 @@ SkGpuDevice::SkGpuDevice(GrContext* context, GrRenderTarget* renderTarget) this->initFromRenderTarget(context, renderTarget); } -void SkGpuDevice::initFromRenderTarget(GrContext* context, +void SkGpuDevice::initFromRenderTarget(GrContext* context, GrRenderTarget* renderTarget) { fNeedPrepareRenderTarget = false; fDrawProcs = NULL; - + fContext = context; fContext->ref(); - + fTexture = NULL; fRenderTarget = NULL; fNeedClear = false; - + GrAssert(NULL != renderTarget); fRenderTarget = renderTarget; fRenderTarget->ref(); @@ -202,7 +202,7 @@ SkGpuDevice::SkGpuDevice(GrContext* context, SkBitmap::Config config, int width, bm.setConfig(config, width, height); #if CACHE_LAYER_TEXTURES - TexType type = (kSaveLayer_Usage == usage) ? + TexType type = (kSaveLayer_Usage == usage) ? kSaveLayerDeviceRenderTarget_TexType : kDeviceRenderTarget_TexType; fCache = this->lockCachedTexture(bm, NULL, type); @@ -254,7 +254,7 @@ SkGpuDevice::~SkGpuDevice() { GrAssert(NULL != fTexture); GrAssert(fRenderTarget == fTexture->asRenderTarget()); fContext->unlockTexture(fCache); - } + } fContext->unref(); } @@ -385,8 +385,8 @@ void SkGpuDevice::gainFocus(SkCanvas* canvas, const SkMatrix& matrix, } } -SkGpuRenderTarget* SkGpuDevice::accessRenderTarget() { - return (SkGpuRenderTarget*)fRenderTarget; +SkGpuRenderTarget* SkGpuDevice::accessRenderTarget() { + return (SkGpuRenderTarget*)fRenderTarget; } bool SkGpuDevice::bindDeviceAsTexture(GrPaint* paint) { @@ -737,7 +737,7 @@ static float adjustSigma(float sigma, int *scaleFactor, int *halfWidth, // Apply a Gaussian blur to srcTexture by sigmaX and sigmaY, within the given // rect. // temp1 and temp2 are used for allocation of intermediate textures. -// If temp2 is non-NULL, srcTexture will be untouched, and the return +// If temp2 is non-NULL, srcTexture will be untouched, and the return // value will be either temp1 or temp2. // If temp2 is NULL, srcTexture will be overwritten with intermediate // results, and the return value will either be temp1 or srcTexture. @@ -784,7 +784,7 @@ static GrTexture* gaussianBlur(GrContext* context, GrTexture* srcTexture, srcTexture->height()); context->setRenderTarget(dstTexture->asRenderTarget()); SkRect dstRect(srcRect); - scaleRect(&dstRect, i < scaleFactorX ? 0.5f : 1.0f, + scaleRect(&dstRect, i < scaleFactorX ? 0.5f : 1.0f, i < scaleFactorY ? 0.5f : 1.0f); paint.setTexture(0, srcTexture); context->drawRectToRect(paint, dstRect, srcRect); @@ -974,7 +974,7 @@ static bool drawWithGPUMaskFilter(GrContext* context, const SkPath& path, } context->setRenderTarget(oldRenderTarget); context->setClip(oldClip); - + if (grp->hasTextureOrMask()) { GrMatrix inverse; if (!matrix.invert(&inverse)) { @@ -1084,7 +1084,7 @@ void SkGpuDevice::drawPath(const SkDraw& draw, const SkPath& origSrcPath, if (SkDrawTreatAsHairline(paint, *draw.fMatrix, &coverage)) { doFill = false; } - + GrPaint grPaint; SkAutoCachedTexture act; if (!this->skPaint2GrPaintShader(paint, @@ -1118,7 +1118,7 @@ void SkGpuDevice::drawPath(const SkDraw& draw, const SkPath& origSrcPath, // at this point we're done with prePathMatrix SkDEBUGCODE(prePathMatrix = (const SkMatrix*)0x50FF8001;) - if (doFill && (paint.getPathEffect() || + if (doFill && (paint.getPathEffect() || paint.getStyle() != SkPaint::kFill_Style)) { // it is safe to use tmpPath here, even if we already used it for the // prepathmatrix, since getFillPath can take the same object for its @@ -1176,7 +1176,7 @@ inline int get_tile_count(int l, int t, int r, int b, int tileSize) { return tilesX * tilesY; } -inline int determine_tile_size(const SkBitmap& bitmap, +inline int determine_tile_size(const SkBitmap& bitmap, const SkIRect* srcRectPtr, int maxTextureSize) { static const int kSmallTileSize = 1 << 10; @@ -1300,7 +1300,7 @@ void SkGpuDevice::drawBitmap(const SkDraw& draw, ScalarRect.set(srcRect); // Transform 'm' needs to be concatenated to the draw matrix, - // rather than transforming the primitive directly, so that 'm' will + // rather than transforming the primitive directly, so that 'm' will // also affect the behavior of the mask filter. SkMatrix drawMatrix; drawMatrix.setConcat(*draw.fMatrix, m); @@ -1427,7 +1427,7 @@ void SkGpuDevice::internalDrawBitmap(const SkDraw& draw, GrFixedToScalar((srcRect.fBottom << 16) / bitmap.height())); if (GrSamplerState::kNearest_Filter != sampler->getFilter() && - (srcRect.width() < bitmap.width() || + (srcRect.width() < bitmap.width() || srcRect.height() < bitmap.height())) { // If drawing a subrect of the bitmap and filtering is enabled, // use a constrained texture domain to avoid color bleeding @@ -1583,7 +1583,7 @@ void SkGpuDevice::drawVertices(const SkDraw& draw, SkCanvas::VertexMode vmode, if (NULL == texs) { if (!this->skPaint2GrPaintNoShader(paint, false, - &grPaint, + &grPaint, NULL == colors)) { return; } @@ -1803,7 +1803,7 @@ SkGpuDevice::TexCache SkGpuDevice::lockCachedTexture(const SkBitmap& bitmap, if (!bitmap.isVolatile()) { GrContext::TextureKey key = bitmap.getGenerationID(); key |= ((uint64_t) bitmap.pixelRefOffset()) << 32; - + entry = ctx->findAndLockTexture(key, bitmap.width(), bitmap.height(), sampler); if (NULL == entry.texture()) { @@ -1836,11 +1836,11 @@ bool SkGpuDevice::isBitmapInTextureCache(const SkBitmap& bitmap, } -SkDevice* SkGpuDevice::onCreateCompatibleDevice(SkBitmap::Config config, - int width, int height, +SkDevice* SkGpuDevice::onCreateCompatibleDevice(SkBitmap::Config config, + int width, int height, bool isOpaque, Usage usage) { - return SkNEW_ARGS(SkGpuDevice,(this->context(), config, + return SkNEW_ARGS(SkGpuDevice,(this->context(), config, width, height, usage)); } diff --git a/src/pipe/SkGPipeWrite.cpp b/src/pipe/SkGPipeWrite.cpp index 00d5d5f..ee6e2c7 100644 --- a/src/pipe/SkGPipeWrite.cpp +++ b/src/pipe/SkGPipeWrite.cpp @@ -112,14 +112,14 @@ public: const SkPaint*); virtual void drawSprite(const SkBitmap&, int left, int top, const SkPaint*); - virtual void drawText(const void* text, size_t byteLength, SkScalar x, + virtual void drawText(const void* text, size_t byteLength, SkScalar x, SkScalar y, const SkPaint&); - virtual void drawPosText(const void* text, size_t byteLength, + virtual void drawPosText(const void* text, size_t byteLength, const SkPoint pos[], const SkPaint&); virtual void drawPosTextH(const void* text, size_t byteLength, const SkScalar xpos[], SkScalar constY, const SkPaint&); - virtual void drawTextOnPath(const void* text, size_t byteLength, - const SkPath& path, const SkMatrix* matrix, + virtual void drawTextOnPath(const void* text, size_t byteLength, + const SkPath& path, const SkMatrix* matrix, const SkPaint&); virtual void drawPicture(SkPicture& picture); virtual void drawVertices(VertexMode, int vertexCount, @@ -144,7 +144,7 @@ private: inline void writeOp(DrawOps op, unsigned flags, unsigned data) { fWriter.write32(DrawOp_packOpFlagData(op, flags, data)); } - + inline void writeOp(DrawOps op) { fWriter.write32(DrawOp_packOpFlagData(op, 0, 0)); } @@ -164,7 +164,7 @@ private: uint32_t fSize; void* data() { return (char*)this + sizeof(*this); } - + static int Compare(const FlatData* a, const FlatData* b) { return memcmp(&a->fSize, &b->fSize, a->fSize + sizeof(a->fSize)); } @@ -307,7 +307,7 @@ int SkGPipeCanvas::saveLayer(const SkRect* bounds, const SkPaint* paint, NOTIFY_SETUP(this); size_t size = 0; unsigned opFlags = 0; - + if (bounds) { opFlags |= kSaveLayer_HasBounds_DrawOpFlag; size += sizeof(SkRect); @@ -323,7 +323,7 @@ int SkGPipeCanvas::saveLayer(const SkRect* bounds, const SkPaint* paint, fWriter.writeRect(*bounds); } } - + // we just pass on the save, so we don't create a layer return this->INHERITED::save(saveFlags); } @@ -506,7 +506,7 @@ void SkGPipeCanvas::drawSprite(const SkBitmap&, int left, int top, UNIMPLEMENTED } -void SkGPipeCanvas::drawText(const void* text, size_t byteLength, SkScalar x, +void SkGPipeCanvas::drawText(const void* text, size_t byteLength, SkScalar x, SkScalar y, const SkPaint& paint) { if (byteLength) { NOTIFY_SETUP(this); @@ -521,7 +521,7 @@ void SkGPipeCanvas::drawText(const void* text, size_t byteLength, SkScalar x, } } -void SkGPipeCanvas::drawPosText(const void* text, size_t byteLength, +void SkGPipeCanvas::drawPosText(const void* text, size_t byteLength, const SkPoint pos[], const SkPaint& paint) { if (byteLength) { NOTIFY_SETUP(this); @@ -555,8 +555,8 @@ void SkGPipeCanvas::drawPosTextH(const void* text, size_t byteLength, } } -void SkGPipeCanvas::drawTextOnPath(const void* text, size_t byteLength, - const SkPath& path, const SkMatrix* matrix, +void SkGPipeCanvas::drawTextOnPath(const void* text, size_t byteLength, + const SkPath& path, const SkMatrix* matrix, const SkPaint& paint) { if (byteLength) { NOTIFY_SETUP(this); @@ -611,7 +611,7 @@ void SkGPipeCanvas::drawVertices(VertexMode mode, int vertexCount, flags |= kDrawVertices_HasIndices_DrawOpFlag; size += 4 + SkAlign4(indexCount * sizeof(uint16_t)); } - + if (this->needOpBytes(size)) { this->writeOp(kDrawVertices_DrawOp, flags, 0); fWriter.write32(mode); diff --git a/src/utils/SkNWayCanvas.cpp b/src/utils/SkNWayCanvas.cpp index 24c992d..06cf32d 100644 --- a/src/utils/SkNWayCanvas.cpp +++ b/src/utils/SkNWayCanvas.cpp @@ -49,7 +49,7 @@ public: return false; } SkCanvas* operator->() { return fCanvas; } - + private: const SkTDArray& fList; int fIndex; -- 2.7.4