diff options
-rw-r--r-- | gm/fatpathfill.cpp | 2 | ||||
-rw-r--r-- | gm/image.cpp | 6 | ||||
-rw-r--r-- | include/core/SkImage.h | 6 | ||||
-rw-r--r-- | include/core/SkSurface.h | 10 | ||||
-rw-r--r-- | samplecode/SampleFatBits.cpp | 4 | ||||
-rw-r--r-- | src/image/SkImagePriv.cpp | 3 | ||||
-rw-r--r-- | src/image/SkImage_Raster.cpp | 23 | ||||
-rw-r--r-- | src/image/SkSurface.cpp | 4 | ||||
-rw-r--r-- | src/image/SkSurface_Base.h | 2 | ||||
-rw-r--r-- | src/image/SkSurface_Gpu.cpp | 10 | ||||
-rw-r--r-- | src/image/SkSurface_Picture.cpp | 6 | ||||
-rw-r--r-- | src/image/SkSurface_Raster.cpp | 36 | ||||
-rw-r--r-- | tests/PathTest.cpp | 2 |
13 files changed, 49 insertions, 65 deletions
diff --git a/gm/fatpathfill.cpp b/gm/fatpathfill.cpp index 3fea6f4f3d..c86dfcb6af 100644 --- a/gm/fatpathfill.cpp +++ b/gm/fatpathfill.cpp @@ -22,7 +22,7 @@ static SkSurface* new_surface(int width, int height) { SkImage::kPMColor_ColorType, SkImage::kPremul_AlphaType }; - return SkSurface::NewRaster(info, NULL); + return SkSurface::NewRaster(info); } static void draw_pixel_centers(SkCanvas* canvas) { diff --git a/gm/image.cpp b/gm/image.cpp index 6f326a8a29..e54d3c7b2f 100644 --- a/gm/image.cpp +++ b/gm/image.cpp @@ -158,13 +158,13 @@ protected: info.fHeight = H; info.fColorType = SkImage::kPMColor_ColorType; info.fAlphaType = SkImage::kPremul_AlphaType; - SkAutoTUnref<SkSurface> surf0(SkSurface::NewRasterDirect(info, NULL, fBuffer, RB)); - SkAutoTUnref<SkSurface> surf1(SkSurface::NewRaster(info, NULL)); + SkAutoTUnref<SkSurface> surf0(SkSurface::NewRasterDirect(info, fBuffer, RB)); + SkAutoTUnref<SkSurface> surf1(SkSurface::NewRaster(info)); SkAutoTUnref<SkSurface> surf2(SkSurface::NewPicture(info.fWidth, info.fHeight)); #if SK_SUPPORT_GPU GrContext* ctx = skiagm::GetGr(); - SkAutoTUnref<SkSurface> surf3(SkSurface::NewRenderTarget(ctx, info, NULL, 0)); + SkAutoTUnref<SkSurface> surf3(SkSurface::NewRenderTarget(ctx, info, 0)); #endif test_surface(canvas, surf0); diff --git a/include/core/SkImage.h b/include/core/SkImage.h index 2fa7b51e45..b8ebc3aca5 100644 --- a/include/core/SkImage.h +++ b/include/core/SkImage.h @@ -23,8 +23,6 @@ class GrTexture; ////// EXPERIMENTAL -class SkColorSpace; - /** * SkImage is an abstraction for drawing a rectagle of pixels, though the * particular type of image could be actually storing its data on the GPU, or @@ -65,8 +63,8 @@ public: AlphaType fAlphaType; }; - static SkImage* NewRasterCopy(const Info&, SkColorSpace*, const void* pixels, size_t rowBytes); - static SkImage* NewRasterData(const Info&, SkColorSpace*, SkData* pixels, size_t rowBytes); + static SkImage* NewRasterCopy(const Info&, const void* pixels, size_t rowBytes); + static SkImage* NewRasterData(const Info&, SkData* pixels, size_t rowBytes); static SkImage* NewEncodedData(SkData*); static SkImage* NewTexture(GrTexture*); diff --git a/include/core/SkSurface.h b/include/core/SkSurface.h index 18ae5ccdc7..70012994db 100644 --- a/include/core/SkSurface.h +++ b/include/core/SkSurface.h @@ -35,8 +35,7 @@ public: * If the requested surface cannot be created, or the request is not a * supported configuration, NULL will be returned. */ - static SkSurface* NewRasterDirect(const SkImage::Info&, SkColorSpace*, - void* pixels, size_t rowBytes); + static SkSurface* NewRasterDirect(const SkImage::Info&, void* pixels, size_t rowBytes); /** * Return a new surface, with the memory for the pixels automatically @@ -45,7 +44,7 @@ public: * If the requested surface cannot be created, or the request is not a * supported configuration, NULL will be returned. */ - static SkSurface* NewRaster(const SkImage::Info&, SkColorSpace*); + static SkSurface* NewRaster(const SkImage::Info&); /** * Return a new surface whose contents will be recorded into a picture. @@ -63,8 +62,7 @@ public: * Return a new surface whose contents will be drawn to an offscreen * render target, allocated by the surface. */ - static SkSurface* NewRenderTarget(GrContext*, const SkImage::Info&, - SkColorSpace*, int sampleCount = 0); + static SkSurface* NewRenderTarget(GrContext*, const SkImage::Info&, int sampleCount = 0); int width() const { return fWidth; } int height() const { return fHeight; } @@ -107,7 +105,7 @@ public: * ... // draw using canvasB * canvasA->drawSurface(surfaceB); // <--- this will always be optimal! */ - SkSurface* newSurface(const SkImage::Info&, SkColorSpace*); + SkSurface* newSurface(const SkImage::Info&); /** * Returns an image of the current state of the surface pixels up to this diff --git a/samplecode/SampleFatBits.cpp b/samplecode/SampleFatBits.cpp index e88a1d5aab..eac713632f 100644 --- a/samplecode/SampleFatBits.cpp +++ b/samplecode/SampleFatBits.cpp @@ -91,10 +91,10 @@ public: SkImage::Info info = { width, height, SkImage::kPMColor_ColorType, SkImage::kPremul_AlphaType }; - fMinSurface.reset(SkSurface::NewRaster(info, NULL)); + fMinSurface.reset(SkSurface::NewRaster(info)); info.fWidth *= zoom; info.fHeight *= zoom; - fMaxSurface.reset(SkSurface::NewRaster(info, NULL)); + fMaxSurface.reset(SkSurface::NewRaster(info)); } void drawBG(SkCanvas*); diff --git a/src/image/SkImagePriv.cpp b/src/image/SkImagePriv.cpp index e7a244ab54..e10a44c28c 100644 --- a/src/image/SkImagePriv.cpp +++ b/src/image/SkImagePriv.cpp @@ -108,8 +108,7 @@ SkImage* SkNewImageFromBitmap(const SkBitmap& bm, bool canSharePixelRef) { } else { bm.lockPixels(); if (bm.getPixels()) { - image = SkImage::NewRasterCopy(info, NULL, bm.getPixels(), - bm.rowBytes()); + image = SkImage::NewRasterCopy(info, bm.getPixels(), bm.rowBytes()); } bm.unlockPixels(); } diff --git a/src/image/SkImage_Raster.cpp b/src/image/SkImage_Raster.cpp index c9a132d371..8638052fc5 100644 --- a/src/image/SkImage_Raster.cpp +++ b/src/image/SkImage_Raster.cpp @@ -14,7 +14,7 @@ class SkImage_Raster : public SkImage_Base { public: - static bool ValidArgs(const Info& info, SkColorSpace* cs, size_t rowBytes) { + static bool ValidArgs(const Info& info, size_t rowBytes) { const int maxDimension = SK_MaxS32 >> 2; const size_t kMaxPixelByteSize = SK_MaxS32; @@ -51,7 +51,7 @@ public: static SkImage* NewEmpty(); - SkImage_Raster(const SkImage::Info&, SkColorSpace*, SkData*, size_t rb); + SkImage_Raster(const SkImage::Info&, SkData*, size_t rb); virtual ~SkImage_Raster(); virtual void onDraw(SkCanvas*, SkScalar, SkScalar, const SkPaint*) SK_OVERRIDE; @@ -81,9 +81,8 @@ SkImage* SkImage_Raster::NewEmpty() { return gEmpty; } -SkImage_Raster::SkImage_Raster(const Info& info, SkColorSpace* cs, - SkData* data, size_t rowBytes) -: INHERITED(info.fWidth, info.fHeight) { +SkImage_Raster::SkImage_Raster(const Info& info, SkData* data, size_t rowBytes) + : INHERITED(info.fWidth, info.fHeight) { bool isOpaque; SkBitmap::Config config = SkImageInfoToBitmapConfig(info, &isOpaque); @@ -112,9 +111,8 @@ void SkImage_Raster::onDraw(SkCanvas* canvas, SkScalar x, SkScalar y, const SkPa /////////////////////////////////////////////////////////////////////////////// -SkImage* SkImage::NewRasterCopy(const SkImage::Info& info, SkColorSpace* cs, - const void* pixels, size_t rowBytes) { - if (!SkImage_Raster::ValidArgs(info, cs, rowBytes)) { +SkImage* SkImage::NewRasterCopy(const SkImage::Info& info, const void* pixels, size_t rowBytes) { + if (!SkImage_Raster::ValidArgs(info, rowBytes)) { return NULL; } if (0 == info.fWidth && 0 == info.fHeight) { @@ -127,13 +125,12 @@ SkImage* SkImage::NewRasterCopy(const SkImage::Info& info, SkColorSpace* cs, // Here we actually make a copy of the caller's pixel data SkAutoDataUnref data(SkData::NewWithCopy(pixels, info.fHeight * rowBytes)); - return SkNEW_ARGS(SkImage_Raster, (info, cs, data, rowBytes)); + return SkNEW_ARGS(SkImage_Raster, (info, data, rowBytes)); } -SkImage* SkImage::NewRasterData(const SkImage::Info& info, SkColorSpace* cs, - SkData* pixelData, size_t rowBytes) { - if (!SkImage_Raster::ValidArgs(info, cs, rowBytes)) { +SkImage* SkImage::NewRasterData(const SkImage::Info& info, SkData* pixelData, size_t rowBytes) { + if (!SkImage_Raster::ValidArgs(info, rowBytes)) { return NULL; } if (0 == info.fWidth && 0 == info.fHeight) { @@ -151,7 +148,7 @@ SkImage* SkImage::NewRasterData(const SkImage::Info& info, SkColorSpace* cs, } SkAutoDataUnref data(pixelData); - return SkNEW_ARGS(SkImage_Raster, (info, cs, data, rowBytes)); + return SkNEW_ARGS(SkImage_Raster, (info, data, rowBytes)); } SkImage* SkNewImageFromPixelRef(const SkImage::Info& info, SkPixelRef* pr, diff --git a/src/image/SkSurface.cpp b/src/image/SkSurface.cpp index 92089e38ad..6547780438 100644 --- a/src/image/SkSurface.cpp +++ b/src/image/SkSurface.cpp @@ -123,8 +123,8 @@ SkImage* SkSurface::newImageShapshot() { return image; } -SkSurface* SkSurface::newSurface(const SkImage::Info& info, SkColorSpace* cs) { - return asSB(this)->onNewSurface(info, cs); +SkSurface* SkSurface::newSurface(const SkImage::Info& info) { + return asSB(this)->onNewSurface(info); } void SkSurface::draw(SkCanvas* canvas, SkScalar x, SkScalar y, diff --git a/src/image/SkSurface_Base.h b/src/image/SkSurface_Base.h index 9d440f4892..e5ca498b85 100644 --- a/src/image/SkSurface_Base.h +++ b/src/image/SkSurface_Base.h @@ -23,7 +23,7 @@ public: */ virtual SkCanvas* onNewCanvas() = 0; - virtual SkSurface* onNewSurface(const SkImage::Info&, SkColorSpace*) = 0; + virtual SkSurface* onNewSurface(const SkImage::Info&) = 0; /** * Allocate an SkImage that represents the current contents of the surface. diff --git a/src/image/SkSurface_Gpu.cpp b/src/image/SkSurface_Gpu.cpp index 54c74b2bab..74fbe0b0b2 100644 --- a/src/image/SkSurface_Gpu.cpp +++ b/src/image/SkSurface_Gpu.cpp @@ -19,7 +19,7 @@ public: virtual ~SkSurface_Gpu(); virtual SkCanvas* onNewCanvas() SK_OVERRIDE; - virtual SkSurface* onNewSurface(const SkImage::Info&, SkColorSpace*) SK_OVERRIDE; + virtual SkSurface* onNewSurface(const SkImage::Info&) SK_OVERRIDE; virtual SkImage* onNewImageShapshot() SK_OVERRIDE; virtual void onDraw(SkCanvas*, SkScalar x, SkScalar y, const SkPaint*) SK_OVERRIDE; @@ -65,11 +65,10 @@ SkCanvas* SkSurface_Gpu::onNewCanvas() { return SkNEW_ARGS(SkCanvas, (fDevice)); } -SkSurface* SkSurface_Gpu::onNewSurface(const SkImage::Info& info, - SkColorSpace* cs) { +SkSurface* SkSurface_Gpu::onNewSurface(const SkImage::Info& info) { GrRenderTarget* rt = (GrRenderTarget*) fDevice->accessRenderTarget(); int sampleCount = rt->numSamples(); - return SkSurface::NewRenderTarget(fDevice->context(), info, NULL, sampleCount); + return SkSurface::NewRenderTarget(fDevice->context(), info, sampleCount); } SkImage* SkSurface_Gpu::onNewImageShapshot() { @@ -123,8 +122,7 @@ SkSurface* SkSurface::NewRenderTargetDirect(GrContext* ctx, return SkNEW_ARGS(SkSurface_Gpu, (ctx, target)); } -SkSurface* SkSurface::NewRenderTarget(GrContext* ctx, const SkImage::Info& info, - SkColorSpace*, int sampleCount) { +SkSurface* SkSurface::NewRenderTarget(GrContext* ctx, const SkImage::Info& info, int sampleCount) { if (NULL == ctx) { return NULL; } diff --git a/src/image/SkSurface_Picture.cpp b/src/image/SkSurface_Picture.cpp index 80fc1f45f6..54998445bc 100644 --- a/src/image/SkSurface_Picture.cpp +++ b/src/image/SkSurface_Picture.cpp @@ -20,7 +20,7 @@ public: virtual ~SkSurface_Picture(); virtual SkCanvas* onNewCanvas() SK_OVERRIDE; - virtual SkSurface* onNewSurface(const SkImage::Info&, SkColorSpace*) SK_OVERRIDE; + virtual SkSurface* onNewSurface(const SkImage::Info&) SK_OVERRIDE; virtual SkImage* onNewImageShapshot() SK_OVERRIDE; virtual void onDraw(SkCanvas*, SkScalar x, SkScalar y, const SkPaint*) SK_OVERRIDE; @@ -52,7 +52,7 @@ SkCanvas* SkSurface_Picture::onNewCanvas() { return canvas; } -SkSurface* SkSurface_Picture::onNewSurface(const SkImage::Info& info, SkColorSpace*) { +SkSurface* SkSurface_Picture::onNewSurface(const SkImage::Info& info) { return SkSurface::NewPicture(info.fWidth, info.fHeight); } @@ -64,7 +64,7 @@ SkImage* SkSurface_Picture::onNewImageShapshot() { info.fWidth = info.fHeight = 0; info.fColorType = SkImage::kPMColor_ColorType; info.fAlphaType = SkImage::kOpaque_AlphaType; - return SkImage::NewRasterCopy(info, NULL, NULL, 0); + return SkImage::NewRasterCopy(info, NULL, 0); } } diff --git a/src/image/SkSurface_Raster.cpp b/src/image/SkSurface_Raster.cpp index 8afab6b01c..dd318191a7 100644 --- a/src/image/SkSurface_Raster.cpp +++ b/src/image/SkSurface_Raster.cpp @@ -15,13 +15,13 @@ static const size_t kIgnoreRowBytesValue = (size_t)~0; class SkSurface_Raster : public SkSurface_Base { public: - static bool Valid(const SkImage::Info&, SkColorSpace*, size_t rb = kIgnoreRowBytesValue); + static bool Valid(const SkImage::Info&, size_t rb = kIgnoreRowBytesValue); - SkSurface_Raster(const SkImage::Info&, SkColorSpace*, void*, size_t rb); - SkSurface_Raster(const SkImage::Info&, SkColorSpace*, SkPixelRef*, size_t rb); + SkSurface_Raster(const SkImage::Info&, void*, size_t rb); + SkSurface_Raster(const SkImage::Info&, SkPixelRef*, size_t rb); virtual SkCanvas* onNewCanvas() SK_OVERRIDE; - virtual SkSurface* onNewSurface(const SkImage::Info&, SkColorSpace*) SK_OVERRIDE; + virtual SkSurface* onNewSurface(const SkImage::Info&) SK_OVERRIDE; virtual SkImage* onNewImageShapshot() SK_OVERRIDE; virtual void onDraw(SkCanvas*, SkScalar x, SkScalar y, const SkPaint*) SK_OVERRIDE; @@ -36,8 +36,7 @@ private: /////////////////////////////////////////////////////////////////////////////// -bool SkSurface_Raster::Valid(const SkImage::Info& info, SkColorSpace* cs, - size_t rowBytes) { +bool SkSurface_Raster::Valid(const SkImage::Info& info, size_t rowBytes) { static const size_t kMaxTotalSize = SK_MaxS32; bool isOpaque; @@ -82,8 +81,7 @@ bool SkSurface_Raster::Valid(const SkImage::Info& info, SkColorSpace* cs, return true; } -SkSurface_Raster::SkSurface_Raster(const SkImage::Info& info, SkColorSpace* cs, - void* pixels, size_t rb) +SkSurface_Raster::SkSurface_Raster(const SkImage::Info& info, void* pixels, size_t rb) : INHERITED(info.fWidth, info.fHeight) { bool isOpaque; SkBitmap::Config config = SkImageInfoToBitmapConfig(info, &isOpaque); @@ -94,8 +92,7 @@ SkSurface_Raster::SkSurface_Raster(const SkImage::Info& info, SkColorSpace* cs, fWeOwnThePixels = false; // We are "Direct" } -SkSurface_Raster::SkSurface_Raster(const SkImage::Info& info, SkColorSpace* cs, - SkPixelRef* pr, size_t rb) +SkSurface_Raster::SkSurface_Raster(const SkImage::Info& info, SkPixelRef* pr, size_t rb) : INHERITED(info.fWidth, info.fHeight) { bool isOpaque; SkBitmap::Config config = SkImageInfoToBitmapConfig(info, &isOpaque); @@ -114,9 +111,8 @@ SkCanvas* SkSurface_Raster::onNewCanvas() { return SkNEW_ARGS(SkCanvas, (fBitmap)); } -SkSurface* SkSurface_Raster::onNewSurface(const SkImage::Info& info, - SkColorSpace* cs) { - return SkSurface::NewRaster(info, cs); +SkSurface* SkSurface_Raster::onNewSurface(const SkImage::Info& info) { + return SkSurface::NewRaster(info); } void SkSurface_Raster::onDraw(SkCanvas* canvas, SkScalar x, SkScalar y, @@ -143,21 +139,19 @@ void SkSurface_Raster::onCopyOnWrite(SkImage* image, SkCanvas* canvas) { /////////////////////////////////////////////////////////////////////////////// -SkSurface* SkSurface::NewRasterDirect(const SkImage::Info& info, - SkColorSpace* cs, - void* pixels, size_t rowBytes) { - if (!SkSurface_Raster::Valid(info, cs, rowBytes)) { +SkSurface* SkSurface::NewRasterDirect(const SkImage::Info& info, void* pixels, size_t rowBytes) { + if (!SkSurface_Raster::Valid(info, rowBytes)) { return NULL; } if (NULL == pixels) { return NULL; } - return SkNEW_ARGS(SkSurface_Raster, (info, cs, pixels, rowBytes)); + return SkNEW_ARGS(SkSurface_Raster, (info, pixels, rowBytes)); } -SkSurface* SkSurface::NewRaster(const SkImage::Info& info, SkColorSpace* cs) { - if (!SkSurface_Raster::Valid(info, cs)) { +SkSurface* SkSurface::NewRaster(const SkImage::Info& info) { + if (!SkSurface_Raster::Valid(info)) { return NULL; } @@ -175,6 +169,6 @@ SkSurface* SkSurface::NewRaster(const SkImage::Info& info, SkColorSpace* cs) { } SkAutoTUnref<SkPixelRef> pr(SkNEW_ARGS(SkMallocPixelRef, (pixels, size, NULL, true))); - return SkNEW_ARGS(SkSurface_Raster, (info, cs, pr, rowBytes)); + return SkNEW_ARGS(SkSurface_Raster, (info, pr, rowBytes)); } diff --git a/tests/PathTest.cpp b/tests/PathTest.cpp index a74ba8a8e6..97ba258ed7 100644 --- a/tests/PathTest.cpp +++ b/tests/PathTest.cpp @@ -22,7 +22,7 @@ static SkSurface* new_surface(int w, int h) { SkImage::Info info = { w, h, SkImage::kPMColor_ColorType, SkImage::kPremul_AlphaType }; - return SkSurface::NewRaster(info, NULL); + return SkSurface::NewRaster(info); } // Make sure we stay non-finite once we get there (unless we reset or rewind). |