From: Mike Reed Date: Fri, 13 Jan 2017 22:43:16 +0000 (+0000) Subject: Revert "move SkDevice.h and SkBitmapDevice.h contents in to src headers" X-Git-Tag: accepted/tizen/5.0/unified/20181102.025319~55^2~821 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=986480a71f4e860663ced7ad90a1fe346a164afb;p=platform%2Fupstream%2FlibSkiaSharp.git Revert "move SkDevice.h and SkBitmapDevice.h contents in to src headers" This reverts commit 2f719a6b9214997e4cc24646d4b280038962b836. Reason for revert: swf/transform/jsrunner/swiffy_canvas.h caller included SkDevice.h, but really wanted SkBitmap and SkColor Original change's description: > move SkDevice.h and SkBitmapDevice.h contents in to src headers > > BUG=skia: > > Change-Id: I3d8d313f0500c13db21cb973fed4064ec3816912 > Reviewed-on: https://skia-review.googlesource.com/7082 > Reviewed-by: Florin Malita > Commit-Queue: Mike Reed > TBR=bungeman@google.com,fmalita@chromium.org,reed@google.com NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia: Change-Id: I40f7f1e4ad62685facdd39492da7a0b105178221 Reviewed-on: https://skia-review.googlesource.com/7087 Commit-Queue: Mike Reed Reviewed-by: Mike Reed --- diff --git a/gn/core.gni b/gn/core.gni index edad799..e5d72b3 100644 --- a/gn/core.gni +++ b/gn/core.gni @@ -23,7 +23,6 @@ skia_core_sources = [ "$_src/core/SkAutoKern.h", "$_src/core/SkAutoPixmapStorage.h", "$_src/core/SkAutoPixmapStorage.cpp", - "$_src/core/SkBaseDevice.h", "$_src/core/SkBBHFactory.cpp", "$_src/core/SkBBoxHierarchy.h", "$_src/core/SkBigPicture.cpp", @@ -255,7 +254,6 @@ skia_core_sources = [ "$_src/core/SkRadialShadowMapShader.cpp", "$_src/core/SkRadialShadowMapShader.h", "$_src/core/SkRasterClip.cpp", - "$_src/core/SkRasterDevice.h", "$_src/core/SkRasterPipeline.cpp", "$_src/core/SkRasterPipelineBlitter.cpp", "$_src/core/SkRasterizer.cpp", @@ -383,6 +381,7 @@ skia_core_sources = [ "$_include/core/SkBBHFactory.h", "$_include/core/SkBitmap.h", + "$_include/core/SkBitmapDevice.h", "$_include/core/SkCanvas.h", "$_include/core/SkClipStack.h", "$_include/core/SkColor.h", @@ -390,6 +389,7 @@ skia_core_sources = [ "$_include/core/SkColorPriv.h", "$_include/core/SkData.h", "$_include/core/SkDeque.h", + "$_include/core/SkDevice.h", "$_include/core/SkDrawable.h", "$_include/core/SkDrawFilter.h", "$_include/core/SkDrawLooper.h", diff --git a/include/core/SkBitmapDevice.h b/include/core/SkBitmapDevice.h index 930c5e9..776b6a0 100644 --- a/include/core/SkBitmapDevice.h +++ b/include/core/SkBitmapDevice.h @@ -1,3 +1,4 @@ + /* * Copyright 2013 Google Inc. * @@ -8,6 +9,178 @@ #ifndef SkBitmapDevice_DEFINED #define SkBitmapDevice_DEFINED -//#error +#include "SkBitmap.h" +#include "SkCanvas.h" +#include "SkColor.h" +#include "SkDevice.h" +#include "SkImageInfo.h" +#include "SkPixelRef.h" +#include "SkRect.h" +#include "SkScalar.h" +#include "SkSize.h" +#include "SkSurfaceProps.h" +#include "SkTypes.h" + +class SkDraw; +class SkImageFilterCache; +class SkMatrix; +class SkPaint; +class SkPath; +class SkPixelRef; +class SkPixmap; +class SkRasterHandleAllocator; +class SkRRect; +class SkSurface; +struct SkPoint; + +/////////////////////////////////////////////////////////////////////////////// +class SK_API SkBitmapDevice : public SkBaseDevice { +public: + /** + * Construct a new device with the specified bitmap as its backend. It is + * valid for the bitmap to have no pixels associated with it. In that case, + * any drawing to this device will have no effect. + */ + SkBitmapDevice(const SkBitmap& bitmap); + + /** + * Create a new device along with its requisite pixel memory using + * default SkSurfaceProps (i.e., kLegacyFontHost_InitType-style). + * Note: this entry point is slated for removal - no one should call it. + */ + static SkBitmapDevice* Create(const SkImageInfo& info); + + /** + * Construct a new device with the specified bitmap as its backend. It is + * valid for the bitmap to have no pixels associated with it. In that case, + * any drawing to this device will have no effect. + */ + SkBitmapDevice(const SkBitmap& bitmap, const SkSurfaceProps& surfaceProps, + void* externalHandle = nullptr); + + static SkBitmapDevice* Create(const SkImageInfo&, const SkSurfaceProps&, + SkRasterHandleAllocator* = nullptr); + +protected: + bool onShouldDisableLCD(const SkPaint&) const override; + void* getRasterHandle() const override { return fRasterHandle; } + + /** These are called inside the per-device-layer loop for each draw call. + When these are called, we have already applied any saveLayer operations, + and are handling any looping from the paint, and any effects from the + DrawFilter. + */ + void drawPaint(const SkDraw&, const SkPaint& paint) override; + virtual void drawPoints(const SkDraw&, SkCanvas::PointMode mode, size_t count, + const SkPoint[], const SkPaint& paint) override; + virtual void drawRect(const SkDraw&, const SkRect& r, + const SkPaint& paint) override; + virtual void drawOval(const SkDraw&, const SkRect& oval, + const SkPaint& paint) override; + virtual void drawRRect(const SkDraw&, const SkRRect& rr, + const SkPaint& paint) override; + + /** + * If pathIsMutable, then the implementation is allowed to cast path to a + * non-const pointer and modify it in place (as an optimization). Canvas + * may do this to implement helpers such as drawOval, by placing a temp + * path on the stack to hold the representation of the oval. + * + * If prePathMatrix is not null, it should logically be applied before any + * stroking or other effects. If there are no effects on the paint that + * affect the geometry/rasterization, then the pre matrix can just be + * pre-concated with the current matrix. + */ + virtual void drawPath(const SkDraw&, const SkPath& path, + const SkPaint& paint, + const SkMatrix* prePathMatrix = NULL, + bool pathIsMutable = false) override; + virtual void drawBitmap(const SkDraw&, const SkBitmap& bitmap, + const SkMatrix& matrix, const SkPaint& paint) override; + virtual void drawSprite(const SkDraw&, const SkBitmap& bitmap, + int x, int y, const SkPaint& paint) override; + + /** + * The default impl. will create a bitmap-shader from the bitmap, + * and call drawRect with it. + */ + void drawBitmapRect(const SkDraw&, const SkBitmap&, const SkRect*, const SkRect&, + const SkPaint&, SkCanvas::SrcRectConstraint) override; + + /** + * Does not handle text decoration. + * Decorations (underline and stike-thru) will be handled by SkCanvas. + */ + virtual void drawText(const SkDraw&, const void* text, size_t len, + SkScalar x, SkScalar y, const SkPaint& paint) override; + virtual void drawPosText(const SkDraw&, const void* text, size_t len, + const SkScalar pos[], int scalarsPerPos, + const SkPoint& offset, const SkPaint& paint) override; + virtual 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; + virtual void drawDevice(const SkDraw&, SkBaseDevice*, int x, int y, const SkPaint&) override; + + /////////////////////////////////////////////////////////////////////////// + + void drawSpecial(const SkDraw&, SkSpecialImage*, int x, int y, const SkPaint&) override; + sk_sp makeSpecial(const SkBitmap&) override; + sk_sp makeSpecial(const SkImage*) override; + sk_sp snapSpecial() override; + + /////////////////////////////////////////////////////////////////////////// + + /** Update as needed the pixel value in the bitmap, so that the caller can + access the pixels directly. Note: only the pixels field should be + altered. The config/width/height/rowbytes must remain unchanged. + @return the device contents as a bitmap + */ +#ifdef SK_SUPPORT_LEGACY_ACCESSBITMAP + const SkBitmap& onAccessBitmap() override; +#else + const SkBitmap& onAccessBitmap(); +#endif + + SkPixelRef* getPixelRef() const { return fBitmap.pixelRef(); } + // just for subclasses, to assign a custom pixelref + void setPixelRef(sk_sp pr) { fBitmap.setPixelRef(std::move(pr), 0, 0); } +#ifdef SK_SUPPORT_LEGACY_BITMAP_SETPIXELREF + SkPixelRef* setPixelRef(SkPixelRef* pr) { return fBitmap.setPixelRef(pr); } +#endif + + bool onReadPixels(const SkImageInfo&, void*, size_t, int x, int y) override; + bool onWritePixels(const SkImageInfo&, const void*, size_t, int, int) override; + bool onPeekPixels(SkPixmap*) override; + bool onAccessPixels(SkPixmap*) override; + +private: + friend class SkCanvas; + friend struct DeviceCM; //for setMatrixClip + friend class SkDraw; + friend class SkDrawIter; + friend class SkDeviceFilteredPaint; + + friend class SkSurface_Raster; + + // used to change the backend's pixels (and possibly config/rowbytes) + // but cannot change the width/height, so there should be no change to + // any clip information. + void replaceBitmapBackendForRasterSurface(const SkBitmap&) override; + + SkBaseDevice* onCreateDevice(const CreateInfo&, const SkPaint*) override; + + sk_sp makeSurface(const SkImageInfo&, const SkSurfaceProps&) override; + + SkImageFilterCache* getImageFilterCache() override; + + SkBitmap fBitmap; + void* fRasterHandle = nullptr; + + void setNewSize(const SkISize&); // Used by SkCanvas for resetForNextPicture(). + + typedef SkBaseDevice INHERITED; +}; #endif // SkBitmapDevice_DEFINED diff --git a/include/core/SkDevice.h b/include/core/SkDevice.h index 6d47db6..fa427c6 100644 --- a/include/core/SkDevice.h +++ b/include/core/SkDevice.h @@ -8,6 +8,376 @@ #ifndef SkDevice_DEFINED #define SkDevice_DEFINED -//#error +#include "SkRefCnt.h" +#include "SkCanvas.h" +#include "SkColor.h" +#include "SkSurfaceProps.h" + +class SkBitmap; +class SkClipStack; +class SkDraw; +class SkDrawFilter; +class SkImageFilterCache; +struct SkIRect; +class SkMatrix; +class SkMetaData; +class SkRasterHandleAllocator; +class SkRegion; +class SkSpecialImage; +class GrRenderTarget; + +class SK_API SkBaseDevice : public SkRefCnt { +public: + /** + * Construct a new device. + */ + explicit SkBaseDevice(const SkImageInfo&, const SkSurfaceProps&); + virtual ~SkBaseDevice(); + + SkMetaData& getMetaData(); + + /** + * Return ImageInfo for this device. If the canvas is not backed by pixels + * (cpu or gpu), then the info's ColorType will be kUnknown_SkColorType. + */ + const SkImageInfo& imageInfo() const { return fInfo; } + + /** + * Return SurfaceProps for this device. + */ + const SkSurfaceProps& surfaceProps() const { + return fSurfaceProps; + } + + /** + * Return the bounds of the device in the coordinate space of the root + * canvas. The root device will have its top-left at 0,0, but other devices + * such as those associated with saveLayer may have a non-zero origin. + */ + void getGlobalBounds(SkIRect* bounds) const { + SkASSERT(bounds); + const SkIPoint& origin = this->getOrigin(); + bounds->setXYWH(origin.x(), origin.y(), this->width(), this->height()); + } + + SkIRect getGlobalBounds() const { + SkIRect bounds; + this->getGlobalBounds(&bounds); + return bounds; + } + + int width() const { + return this->imageInfo().width(); + } + + int height() const { + return this->imageInfo().height(); + } + + bool isOpaque() const { + return this->imageInfo().isOpaque(); + } + +#ifdef SK_SUPPORT_LEGACY_ACCESSBITMAP + /** Return the bitmap associated with this device. Call this each time you need + to access the bitmap, as it notifies the subclass to perform any flushing + etc. before you examine the pixels. + @param changePixels set to true if the caller plans to change the pixels + @return the device's bitmap + */ + const SkBitmap& accessBitmap(bool changePixels); +#endif + + bool writePixels(const SkImageInfo&, const void*, size_t rowBytes, int x, int y); + + /** + * Try to get write-access to the pixels behind the device. If successful, this returns true + * and fills-out the pixmap parameter. On success it also bumps the genID of the underlying + * bitmap. + * + * On failure, returns false and ignores the pixmap parameter. + */ + bool accessPixels(SkPixmap* pmap); + + /** + * Try to get read-only-access to the pixels behind the device. If successful, this returns + * true and fills-out the pixmap parameter. + * + * On failure, returns false and ignores the pixmap parameter. + */ + bool peekPixels(SkPixmap*); + + /** + * Return the device's origin: its offset in device coordinates from + * the default origin in its canvas' matrix/clip + */ + const SkIPoint& getOrigin() const { return fOrigin; } + + virtual void* getRasterHandle() const { return nullptr; } + +protected: + enum TileUsage { + kPossible_TileUsage, //!< the created device may be drawn tiled + kNever_TileUsage, //!< the created device will never be drawn tiled + }; + + struct TextFlags { + uint32_t fFlags; // SkPaint::getFlags() + }; + + /** + * Returns the text-related flags, possibly modified based on the state of the + * device (e.g. support for LCD). + */ + uint32_t filterTextFlags(const SkPaint&) const; + + virtual bool onShouldDisableLCD(const SkPaint&) const { return false; } + + /** These are called inside the per-device-layer loop for each draw call. + When these are called, we have already applied any saveLayer operations, + and are handling any looping from the paint, and any effects from the + DrawFilter. + */ + virtual void drawPaint(const SkDraw&, const SkPaint& paint) = 0; + virtual void drawPoints(const SkDraw&, SkCanvas::PointMode mode, size_t count, + const SkPoint[], const SkPaint& paint) = 0; + virtual void drawRect(const SkDraw&, const SkRect& r, + const SkPaint& paint) = 0; + virtual void drawRegion(const SkDraw&, const SkRegion& r, + const SkPaint& paint); + virtual void drawOval(const SkDraw&, const SkRect& oval, + const SkPaint& paint) = 0; + /** By the time this is called we know that abs(sweepAngle) is in the range [0, 360). */ + virtual void drawArc(const SkDraw&, const SkRect& oval, SkScalar startAngle, + SkScalar sweepAngle, bool useCenter, const SkPaint& paint); + virtual void drawRRect(const SkDraw&, const SkRRect& rr, + const SkPaint& paint) = 0; + + // Default impl calls drawPath() + virtual void drawDRRect(const SkDraw&, const SkRRect& outer, + const SkRRect& inner, const SkPaint&); + + /** + * If pathIsMutable, then the implementation is allowed to cast path to a + * non-const pointer and modify it in place (as an optimization). Canvas + * may do this to implement helpers such as drawOval, by placing a temp + * path on the stack to hold the representation of the oval. + * + * If prePathMatrix is not null, it should logically be applied before any + * stroking or other effects. If there are no effects on the paint that + * affect the geometry/rasterization, then the pre matrix can just be + * pre-concated with the current matrix. + */ + virtual void drawPath(const SkDraw&, const SkPath& path, + const SkPaint& paint, + const SkMatrix* prePathMatrix = NULL, + bool pathIsMutable = false) = 0; + virtual void drawBitmap(const SkDraw&, const SkBitmap& bitmap, + const SkMatrix& matrix, const SkPaint& paint) = 0; + virtual void drawSprite(const SkDraw&, const SkBitmap& bitmap, + int x, int y, const SkPaint& paint) = 0; + + /** + * The default impl. will create a bitmap-shader from the bitmap, + * and call drawRect with it. + */ + virtual void drawBitmapRect(const SkDraw&, const SkBitmap&, + const SkRect* srcOrNull, const SkRect& dst, + const SkPaint& paint, + SkCanvas::SrcRectConstraint) = 0; + virtual void drawBitmapNine(const SkDraw&, const SkBitmap&, const SkIRect& center, + const SkRect& dst, const SkPaint&); + virtual void drawBitmapLattice(const SkDraw&, const SkBitmap&, const SkCanvas::Lattice&, + const SkRect& dst, const SkPaint&); + + virtual void drawImage(const SkDraw&, const SkImage*, SkScalar x, SkScalar y, const SkPaint&); + virtual void drawImageRect(const SkDraw&, const SkImage*, const SkRect* src, const SkRect& dst, + const SkPaint&, SkCanvas::SrcRectConstraint); + virtual void drawImageNine(const SkDraw&, const SkImage*, const SkIRect& center, + const SkRect& dst, const SkPaint&); + virtual void drawImageLattice(const SkDraw&, const SkImage*, const SkCanvas::Lattice&, + const SkRect& dst, const SkPaint&); + + /** + * Does not handle text decoration. + * Decorations (underline and stike-thru) will be handled by SkCanvas. + */ + virtual void drawText(const SkDraw&, const void* text, size_t len, + SkScalar x, SkScalar y, const SkPaint& paint) = 0; + virtual void drawPosText(const SkDraw&, const void* text, size_t len, + const SkScalar pos[], int scalarsPerPos, + const SkPoint& offset, const SkPaint& paint) = 0; + virtual 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) = 0; + // default implementation unrolls the blob runs. + virtual void drawTextBlob(const SkDraw&, const SkTextBlob*, SkScalar x, SkScalar y, + const SkPaint& paint, SkDrawFilter* drawFilter); + // default implementation calls drawVertices + virtual void drawPatch(const SkDraw&, const SkPoint cubics[12], const SkColor colors[4], + const SkPoint texCoords[4], SkBlendMode, const SkPaint& paint); + + // default implementation calls drawPath + virtual void drawAtlas(const SkDraw&, const SkImage* atlas, const SkRSXform[], const SkRect[], + const SkColor[], int count, SkBlendMode, const SkPaint&); + + virtual void drawAnnotation(const SkDraw&, const SkRect&, const char[], SkData*) {} + + /** The SkDevice passed will be an SkDevice which was returned by a call to + onCreateDevice on this device with kNeverTile_TileExpectation. + */ + virtual void drawDevice(const SkDraw&, SkBaseDevice*, int x, int y, + const SkPaint&) = 0; + + virtual void drawTextOnPath(const SkDraw&, const void* text, size_t len, const SkPath&, + const SkMatrix*, const SkPaint&); + virtual void drawTextRSXform(const SkDraw&, const void* text, size_t len, const SkRSXform[], + const SkPaint&); + + virtual void drawSpecial(const SkDraw&, SkSpecialImage*, int x, int y, const SkPaint&); + virtual sk_sp makeSpecial(const SkBitmap&); + virtual sk_sp makeSpecial(const SkImage*); + virtual sk_sp snapSpecial(); + + bool readPixels(const SkImageInfo&, void* dst, size_t rowBytes, int x, int y); + + /////////////////////////////////////////////////////////////////////////// + +#ifdef SK_SUPPORT_LEGACY_ACCESSBITMAP + /** Update as needed the pixel value in the bitmap, so that the caller can + access the pixels directly. + @return The device contents as a bitmap + */ + virtual const SkBitmap& onAccessBitmap() { + SkASSERT(0); + return fLegacyBitmap; + } +#endif + + virtual GrContext* context() const { return nullptr; } + + virtual sk_sp makeSurface(const SkImageInfo&, const SkSurfaceProps&); + virtual bool onPeekPixels(SkPixmap*) { return false; } + + /** + * The caller is responsible for "pre-clipping" the dst. The impl can assume that the dst + * image at the specified x,y offset will fit within the device's bounds. + * + * This is explicitly asserted in readPixels(), the public way to call this. + */ + virtual bool onReadPixels(const SkImageInfo&, void*, size_t, int x, int y); + + /** + * The caller is responsible for "pre-clipping" the src. The impl can assume that the src + * image at the specified x,y offset will fit within the device's bounds. + * + * This is explicitly asserted in writePixelsDirect(), the public way to call this. + */ + virtual bool onWritePixels(const SkImageInfo&, const void*, size_t, int x, int y); + + virtual bool onAccessPixels(SkPixmap*) { return false; } + + struct CreateInfo { + static SkPixelGeometry AdjustGeometry(const SkImageInfo&, TileUsage, SkPixelGeometry, + bool preserveLCDText); + + // The constructor may change the pixel geometry based on other parameters. + CreateInfo(const SkImageInfo& info, + TileUsage tileUsage, + SkPixelGeometry geo) + : fInfo(info) + , fTileUsage(tileUsage) + , fPixelGeometry(AdjustGeometry(info, tileUsage, geo, false)) + {} + + CreateInfo(const SkImageInfo& info, + TileUsage tileUsage, + SkPixelGeometry geo, + bool preserveLCDText, + SkRasterHandleAllocator* allocator) + : fInfo(info) + , fTileUsage(tileUsage) + , fPixelGeometry(AdjustGeometry(info, tileUsage, geo, preserveLCDText)) + , fAllocator(allocator) + {} + + const SkImageInfo fInfo; + const TileUsage fTileUsage; + const SkPixelGeometry fPixelGeometry; + SkRasterHandleAllocator* fAllocator = nullptr; + }; + + /** + * Create a new device based on CreateInfo. If the paint is not null, then it represents a + * preview of how the new device will be composed with its creator device (this). + * + * The subclass may be handed this device in drawDevice(), so it must always return + * a device that it knows how to draw, and that it knows how to identify if it is not of the + * same subclass (since drawDevice is passed a SkBaseDevice*). If the subclass cannot fulfill + * that contract (e.g. PDF cannot support some settings on the paint) it should return NULL, + * and the caller may then decide to explicitly create a bitmapdevice, knowing that later + * it could not call drawDevice with it (but it could call drawSprite or drawBitmap). + */ + virtual SkBaseDevice* onCreateDevice(const CreateInfo&, const SkPaint*) { + return NULL; + } + + // A helper function used by derived classes to log the scale factor of a bitmap or image draw. + static void LogDrawScaleFactor(const SkMatrix&, SkFilterQuality); + +private: + friend class SkCanvas; + friend struct DeviceCM; //for setMatrixClip + friend class SkDraw; + friend class SkDrawIter; + friend class SkDeviceFilteredPaint; + friend class SkNoPixelsBitmapDevice; + friend class SkSurface_Raster; + friend class DeviceTestingAccess; + + // used to change the backend's pixels (and possibly config/rowbytes) + // but cannot change the width/height, so there should be no change to + // any clip information. + // TODO: move to SkBitmapDevice + virtual void replaceBitmapBackendForRasterSurface(const SkBitmap&) {} + + virtual bool forceConservativeRasterClip() const { return false; } + + /** + * Don't call this! + */ + virtual GrRenderTargetContext* accessRenderTargetContext() { return nullptr; } + + // just called by SkCanvas when built as a layer + void setOrigin(int x, int y) { fOrigin.set(x, y); } + + /** Causes any deferred drawing to the device to be completed. + */ + virtual void flush() {} + + virtual SkImageFilterCache* getImageFilterCache() { return NULL; } + + friend class SkBitmapDevice; + void privateResize(int w, int h) { + *const_cast(&fInfo) = fInfo.makeWH(w, h); + } + + bool drawExternallyScaledImage(const SkDraw& draw, const SkImage* image, const SkRect* src, + const SkRect& dst, const SkPaint& paint, + SkCanvas::SrcRectConstraint constraint); + + SkIPoint fOrigin; + SkMetaData* fMetaData; + const SkImageInfo fInfo; + const SkSurfaceProps fSurfaceProps; + +#ifdef SK_SUPPORT_LEGACY_ACCESSBITMAP + SkBitmap fLegacyBitmap; +#endif + + typedef SkRefCnt INHERITED; +}; #endif diff --git a/src/core/SkBaseDevice.h b/src/core/SkBaseDevice.h deleted file mode 100644 index fa427c6..0000000 --- a/src/core/SkBaseDevice.h +++ /dev/null @@ -1,383 +0,0 @@ -/* - * Copyright 2010 The Android Open Source Project - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkDevice_DEFINED -#define SkDevice_DEFINED - -#include "SkRefCnt.h" -#include "SkCanvas.h" -#include "SkColor.h" -#include "SkSurfaceProps.h" - -class SkBitmap; -class SkClipStack; -class SkDraw; -class SkDrawFilter; -class SkImageFilterCache; -struct SkIRect; -class SkMatrix; -class SkMetaData; -class SkRasterHandleAllocator; -class SkRegion; -class SkSpecialImage; -class GrRenderTarget; - -class SK_API SkBaseDevice : public SkRefCnt { -public: - /** - * Construct a new device. - */ - explicit SkBaseDevice(const SkImageInfo&, const SkSurfaceProps&); - virtual ~SkBaseDevice(); - - SkMetaData& getMetaData(); - - /** - * Return ImageInfo for this device. If the canvas is not backed by pixels - * (cpu or gpu), then the info's ColorType will be kUnknown_SkColorType. - */ - const SkImageInfo& imageInfo() const { return fInfo; } - - /** - * Return SurfaceProps for this device. - */ - const SkSurfaceProps& surfaceProps() const { - return fSurfaceProps; - } - - /** - * Return the bounds of the device in the coordinate space of the root - * canvas. The root device will have its top-left at 0,0, but other devices - * such as those associated with saveLayer may have a non-zero origin. - */ - void getGlobalBounds(SkIRect* bounds) const { - SkASSERT(bounds); - const SkIPoint& origin = this->getOrigin(); - bounds->setXYWH(origin.x(), origin.y(), this->width(), this->height()); - } - - SkIRect getGlobalBounds() const { - SkIRect bounds; - this->getGlobalBounds(&bounds); - return bounds; - } - - int width() const { - return this->imageInfo().width(); - } - - int height() const { - return this->imageInfo().height(); - } - - bool isOpaque() const { - return this->imageInfo().isOpaque(); - } - -#ifdef SK_SUPPORT_LEGACY_ACCESSBITMAP - /** Return the bitmap associated with this device. Call this each time you need - to access the bitmap, as it notifies the subclass to perform any flushing - etc. before you examine the pixels. - @param changePixels set to true if the caller plans to change the pixels - @return the device's bitmap - */ - const SkBitmap& accessBitmap(bool changePixels); -#endif - - bool writePixels(const SkImageInfo&, const void*, size_t rowBytes, int x, int y); - - /** - * Try to get write-access to the pixels behind the device. If successful, this returns true - * and fills-out the pixmap parameter. On success it also bumps the genID of the underlying - * bitmap. - * - * On failure, returns false and ignores the pixmap parameter. - */ - bool accessPixels(SkPixmap* pmap); - - /** - * Try to get read-only-access to the pixels behind the device. If successful, this returns - * true and fills-out the pixmap parameter. - * - * On failure, returns false and ignores the pixmap parameter. - */ - bool peekPixels(SkPixmap*); - - /** - * Return the device's origin: its offset in device coordinates from - * the default origin in its canvas' matrix/clip - */ - const SkIPoint& getOrigin() const { return fOrigin; } - - virtual void* getRasterHandle() const { return nullptr; } - -protected: - enum TileUsage { - kPossible_TileUsage, //!< the created device may be drawn tiled - kNever_TileUsage, //!< the created device will never be drawn tiled - }; - - struct TextFlags { - uint32_t fFlags; // SkPaint::getFlags() - }; - - /** - * Returns the text-related flags, possibly modified based on the state of the - * device (e.g. support for LCD). - */ - uint32_t filterTextFlags(const SkPaint&) const; - - virtual bool onShouldDisableLCD(const SkPaint&) const { return false; } - - /** These are called inside the per-device-layer loop for each draw call. - When these are called, we have already applied any saveLayer operations, - and are handling any looping from the paint, and any effects from the - DrawFilter. - */ - virtual void drawPaint(const SkDraw&, const SkPaint& paint) = 0; - virtual void drawPoints(const SkDraw&, SkCanvas::PointMode mode, size_t count, - const SkPoint[], const SkPaint& paint) = 0; - virtual void drawRect(const SkDraw&, const SkRect& r, - const SkPaint& paint) = 0; - virtual void drawRegion(const SkDraw&, const SkRegion& r, - const SkPaint& paint); - virtual void drawOval(const SkDraw&, const SkRect& oval, - const SkPaint& paint) = 0; - /** By the time this is called we know that abs(sweepAngle) is in the range [0, 360). */ - virtual void drawArc(const SkDraw&, const SkRect& oval, SkScalar startAngle, - SkScalar sweepAngle, bool useCenter, const SkPaint& paint); - virtual void drawRRect(const SkDraw&, const SkRRect& rr, - const SkPaint& paint) = 0; - - // Default impl calls drawPath() - virtual void drawDRRect(const SkDraw&, const SkRRect& outer, - const SkRRect& inner, const SkPaint&); - - /** - * If pathIsMutable, then the implementation is allowed to cast path to a - * non-const pointer and modify it in place (as an optimization). Canvas - * may do this to implement helpers such as drawOval, by placing a temp - * path on the stack to hold the representation of the oval. - * - * If prePathMatrix is not null, it should logically be applied before any - * stroking or other effects. If there are no effects on the paint that - * affect the geometry/rasterization, then the pre matrix can just be - * pre-concated with the current matrix. - */ - virtual void drawPath(const SkDraw&, const SkPath& path, - const SkPaint& paint, - const SkMatrix* prePathMatrix = NULL, - bool pathIsMutable = false) = 0; - virtual void drawBitmap(const SkDraw&, const SkBitmap& bitmap, - const SkMatrix& matrix, const SkPaint& paint) = 0; - virtual void drawSprite(const SkDraw&, const SkBitmap& bitmap, - int x, int y, const SkPaint& paint) = 0; - - /** - * The default impl. will create a bitmap-shader from the bitmap, - * and call drawRect with it. - */ - virtual void drawBitmapRect(const SkDraw&, const SkBitmap&, - const SkRect* srcOrNull, const SkRect& dst, - const SkPaint& paint, - SkCanvas::SrcRectConstraint) = 0; - virtual void drawBitmapNine(const SkDraw&, const SkBitmap&, const SkIRect& center, - const SkRect& dst, const SkPaint&); - virtual void drawBitmapLattice(const SkDraw&, const SkBitmap&, const SkCanvas::Lattice&, - const SkRect& dst, const SkPaint&); - - virtual void drawImage(const SkDraw&, const SkImage*, SkScalar x, SkScalar y, const SkPaint&); - virtual void drawImageRect(const SkDraw&, const SkImage*, const SkRect* src, const SkRect& dst, - const SkPaint&, SkCanvas::SrcRectConstraint); - virtual void drawImageNine(const SkDraw&, const SkImage*, const SkIRect& center, - const SkRect& dst, const SkPaint&); - virtual void drawImageLattice(const SkDraw&, const SkImage*, const SkCanvas::Lattice&, - const SkRect& dst, const SkPaint&); - - /** - * Does not handle text decoration. - * Decorations (underline and stike-thru) will be handled by SkCanvas. - */ - virtual void drawText(const SkDraw&, const void* text, size_t len, - SkScalar x, SkScalar y, const SkPaint& paint) = 0; - virtual void drawPosText(const SkDraw&, const void* text, size_t len, - const SkScalar pos[], int scalarsPerPos, - const SkPoint& offset, const SkPaint& paint) = 0; - virtual 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) = 0; - // default implementation unrolls the blob runs. - virtual void drawTextBlob(const SkDraw&, const SkTextBlob*, SkScalar x, SkScalar y, - const SkPaint& paint, SkDrawFilter* drawFilter); - // default implementation calls drawVertices - virtual void drawPatch(const SkDraw&, const SkPoint cubics[12], const SkColor colors[4], - const SkPoint texCoords[4], SkBlendMode, const SkPaint& paint); - - // default implementation calls drawPath - virtual void drawAtlas(const SkDraw&, const SkImage* atlas, const SkRSXform[], const SkRect[], - const SkColor[], int count, SkBlendMode, const SkPaint&); - - virtual void drawAnnotation(const SkDraw&, const SkRect&, const char[], SkData*) {} - - /** The SkDevice passed will be an SkDevice which was returned by a call to - onCreateDevice on this device with kNeverTile_TileExpectation. - */ - virtual void drawDevice(const SkDraw&, SkBaseDevice*, int x, int y, - const SkPaint&) = 0; - - virtual void drawTextOnPath(const SkDraw&, const void* text, size_t len, const SkPath&, - const SkMatrix*, const SkPaint&); - virtual void drawTextRSXform(const SkDraw&, const void* text, size_t len, const SkRSXform[], - const SkPaint&); - - virtual void drawSpecial(const SkDraw&, SkSpecialImage*, int x, int y, const SkPaint&); - virtual sk_sp makeSpecial(const SkBitmap&); - virtual sk_sp makeSpecial(const SkImage*); - virtual sk_sp snapSpecial(); - - bool readPixels(const SkImageInfo&, void* dst, size_t rowBytes, int x, int y); - - /////////////////////////////////////////////////////////////////////////// - -#ifdef SK_SUPPORT_LEGACY_ACCESSBITMAP - /** Update as needed the pixel value in the bitmap, so that the caller can - access the pixels directly. - @return The device contents as a bitmap - */ - virtual const SkBitmap& onAccessBitmap() { - SkASSERT(0); - return fLegacyBitmap; - } -#endif - - virtual GrContext* context() const { return nullptr; } - - virtual sk_sp makeSurface(const SkImageInfo&, const SkSurfaceProps&); - virtual bool onPeekPixels(SkPixmap*) { return false; } - - /** - * The caller is responsible for "pre-clipping" the dst. The impl can assume that the dst - * image at the specified x,y offset will fit within the device's bounds. - * - * This is explicitly asserted in readPixels(), the public way to call this. - */ - virtual bool onReadPixels(const SkImageInfo&, void*, size_t, int x, int y); - - /** - * The caller is responsible for "pre-clipping" the src. The impl can assume that the src - * image at the specified x,y offset will fit within the device's bounds. - * - * This is explicitly asserted in writePixelsDirect(), the public way to call this. - */ - virtual bool onWritePixels(const SkImageInfo&, const void*, size_t, int x, int y); - - virtual bool onAccessPixels(SkPixmap*) { return false; } - - struct CreateInfo { - static SkPixelGeometry AdjustGeometry(const SkImageInfo&, TileUsage, SkPixelGeometry, - bool preserveLCDText); - - // The constructor may change the pixel geometry based on other parameters. - CreateInfo(const SkImageInfo& info, - TileUsage tileUsage, - SkPixelGeometry geo) - : fInfo(info) - , fTileUsage(tileUsage) - , fPixelGeometry(AdjustGeometry(info, tileUsage, geo, false)) - {} - - CreateInfo(const SkImageInfo& info, - TileUsage tileUsage, - SkPixelGeometry geo, - bool preserveLCDText, - SkRasterHandleAllocator* allocator) - : fInfo(info) - , fTileUsage(tileUsage) - , fPixelGeometry(AdjustGeometry(info, tileUsage, geo, preserveLCDText)) - , fAllocator(allocator) - {} - - const SkImageInfo fInfo; - const TileUsage fTileUsage; - const SkPixelGeometry fPixelGeometry; - SkRasterHandleAllocator* fAllocator = nullptr; - }; - - /** - * Create a new device based on CreateInfo. If the paint is not null, then it represents a - * preview of how the new device will be composed with its creator device (this). - * - * The subclass may be handed this device in drawDevice(), so it must always return - * a device that it knows how to draw, and that it knows how to identify if it is not of the - * same subclass (since drawDevice is passed a SkBaseDevice*). If the subclass cannot fulfill - * that contract (e.g. PDF cannot support some settings on the paint) it should return NULL, - * and the caller may then decide to explicitly create a bitmapdevice, knowing that later - * it could not call drawDevice with it (but it could call drawSprite or drawBitmap). - */ - virtual SkBaseDevice* onCreateDevice(const CreateInfo&, const SkPaint*) { - return NULL; - } - - // A helper function used by derived classes to log the scale factor of a bitmap or image draw. - static void LogDrawScaleFactor(const SkMatrix&, SkFilterQuality); - -private: - friend class SkCanvas; - friend struct DeviceCM; //for setMatrixClip - friend class SkDraw; - friend class SkDrawIter; - friend class SkDeviceFilteredPaint; - friend class SkNoPixelsBitmapDevice; - friend class SkSurface_Raster; - friend class DeviceTestingAccess; - - // used to change the backend's pixels (and possibly config/rowbytes) - // but cannot change the width/height, so there should be no change to - // any clip information. - // TODO: move to SkBitmapDevice - virtual void replaceBitmapBackendForRasterSurface(const SkBitmap&) {} - - virtual bool forceConservativeRasterClip() const { return false; } - - /** - * Don't call this! - */ - virtual GrRenderTargetContext* accessRenderTargetContext() { return nullptr; } - - // just called by SkCanvas when built as a layer - void setOrigin(int x, int y) { fOrigin.set(x, y); } - - /** Causes any deferred drawing to the device to be completed. - */ - virtual void flush() {} - - virtual SkImageFilterCache* getImageFilterCache() { return NULL; } - - friend class SkBitmapDevice; - void privateResize(int w, int h) { - *const_cast(&fInfo) = fInfo.makeWH(w, h); - } - - bool drawExternallyScaledImage(const SkDraw& draw, const SkImage* image, const SkRect* src, - const SkRect& dst, const SkPaint& paint, - SkCanvas::SrcRectConstraint constraint); - - SkIPoint fOrigin; - SkMetaData* fMetaData; - const SkImageInfo fInfo; - const SkSurfaceProps fSurfaceProps; - -#ifdef SK_SUPPORT_LEGACY_ACCESSBITMAP - SkBitmap fLegacyBitmap; -#endif - - typedef SkRefCnt INHERITED; -}; - -#endif diff --git a/src/core/SkBitmapDevice.cpp b/src/core/SkBitmapDevice.cpp index ffaf3cf..6d63ecf 100644 --- a/src/core/SkBitmapDevice.cpp +++ b/src/core/SkBitmapDevice.cpp @@ -5,6 +5,7 @@ * found in the LICENSE file. */ +#include "SkBitmapDevice.h" #include "SkConfig8888.h" #include "SkDraw.h" #include "SkImageFilter.h" @@ -16,7 +17,6 @@ #include "SkPixelRef.h" #include "SkPixmap.h" #include "SkRasterClip.h" -#include "SkRasterDevice.h" #include "SkRasterHandleAllocator.h" #include "SkShader.h" #include "SkSpecialImage.h" diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp index 3d3d45f..e3374dd 100644 --- a/src/core/SkCanvas.cpp +++ b/src/core/SkCanvas.cpp @@ -5,6 +5,7 @@ * found in the LICENSE file. */ +#include "SkBitmapDevice.h" #include "SkCanvas.h" #include "SkCanvasPriv.h" #include "SkClipStack.h" @@ -28,7 +29,6 @@ #include "SkPicture.h" #include "SkRadialShadowMapShader.h" #include "SkRasterClip.h" -#include "SkRasterDevice.h" #include "SkRasterHandleAllocator.h" #include "SkReadPixelsRec.h" #include "SkRRect.h" diff --git a/src/core/SkDevice.cpp b/src/core/SkDevice.cpp index 72b69d7..ff99a09 100644 --- a/src/core/SkDevice.cpp +++ b/src/core/SkDevice.cpp @@ -5,8 +5,8 @@ * found in the LICENSE file. */ -#include "SkBaseDevice.h" #include "SkColorFilter.h" +#include "SkDevice.h" #include "SkDraw.h" #include "SkDrawFilter.h" #include "SkImage_Base.h" diff --git a/src/core/SkDraw.cpp b/src/core/SkDraw.cpp index 5e701dc..f9f9a28 100644 --- a/src/core/SkDraw.cpp +++ b/src/core/SkDraw.cpp @@ -7,11 +7,11 @@ #define __STDC_LIMIT_MACROS #include "SkDraw.h" -#include "SkBaseDevice.h" #include "SkBlendModePriv.h" #include "SkBlitter.h" #include "SkCanvas.h" #include "SkColorPriv.h" +#include "SkDevice.h" #include "SkDeviceLooper.h" #include "SkFindAndPlaceGlyph.h" #include "SkFixed.h" diff --git a/src/core/SkRasterDevice.h b/src/core/SkRasterDevice.h deleted file mode 100644 index f6ee6ad..0000000 --- a/src/core/SkRasterDevice.h +++ /dev/null @@ -1,185 +0,0 @@ -/* - * Copyright 2013 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkBitmapDevice_DEFINED -#define SkBitmapDevice_DEFINED - -#include "SkBaseDevice.h" -#include "SkBitmap.h" -#include "SkCanvas.h" -#include "SkColor.h" -#include "SkImageInfo.h" -#include "SkPixelRef.h" -#include "SkRect.h" -#include "SkScalar.h" -#include "SkSize.h" -#include "SkSurfaceProps.h" -#include "SkTypes.h" - -class SkDraw; -class SkImageFilterCache; -class SkMatrix; -class SkPaint; -class SkPath; -class SkPixelRef; -class SkPixmap; -class SkRasterHandleAllocator; -class SkRRect; -class SkSurface; -struct SkPoint; - -/////////////////////////////////////////////////////////////////////////////// -class SK_API SkBitmapDevice : public SkBaseDevice { -public: - /** - * Construct a new device with the specified bitmap as its backend. It is - * valid for the bitmap to have no pixels associated with it. In that case, - * any drawing to this device will have no effect. - */ - SkBitmapDevice(const SkBitmap& bitmap); - - /** - * Create a new device along with its requisite pixel memory using - * default SkSurfaceProps (i.e., kLegacyFontHost_InitType-style). - * Note: this entry point is slated for removal - no one should call it. - */ - static SkBitmapDevice* Create(const SkImageInfo& info); - - /** - * Construct a new device with the specified bitmap as its backend. It is - * valid for the bitmap to have no pixels associated with it. In that case, - * any drawing to this device will have no effect. - */ - SkBitmapDevice(const SkBitmap& bitmap, const SkSurfaceProps& surfaceProps, - void* externalHandle = nullptr); - - static SkBitmapDevice* Create(const SkImageInfo&, const SkSurfaceProps&, - SkRasterHandleAllocator* = nullptr); - -protected: - bool onShouldDisableLCD(const SkPaint&) const override; - void* getRasterHandle() const override { return fRasterHandle; } - - /** These are called inside the per-device-layer loop for each draw call. - When these are called, we have already applied any saveLayer operations, - and are handling any looping from the paint, and any effects from the - DrawFilter. - */ - void drawPaint(const SkDraw&, const SkPaint& paint) override; - virtual void drawPoints(const SkDraw&, SkCanvas::PointMode mode, size_t count, - const SkPoint[], const SkPaint& paint) override; - virtual void drawRect(const SkDraw&, const SkRect& r, - const SkPaint& paint) override; - virtual void drawOval(const SkDraw&, const SkRect& oval, - const SkPaint& paint) override; - virtual void drawRRect(const SkDraw&, const SkRRect& rr, - const SkPaint& paint) override; - - /** - * If pathIsMutable, then the implementation is allowed to cast path to a - * non-const pointer and modify it in place (as an optimization). Canvas - * may do this to implement helpers such as drawOval, by placing a temp - * path on the stack to hold the representation of the oval. - * - * If prePathMatrix is not null, it should logically be applied before any - * stroking or other effects. If there are no effects on the paint that - * affect the geometry/rasterization, then the pre matrix can just be - * pre-concated with the current matrix. - */ - virtual void drawPath(const SkDraw&, const SkPath& path, - const SkPaint& paint, - const SkMatrix* prePathMatrix = NULL, - bool pathIsMutable = false) override; - virtual void drawBitmap(const SkDraw&, const SkBitmap& bitmap, - const SkMatrix& matrix, const SkPaint& paint) override; - virtual void drawSprite(const SkDraw&, const SkBitmap& bitmap, - int x, int y, const SkPaint& paint) override; - - /** - * The default impl. will create a bitmap-shader from the bitmap, - * and call drawRect with it. - */ - void drawBitmapRect(const SkDraw&, const SkBitmap&, const SkRect*, const SkRect&, - const SkPaint&, SkCanvas::SrcRectConstraint) override; - - /** - * Does not handle text decoration. - * Decorations (underline and stike-thru) will be handled by SkCanvas. - */ - virtual void drawText(const SkDraw&, const void* text, size_t len, - SkScalar x, SkScalar y, const SkPaint& paint) override; - virtual void drawPosText(const SkDraw&, const void* text, size_t len, - const SkScalar pos[], int scalarsPerPos, - const SkPoint& offset, const SkPaint& paint) override; - virtual 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; - virtual void drawDevice(const SkDraw&, SkBaseDevice*, int x, int y, const SkPaint&) override; - - /////////////////////////////////////////////////////////////////////////// - - void drawSpecial(const SkDraw&, SkSpecialImage*, int x, int y, const SkPaint&) override; - sk_sp makeSpecial(const SkBitmap&) override; - sk_sp makeSpecial(const SkImage*) override; - sk_sp snapSpecial() override; - - /////////////////////////////////////////////////////////////////////////// - - /** Update as needed the pixel value in the bitmap, so that the caller can - access the pixels directly. Note: only the pixels field should be - altered. The config/width/height/rowbytes must remain unchanged. - @return the device contents as a bitmap - */ -#ifdef SK_SUPPORT_LEGACY_ACCESSBITMAP - const SkBitmap& onAccessBitmap() override; -#else - const SkBitmap& onAccessBitmap(); -#endif - - SkPixelRef* getPixelRef() const { return fBitmap.pixelRef(); } - // just for subclasses, to assign a custom pixelref - void setPixelRef(sk_sp pr) { fBitmap.setPixelRef(std::move(pr), 0, 0); } -#ifdef SK_SUPPORT_LEGACY_BITMAP_SETPIXELREF - SkPixelRef* setPixelRef(SkPixelRef* pr) { return fBitmap.setPixelRef(pr); } -#endif - - bool onReadPixels(const SkImageInfo&, void*, size_t, int x, int y) override; - bool onWritePixels(const SkImageInfo&, const void*, size_t, int, int) override; - bool onPeekPixels(SkPixmap*) override; - bool onAccessPixels(SkPixmap*) override; - -private: - friend class SkCanvas; - friend struct DeviceCM; //for setMatrixClip - friend class SkDraw; - friend class SkDrawIter; - friend class SkDeviceFilteredPaint; - - friend class SkSurface_Raster; - - // used to change the backend's pixels (and possibly config/rowbytes) - // but cannot change the width/height, so there should be no change to - // any clip information. - void replaceBitmapBackendForRasterSurface(const SkBitmap&) override; - - SkBaseDevice* onCreateDevice(const CreateInfo&, const SkPaint*) override; - - sk_sp makeSurface(const SkImageInfo&, const SkSurfaceProps&) override; - - SkImageFilterCache* getImageFilterCache() override; - - SkBitmap fBitmap; - void* fRasterHandle = nullptr; - - void setNewSize(const SkISize&); // Used by SkCanvas for resetForNextPicture(). - - typedef SkBaseDevice INHERITED; -}; - -#endif // SkBitmapDevice_DEFINED diff --git a/src/gpu/SkGpuDevice.h b/src/gpu/SkGpuDevice.h index 4b4f39d..2945214 100644 --- a/src/gpu/SkGpuDevice.h +++ b/src/gpu/SkGpuDevice.h @@ -10,8 +10,8 @@ #include "SkGr.h" #include "SkGrPriv.h" -#include "SkBaseDevice.h" #include "SkBitmap.h" +#include "SkDevice.h" #include "SkPicture.h" #include "SkRegion.h" #include "SkSurface.h" diff --git a/src/image/SkSurface_Raster.cpp b/src/image/SkSurface_Raster.cpp index 529bc43..47e0dbe 100644 --- a/src/image/SkSurface_Raster.cpp +++ b/src/image/SkSurface_Raster.cpp @@ -5,11 +5,11 @@ * found in the LICENSE file. */ -#include "SkBaseDevice.h" -#include "SkCanvas.h" +#include "SkSurface_Base.h" #include "SkImagePriv.h" +#include "SkCanvas.h" +#include "SkDevice.h" #include "SkMallocPixelRef.h" -#include "SkSurface_Base.h" static const size_t kIgnoreRowBytesValue = (size_t)~0; diff --git a/src/pdf/SkPDFDevice.cpp b/src/pdf/SkPDFDevice.cpp index 5f3c2d6..6da4d3b 100644 --- a/src/pdf/SkPDFDevice.cpp +++ b/src/pdf/SkPDFDevice.cpp @@ -9,6 +9,7 @@ #include "SkAdvancedTypefaceMetrics.h" #include "SkAnnotationKeys.h" +#include "SkBitmapDevice.h" #include "SkBitmapKey.h" #include "SkColor.h" #include "SkColorFilter.h" @@ -32,7 +33,6 @@ #include "SkPDFUtils.h" #include "SkPixelRef.h" #include "SkRasterClip.h" -#include "SkRasterDevice.h" #include "SkRRect.h" #include "SkScopeExit.h" #include "SkString.h" diff --git a/src/pdf/SkPDFDevice.h b/src/pdf/SkPDFDevice.h index ad3c8cf..d8e26c5 100644 --- a/src/pdf/SkPDFDevice.h +++ b/src/pdf/SkPDFDevice.h @@ -8,11 +8,11 @@ #ifndef SkPDFDevice_DEFINED #define SkPDFDevice_DEFINED -#include "SkBaseDevice.h" #include "SkBitmap.h" #include "SkCanvas.h" #include "SkClipStack.h" #include "SkData.h" +#include "SkDevice.h" #include "SkPaint.h" #include "SkRect.h" #include "SkRefCnt.h" diff --git a/src/svg/SkSVGDevice.h b/src/svg/SkSVGDevice.h index b5cb488..5de7735 100644 --- a/src/svg/SkSVGDevice.h +++ b/src/svg/SkSVGDevice.h @@ -8,7 +8,7 @@ #ifndef SkSVGDevice_DEFINED #define SkSVGDevice_DEFINED -#include "SkBaseDevice.h" +#include "SkDevice.h" #include "SkTemplates.h" class SkXMLWriter; diff --git a/src/utils/SkCanvasStateUtils.cpp b/src/utils/SkCanvasStateUtils.cpp index 9ad0d05..6dd0ca3 100644 --- a/src/utils/SkCanvasStateUtils.cpp +++ b/src/utils/SkCanvasStateUtils.cpp @@ -7,9 +7,9 @@ #include "SkCanvasStateUtils.h" -#include "SkBaseDevice.h" #include "SkCanvas.h" #include "SkCanvasStack.h" +#include "SkDevice.h" #include "SkRasterClip.h" #include "SkWriter32.h" #include "SkClipOpPriv.h" diff --git a/src/xps/SkXPSDevice.h b/src/xps/SkXPSDevice.h index eb1e70b..bbb0716 100644 --- a/src/xps/SkXPSDevice.h +++ b/src/xps/SkXPSDevice.h @@ -16,13 +16,13 @@ #include #include "SkAutoCoInitialize.h" +#include "SkBitmapDevice.h" #include "SkBitSet.h" #include "SkCanvas.h" #include "SkColor.h" #include "SkPaint.h" #include "SkPath.h" #include "SkPoint.h" -#include "SkRasterDevice.h" #include "SkShader.h" #include "SkSize.h" #include "SkTArray.h" diff --git a/tests/DeviceTest.cpp b/tests/DeviceTest.cpp index 43016cf..9fb4fa2 100644 --- a/tests/DeviceTest.cpp +++ b/tests/DeviceTest.cpp @@ -5,7 +5,8 @@ * found in the LICENSE file. */ -#include "SkRasterDevice.h" +#include "SkBitmapDevice.h" +#include "SkDevice.h" #include "SkSpecialImage.h" #if SK_SUPPORT_GPU diff --git a/tests/LayerDrawLooperTest.cpp b/tests/LayerDrawLooperTest.cpp index 5e2cbb6..8fcbf16 100644 --- a/tests/LayerDrawLooperTest.cpp +++ b/tests/LayerDrawLooperTest.cpp @@ -6,12 +6,12 @@ */ #include "SkBitmap.h" +#include "SkBitmapDevice.h" #include "SkCanvas.h" #include "SkDraw.h" #include "SkLayerDrawLooper.h" #include "SkMatrix.h" #include "SkPaint.h" -#include "SkRasterDevice.h" #include "SkRect.h" #include "SkRefCnt.h" #include "SkScalar.h" diff --git a/tests/SurfaceTest.cpp b/tests/SurfaceTest.cpp index 9448862..1f04de5 100644 --- a/tests/SurfaceTest.cpp +++ b/tests/SurfaceTest.cpp @@ -6,10 +6,10 @@ */ #include -#include "SkBaseDevice.h" #include "SkCanvas.h" #include "SkColorSpace_Base.h" #include "SkData.h" +#include "SkDevice.h" #include "SkImage_Base.h" #include "SkOverdrawCanvas.h" #include "SkPath.h"