aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-11-01 13:46:54 +0000
committerGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-11-01 13:46:54 +0000
commit2bd8b8100529c96c81c30f749f672f4caf775b04 (patch)
tree5a7468a4570ecf07a7089afbfbfeebb5c773555c
parent05d56ebbf385c8723c9bed3409739055afa3b073 (diff)
move SkImage::ColorType into SkColorType
objective -- move clients over to SkImage tasks - use SkImageInfo instead of SkBitmap::Config - add support for colortables to SkImage - add drawImage to SkCanvas - return SkImage from readPixels This CL works towards the first task R=robertphillips@google.com Review URL: https://codereview.chromium.org/54363008 git-svn-id: http://skia.googlecode.com/svn/trunk@12077 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r--bench/DeferredSurfaceCopyBench.cpp4
-rw-r--r--debugger/QT/SkImageWidget.cpp4
-rw-r--r--gm/image.cpp4
-rw-r--r--gm/srcmode.cpp4
-rw-r--r--include/core/SkImage.h55
-rw-r--r--include/core/SkImageDecoder.h4
-rw-r--r--include/core/SkSurface.h14
-rw-r--r--include/lazy/SkBitmapFactory.h8
-rw-r--r--platform_tools/android/examples/hello_skia_app/jni/helloskia.cpp4
-rw-r--r--samplecode/SampleFatBits.cpp4
-rw-r--r--src/image/SkImagePriv.cpp30
-rw-r--r--src/image/SkImagePriv.h12
-rw-r--r--src/image/SkImage_Raster.cpp12
-rw-r--r--src/image/SkSurface.cpp2
-rw-r--r--src/image/SkSurface_Base.h2
-rw-r--r--src/image/SkSurface_Gpu.cpp10
-rw-r--r--src/image/SkSurface_Picture.cpp8
-rw-r--r--src/image/SkSurface_Raster.cpp20
-rw-r--r--src/images/SkImageDecoder.cpp2
-rw-r--r--src/lazy/SkBitmapFactory.cpp2
-rw-r--r--src/lazy/SkLazyPixelRef.cpp18
-rw-r--r--src/lazy/SkLazyPixelRef.h2
-rw-r--r--src/ports/SkImageDecoder_empty.cpp2
-rw-r--r--tests/CachedDecodingPixelRefTest.cpp2
-rw-r--r--tests/DeferredCanvasTest.cpp10
-rw-r--r--tests/DrawBitmapRectTest.cpp4
-rw-r--r--tests/SurfaceTest.cpp4
-rw-r--r--tools/LazyDecodeBitmap.cpp2
28 files changed, 132 insertions, 117 deletions
diff --git a/bench/DeferredSurfaceCopyBench.cpp b/bench/DeferredSurfaceCopyBench.cpp
index f9f8c8e95b..91b34a90c0 100644
--- a/bench/DeferredSurfaceCopyBench.cpp
+++ b/bench/DeferredSurfaceCopyBench.cpp
@@ -34,10 +34,10 @@ protected:
virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
// The canvas is not actually used for this test except to provide
// configuration information: gpu, multisampling, size, etc?
- SkImage::Info info;
+ SkImageInfo info;
info.fWidth = kSurfaceWidth;
info.fHeight = kSurfaceHeight;
- info.fColorType = SkImage::kPMColor_ColorType;
+ info.fColorType = kPMColor_SkColorType;
info.fAlphaType = kPremul_SkAlphaType;
const SkRect fullCanvasRect = SkRect::MakeWH(
SkIntToScalar(kSurfaceWidth), SkIntToScalar(kSurfaceHeight));
diff --git a/debugger/QT/SkImageWidget.cpp b/debugger/QT/SkImageWidget.cpp
index cac7e7dc12..9e263008be 100644
--- a/debugger/QT/SkImageWidget.cpp
+++ b/debugger/QT/SkImageWidget.cpp
@@ -16,10 +16,10 @@ SkImageWidget::SkImageWidget(SkDebugger *debugger)
, fDebugger(debugger) {
this->setStyleSheet("QWidget {background-color: white; border: 1px solid #cccccc;}");
- SkImage::Info info;
+ SkImageInfo info;
info.fWidth = kImageWidgetWidth;
info.fHeight = kImageWidgetHeight;
- info.fColorType = SkImage::kPMColor_ColorType;
+ info.fColorType = kPMColor_SkColorType;
info.fAlphaType = kPremul_SkAlphaType;
fSurface = SkSurface::NewRasterDirect(info, fPixels, 4 * kImageWidgetWidth);
diff --git a/gm/image.cpp b/gm/image.cpp
index e9378be0e2..7ecb604ea6 100644
--- a/gm/image.cpp
+++ b/gm/image.cpp
@@ -178,8 +178,8 @@ protected:
// since we draw into this directly, we need to start fresh
sk_bzero(fBuffer, fBufferSize);
- SkImage::Info info = {
- W, H, SkImage::kPMColor_ColorType, kPremul_SkAlphaType
+ SkImageInfo info = {
+ W, H, kPMColor_SkColorType, kPremul_SkAlphaType
};
SkAutoTUnref<SkSurface> surf0(SkSurface::NewRasterDirect(info, fBuffer, RB));
SkAutoTUnref<SkSurface> surf1(SkSurface::NewRaster(info));
diff --git a/gm/srcmode.cpp b/gm/srcmode.cpp
index 0f2591c828..666a36bb04 100644
--- a/gm/srcmode.cpp
+++ b/gm/srcmode.cpp
@@ -117,10 +117,10 @@ protected:
static SkSurface* compat_surface(SkCanvas* canvas, const SkISize& size,
bool skipGPU) {
- SkImage::Info info = {
+ SkImageInfo info = {
size.width(),
size.height(),
- SkImage::kPMColor_ColorType,
+ kPMColor_SkColorType,
kPremul_SkAlphaType
};
#if SK_SUPPORT_GPU
diff --git a/include/core/SkImage.h b/include/core/SkImage.h
index beede0338a..4142c63034 100644
--- a/include/core/SkImage.h
+++ b/include/core/SkImage.h
@@ -23,6 +23,30 @@ class GrTexture;
// need for TileMode
#include "SkShader.h"
+enum SkColorType {
+ kAlpha_8_SkColorType,
+ kRGB_565_SkColorType,
+ kRGBA_8888_SkColorType,
+ kBGRA_8888_SkColorType,
+
+#if SK_PMCOLOR_BYTE_ORDER(B,G,R,A)
+ kPMColor_SkColorType = kBGRA_8888_SkColorType,
+#elif SK_PMCOLOR_BYTE_ORDER(R,G,B,A)
+ kPMColor_SkColorType = kRGBA_8888_SkColorType,
+#else
+ #error "SK_*32_SHFIT values must correspond to BGRA or RGBA byte order"
+#endif
+
+ kLastEnum_SkColorType = kBGRA_8888_SkColorType
+};
+
+struct SkImageInfo {
+ int fWidth;
+ int fHeight;
+ SkColorType fColorType;
+ SkAlphaType fAlphaType;
+};
+
/**
* 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
@@ -37,36 +61,27 @@ class SK_API SkImage : public SkRefCnt {
public:
SK_DECLARE_INST_COUNT(SkImage)
- enum ColorType {
- kAlpha_8_ColorType,
- kRGB_565_ColorType,
- kRGBA_8888_ColorType,
- kBGRA_8888_ColorType,
+#ifdef SK_SUPPORT_LEGACY_COLORTYPE
+ typedef SkColorType ColorType;
-#if SK_PMCOLOR_BYTE_ORDER(B,G,R,A)
- kPMColor_ColorType = kBGRA_8888_ColorType,
-#elif SK_PMCOLOR_BYTE_ORDER(R,G,B,A)
- kPMColor_ColorType = kRGBA_8888_ColorType,
-#else
- #error "SK_*32_SHFIT values must correspond to BGRA or RGBA byte order"
+ static const SkColorType kAlpha_8_ColorType = kAlpha_8_SkColorType;
+ static const SkColorType kRGB_565_ColorType = kRGB_565_SkColorType;
+ static const SkColorType kRGBA_8888_ColorType = kRGBA_8888_SkColorType;
+ static const SkColorType kBGRA_8888_ColorType = kBGRA_8888_SkColorType;
+ static const SkColorType kPMColor_ColorType = kPMColor_SkColorType;
+ static const SkColorType kLastEnum_ColorType = kLastEnum_SkColorType;
#endif
- kLastEnum_ColorType = kBGRA_8888_ColorType
- };
-
+#ifdef SK_SUPPORT_LEGACY_ALPHATYPE
typedef SkAlphaType AlphaType;
static const SkAlphaType kIgnore_AlphaType = kIgnore_SkAlphaType;
static const SkAlphaType kOpaque_AlphaType = kOpaque_SkAlphaType;
static const SkAlphaType kPremul_AlphaType = kPremul_SkAlphaType;
static const SkAlphaType kUnpremul_AlphaType = kUnpremul_SkAlphaType;
+#endif
- struct Info {
- int fWidth;
- int fHeight;
- ColorType fColorType;
- SkAlphaType fAlphaType;
- };
+ typedef SkImageInfo Info;
static SkImage* NewRasterCopy(const Info&, const void* pixels, size_t rowBytes);
static SkImage* NewRasterData(const Info&, SkData* pixels, size_t rowBytes);
diff --git a/include/core/SkImageDecoder.h b/include/core/SkImageDecoder.h
index eac2157708..a7e3646553 100644
--- a/include/core/SkImageDecoder.h
+++ b/include/core/SkImageDecoder.h
@@ -377,7 +377,7 @@ public:
* Sample usage:
* <code>
* // Determine the image's info: width/height/config
- * SkImage::Info info;
+ * SkImageInfo info;
* bool success = DecodeMemoryToTarget(src, size, &info, NULL);
* if (!success) return;
* // Allocate space for the result:
@@ -389,7 +389,7 @@ public:
* success = DecodeMemoryToTarget(src, size, &info, &target);
* </code>
*/
- static bool DecodeMemoryToTarget(const void* buffer, size_t size, SkImage::Info* info,
+ static bool DecodeMemoryToTarget(const void* buffer, size_t size, SkImageInfo* info,
const SkBitmapFactory::Target* target);
/** Decode the image stored in the specified SkStreamRewindable, and store the result
diff --git a/include/core/SkSurface.h b/include/core/SkSurface.h
index d197a57eaf..3b7df4257f 100644
--- a/include/core/SkSurface.h
+++ b/include/core/SkSurface.h
@@ -35,7 +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&, void* pixels, size_t rowBytes);
+ static SkSurface* NewRasterDirect(const SkImageInfo&, void* pixels, size_t rowBytes);
/**
* Return a new surface, with the memory for the pixels automatically
@@ -44,16 +44,16 @@ 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&);
+ static SkSurface* NewRaster(const SkImageInfo&);
/**
- * Helper version of NewRaster. It creates a SkImage::Info with the
+ * Helper version of NewRaster. It creates a SkImageInfo with the
* specified width and height, and populates the rest of info to match
* pixels in SkPMColor format.
*/
static SkSurface* NewRasterPMColor(int width, int height) {
- SkImage::Info info = {
- width, height, SkImage::kPMColor_ColorType, kPremul_SkAlphaType
+ SkImageInfo info = {
+ width, height, kPMColor_SkColorType, kPremul_SkAlphaType
};
return NewRaster(info);
}
@@ -74,7 +74,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&, int sampleCount = 0);
+ static SkSurface* NewRenderTarget(GrContext*, const SkImageInfo&, int sampleCount = 0);
int width() const { return fWidth; }
int height() const { return fHeight; }
@@ -133,7 +133,7 @@ public:
* ... // draw using canvasB
* canvasA->drawSurface(surfaceB); // <--- this will always be optimal!
*/
- SkSurface* newSurface(const SkImage::Info&);
+ SkSurface* newSurface(const SkImageInfo&);
/**
* Returns an image of the current state of the surface pixels up to this
diff --git a/include/lazy/SkBitmapFactory.h b/include/lazy/SkBitmapFactory.h
index e967a915b2..8a39a48a28 100644
--- a/include/lazy/SkBitmapFactory.h
+++ b/include/lazy/SkBitmapFactory.h
@@ -39,7 +39,7 @@ public:
/**
* Signature for a function to decode an image from encoded data.
*/
- typedef bool (*DecodeProc)(const void* data, size_t length, SkImage::Info*, const Target*);
+ typedef bool (*DecodeProc)(const void* data, size_t length, SkImageInfo*, const Target*);
/**
* Create a bitmap factory which uses DecodeProc for decoding.
@@ -67,18 +67,18 @@ public:
bool installPixelRef(SkData*, SkBitmap*);
/**
- * An object for selecting an SkImageCache to use based on an SkImage::Info.
+ * An object for selecting an SkImageCache to use based on an SkImageInfo.
*/
class CacheSelector : public SkRefCnt {
public:
SK_DECLARE_INST_COUNT(CacheSelector)
/**
- * Return an SkImageCache to use based on the provided SkImage::Info. If the caller decides
+ * Return an SkImageCache to use based on the provided SkImageInfo. If the caller decides
* to hang on to the result, it will call ref, so the implementation should not add a ref
* as a result of this call.
*/
- virtual SkImageCache* selectCache(const SkImage::Info&) = 0;
+ virtual SkImageCache* selectCache(const SkImageInfo&) = 0;
private:
typedef SkRefCnt INHERITED;
diff --git a/platform_tools/android/examples/hello_skia_app/jni/helloskia.cpp b/platform_tools/android/examples/hello_skia_app/jni/helloskia.cpp
index 5e60439ed2..65f622883d 100644
--- a/platform_tools/android/examples/hello_skia_app/jni/helloskia.cpp
+++ b/platform_tools/android/examples/hello_skia_app/jni/helloskia.cpp
@@ -26,8 +26,8 @@ JNIEXPORT void JNICALL Java_com_example_HelloSkiaActivity_drawIntoBitmap(JNIEnv*
AndroidBitmap_getInfo(env, dstBitmap, &dstInfo);
AndroidBitmap_lockPixels(env, dstBitmap, &dstPixels);
- SkImage::Info info = {
- dstInfo.width, dstInfo.height, SkImage::kPMColor_ColorType,kPremul_SkAlphaType
+ SkImageInfo info = {
+ dstInfo.width, dstInfo.height, kPMColor_SkColorType, kPremul_SkAlphaType
};
// Create a surface from the given bitmap
diff --git a/samplecode/SampleFatBits.cpp b/samplecode/SampleFatBits.cpp
index cf441cd45c..c6fc67f3cc 100644
--- a/samplecode/SampleFatBits.cpp
+++ b/samplecode/SampleFatBits.cpp
@@ -106,8 +106,8 @@ public:
fInverse.setScale(SK_Scalar1 / zoom, SK_Scalar1 / zoom);
fShader->setLocalMatrix(fMatrix);
- SkImage::Info info = {
- width, height, SkImage::kPMColor_ColorType, SkImage::kPremul_AlphaType
+ SkImageInfo info = {
+ width, height, kPMColor_SkColorType, kPremul_SkAlphaType
};
fMinSurface.reset(SkSurface::NewRaster(info));
info.fWidth *= zoom;
diff --git a/src/image/SkImagePriv.cpp b/src/image/SkImagePriv.cpp
index eeeb9d87f7..a79f8dba65 100644
--- a/src/image/SkImagePriv.cpp
+++ b/src/image/SkImagePriv.cpp
@@ -9,15 +9,15 @@
#include "SkCanvas.h"
#include "SkPicture.h"
-SkBitmap::Config SkImageInfoToBitmapConfig(const SkImage::Info& info) {
+SkBitmap::Config SkImageInfoToBitmapConfig(const SkImageInfo& info) {
switch (info.fColorType) {
- case SkImage::kAlpha_8_ColorType:
+ case kAlpha_8_SkColorType:
return SkBitmap::kA8_Config;
- case SkImage::kRGB_565_ColorType:
+ case kRGB_565_SkColorType:
return SkBitmap::kRGB_565_Config;
- case SkImage::kPMColor_ColorType:
+ case kPMColor_SkColorType:
return SkBitmap::kARGB_8888_Config;
default:
@@ -27,31 +27,31 @@ SkBitmap::Config SkImageInfoToBitmapConfig(const SkImage::Info& info) {
return SkBitmap::kNo_Config;
}
-int SkImageBytesPerPixel(SkImage::ColorType ct) {
+int SkImageBytesPerPixel(SkColorType ct) {
static const uint8_t gColorTypeBytesPerPixel[] = {
- 1, // kAlpha_8_ColorType
- 2, // kRGB_565_ColorType
- 4, // kRGBA_8888_ColorType
- 4, // kBGRA_8888_ColorType
- 4, // kPMColor_ColorType
+ 1, // kAlpha_8_SkColorType
+ 2, // kRGB_565_SkColorType
+ 4, // kRGBA_8888_SkColorType
+ 4, // kBGRA_8888_SkColorType
+ 4, // kPMColor_SkColorType
};
SkASSERT((size_t)ct < SK_ARRAY_COUNT(gColorTypeBytesPerPixel));
return gColorTypeBytesPerPixel[ct];
}
-bool SkBitmapToImageInfo(const SkBitmap& bm, SkImage::Info* info) {
+bool SkBitmapToImageInfo(const SkBitmap& bm, SkImageInfo* info) {
switch (bm.config()) {
case SkBitmap::kA8_Config:
- info->fColorType = SkImage::kAlpha_8_ColorType;
+ info->fColorType = kAlpha_8_SkColorType;
break;
case SkBitmap::kRGB_565_Config:
- info->fColorType = SkImage::kRGB_565_ColorType;
+ info->fColorType = kRGB_565_SkColorType;
break;
case SkBitmap::kARGB_8888_Config:
- info->fColorType = SkImage::kPMColor_ColorType;
+ info->fColorType = kPMColor_SkColorType;
break;
default:
@@ -66,7 +66,7 @@ bool SkBitmapToImageInfo(const SkBitmap& bm, SkImage::Info* info) {
}
SkImage* SkNewImageFromBitmap(const SkBitmap& bm, bool canSharePixelRef) {
- SkImage::Info info;
+ SkImageInfo info;
if (!SkBitmapToImageInfo(bm, &info)) {
return NULL;
}
diff --git a/src/image/SkImagePriv.h b/src/image/SkImagePriv.h
index 5d93605566..188b16d530 100644
--- a/src/image/SkImagePriv.h
+++ b/src/image/SkImagePriv.h
@@ -13,14 +13,14 @@
class SkPicture;
-extern SkBitmap::Config SkImageInfoToBitmapConfig(const SkImage::Info&);
+extern SkBitmap::Config SkImageInfoToBitmapConfig(const SkImageInfo&);
-extern int SkImageBytesPerPixel(SkImage::ColorType);
+extern int SkImageBytesPerPixel(SkColorType);
-extern bool SkBitmapToImageInfo(const SkBitmap&, SkImage::Info*);
+extern bool SkBitmapToImageInfo(const SkBitmap&, SkImageInfo*);
// Call this if you explicitly want to use/share this pixelRef in the image
-extern SkImage* SkNewImageFromPixelRef(const SkImage::Info&, SkPixelRef*,
+extern SkImage* SkNewImageFromPixelRef(const SkImageInfo&, SkPixelRef*,
size_t rowBytes);
/**
@@ -30,7 +30,7 @@ extern SkImage* SkNewImageFromPixelRef(const SkImage::Info&, SkPixelRef*,
* is true.
*
* If the bitmap's config cannot be converted into a corresponding
- * SkImage::Info, or the bitmap's pixels cannot be accessed, this will return
+ * SkImageInfo, or the bitmap's pixels cannot be accessed, this will return
* NULL.
*/
extern SkImage* SkNewImageFromBitmap(const SkBitmap&, bool canSharePixelRef);
@@ -47,7 +47,7 @@ extern void SkImagePrivDrawPicture(SkCanvas*, SkPicture*,
*/
extern SkImage* SkNewImageFromPicture(const SkPicture*);
-static inline size_t SkImageMinRowBytes(const SkImage::Info& info) {
+static inline size_t SkImageMinRowBytes(const SkImageInfo& info) {
size_t rb = info.fWidth * SkImageBytesPerPixel(info.fColorType);
return SkAlign4(rb);
}
diff --git a/src/image/SkImage_Raster.cpp b/src/image/SkImage_Raster.cpp
index a208d83a7f..a872ae36e5 100644
--- a/src/image/SkImage_Raster.cpp
+++ b/src/image/SkImage_Raster.cpp
@@ -24,7 +24,7 @@ public:
if (info.fWidth > maxDimension || info.fHeight > maxDimension) {
return false;
}
- if ((unsigned)info.fColorType > (unsigned)kLastEnum_ColorType) {
+ if ((unsigned)info.fColorType > (unsigned)kLastEnum_SkColorType) {
return false;
}
if ((unsigned)info.fAlphaType > (unsigned)kLastEnum_SkAlphaType) {
@@ -50,7 +50,7 @@ public:
static SkImage* NewEmpty();
- SkImage_Raster(const SkImage::Info&, SkData*, size_t rb);
+ SkImage_Raster(const SkImageInfo&, SkData*, size_t rb);
virtual ~SkImage_Raster();
virtual void onDraw(SkCanvas*, SkScalar, SkScalar, const SkPaint*) SK_OVERRIDE;
@@ -58,7 +58,7 @@ public:
virtual bool getROPixels(SkBitmap*) const SK_OVERRIDE;
// exposed for SkSurface_Raster via SkNewImageFromPixelRef
- SkImage_Raster(const SkImage::Info&, SkPixelRef*, size_t rowBytes);
+ SkImage_Raster(const SkImageInfo&, SkPixelRef*, size_t rowBytes);
SkPixelRef* getPixelRef() const { return fBitmap.pixelRef(); }
@@ -116,7 +116,7 @@ bool SkImage_Raster::getROPixels(SkBitmap* dst) const {
///////////////////////////////////////////////////////////////////////////////
-SkImage* SkImage::NewRasterCopy(const SkImage::Info& info, const void* pixels, size_t rowBytes) {
+SkImage* SkImage::NewRasterCopy(const SkImageInfo& info, const void* pixels, size_t rowBytes) {
if (!SkImage_Raster::ValidArgs(info, rowBytes)) {
return NULL;
}
@@ -134,7 +134,7 @@ SkImage* SkImage::NewRasterCopy(const SkImage::Info& info, const void* pixels, s
}
-SkImage* SkImage::NewRasterData(const SkImage::Info& info, SkData* pixelData, size_t rowBytes) {
+SkImage* SkImage::NewRasterData(const SkImageInfo& info, SkData* pixelData, size_t rowBytes) {
if (!SkImage_Raster::ValidArgs(info, rowBytes)) {
return NULL;
}
@@ -156,7 +156,7 @@ SkImage* SkImage::NewRasterData(const SkImage::Info& info, SkData* pixelData, si
return SkNEW_ARGS(SkImage_Raster, (info, data, rowBytes));
}
-SkImage* SkNewImageFromPixelRef(const SkImage::Info& info, SkPixelRef* pr,
+SkImage* SkNewImageFromPixelRef(const SkImageInfo& info, SkPixelRef* pr,
size_t rowBytes) {
return SkNEW_ARGS(SkImage_Raster, (info, pr, rowBytes));
}
diff --git a/src/image/SkSurface.cpp b/src/image/SkSurface.cpp
index 1dff7ec7c8..2fd4e1042b 100644
--- a/src/image/SkSurface.cpp
+++ b/src/image/SkSurface.cpp
@@ -101,7 +101,7 @@ SkImage* SkSurface::newImageSnapshot() {
return image;
}
-SkSurface* SkSurface::newSurface(const SkImage::Info& info) {
+SkSurface* SkSurface::newSurface(const SkImageInfo& info) {
return asSB(this)->onNewSurface(info);
}
diff --git a/src/image/SkSurface_Base.h b/src/image/SkSurface_Base.h
index 6ea8d60bb7..cbae5bc5c4 100644
--- a/src/image/SkSurface_Base.h
+++ b/src/image/SkSurface_Base.h
@@ -24,7 +24,7 @@ public:
*/
virtual SkCanvas* onNewCanvas() = 0;
- virtual SkSurface* onNewSurface(const SkImage::Info&) = 0;
+ virtual SkSurface* onNewSurface(const SkImageInfo&) = 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 6c3f0ed7e7..e9049aef2e 100644
--- a/src/image/SkSurface_Gpu.cpp
+++ b/src/image/SkSurface_Gpu.cpp
@@ -14,12 +14,12 @@ class SkSurface_Gpu : public SkSurface_Base {
public:
SK_DECLARE_INST_COUNT(SkSurface_Gpu)
- SkSurface_Gpu(GrContext*, const SkImage::Info&, int sampleCount);
+ SkSurface_Gpu(GrContext*, const SkImageInfo&, int sampleCount);
SkSurface_Gpu(GrContext*, GrRenderTarget*);
virtual ~SkSurface_Gpu();
virtual SkCanvas* onNewCanvas() SK_OVERRIDE;
- virtual SkSurface* onNewSurface(const SkImage::Info&) SK_OVERRIDE;
+ virtual SkSurface* onNewSurface(const SkImageInfo&) SK_OVERRIDE;
virtual SkImage* onNewImageSnapshot() SK_OVERRIDE;
virtual void onDraw(SkCanvas*, SkScalar x, SkScalar y,
const SkPaint*) SK_OVERRIDE;
@@ -35,7 +35,7 @@ SK_DEFINE_INST_COUNT(SkSurface_Gpu)
///////////////////////////////////////////////////////////////////////////////
-SkSurface_Gpu::SkSurface_Gpu(GrContext* ctx, const SkImage::Info& info,
+SkSurface_Gpu::SkSurface_Gpu(GrContext* ctx, const SkImageInfo& info,
int sampleCount)
: INHERITED(info.fWidth, info.fHeight) {
SkBitmap::Config config = SkImageInfoToBitmapConfig(info);
@@ -64,7 +64,7 @@ SkCanvas* SkSurface_Gpu::onNewCanvas() {
return SkNEW_ARGS(SkCanvas, (fDevice));
}
-SkSurface* SkSurface_Gpu::onNewSurface(const SkImage::Info& info) {
+SkSurface* SkSurface_Gpu::onNewSurface(const SkImageInfo& info) {
GrRenderTarget* rt = fDevice->accessRenderTarget();
int sampleCount = rt->numSamples();
return SkSurface::NewRenderTarget(fDevice->context(), info, sampleCount);
@@ -113,7 +113,7 @@ SkSurface* SkSurface::NewRenderTargetDirect(GrContext* ctx,
return SkNEW_ARGS(SkSurface_Gpu, (ctx, target));
}
-SkSurface* SkSurface::NewRenderTarget(GrContext* ctx, const SkImage::Info& info, int sampleCount) {
+SkSurface* SkSurface::NewRenderTarget(GrContext* ctx, const SkImageInfo& info, int sampleCount) {
if (NULL == ctx) {
return NULL;
}
diff --git a/src/image/SkSurface_Picture.cpp b/src/image/SkSurface_Picture.cpp
index 915530c8dc..8cfe6e87d5 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&) SK_OVERRIDE;
+ virtual SkSurface* onNewSurface(const SkImageInfo&) SK_OVERRIDE;
virtual SkImage* onNewImageSnapshot() SK_OVERRIDE;
virtual void onDraw(SkCanvas*, SkScalar x, SkScalar y,
const SkPaint*) SK_OVERRIDE;
@@ -51,7 +51,7 @@ SkCanvas* SkSurface_Picture::onNewCanvas() {
return canvas;
}
-SkSurface* SkSurface_Picture::onNewSurface(const SkImage::Info& info) {
+SkSurface* SkSurface_Picture::onNewSurface(const SkImageInfo& info) {
return SkSurface::NewPicture(info.fWidth, info.fHeight);
}
@@ -59,9 +59,9 @@ SkImage* SkSurface_Picture::onNewImageSnapshot() {
if (fPicture) {
return SkNewImageFromPicture(fPicture);
} else {
- SkImage::Info info;
+ SkImageInfo info;
info.fWidth = info.fHeight = 0;
- info.fColorType = SkImage::kPMColor_ColorType;
+ info.fColorType = kPMColor_SkColorType;
info.fAlphaType = kOpaque_SkAlphaType;
return SkImage::NewRasterCopy(info, NULL, 0);
}
diff --git a/src/image/SkSurface_Raster.cpp b/src/image/SkSurface_Raster.cpp
index 5beabf71cc..27db504df6 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&, size_t rb = kIgnoreRowBytesValue);
+ static bool Valid(const SkImageInfo&, size_t rb = kIgnoreRowBytesValue);
- SkSurface_Raster(const SkImage::Info&, void*, size_t rb);
- SkSurface_Raster(const SkImage::Info&, SkPixelRef*, size_t rb);
+ SkSurface_Raster(const SkImageInfo&, void*, size_t rb);
+ SkSurface_Raster(const SkImageInfo&, SkPixelRef*, size_t rb);
virtual SkCanvas* onNewCanvas() SK_OVERRIDE;
- virtual SkSurface* onNewSurface(const SkImage::Info&) SK_OVERRIDE;
+ virtual SkSurface* onNewSurface(const SkImageInfo&) SK_OVERRIDE;
virtual SkImage* onNewImageSnapshot() SK_OVERRIDE;
virtual void onDraw(SkCanvas*, SkScalar x, SkScalar y,
const SkPaint*) SK_OVERRIDE;
@@ -36,7 +36,7 @@ private:
///////////////////////////////////////////////////////////////////////////////
-bool SkSurface_Raster::Valid(const SkImage::Info& info, size_t rowBytes) {
+bool SkSurface_Raster::Valid(const SkImageInfo& info, size_t rowBytes) {
static const size_t kMaxTotalSize = SK_MaxS32;
SkBitmap::Config config = SkImageInfoToBitmapConfig(info);
@@ -80,7 +80,7 @@ bool SkSurface_Raster::Valid(const SkImage::Info& info, size_t rowBytes) {
return true;
}
-SkSurface_Raster::SkSurface_Raster(const SkImage::Info& info, void* pixels, size_t rb)
+SkSurface_Raster::SkSurface_Raster(const SkImageInfo& info, void* pixels, size_t rb)
: INHERITED(info.fWidth, info.fHeight) {
SkBitmap::Config config = SkImageInfoToBitmapConfig(info);
fBitmap.setConfig(config, info.fWidth, info.fHeight, rb, info.fAlphaType);
@@ -88,7 +88,7 @@ SkSurface_Raster::SkSurface_Raster(const SkImage::Info& info, void* pixels, size
fWeOwnThePixels = false; // We are "Direct"
}
-SkSurface_Raster::SkSurface_Raster(const SkImage::Info& info, SkPixelRef* pr, size_t rb)
+SkSurface_Raster::SkSurface_Raster(const SkImageInfo& info, SkPixelRef* pr, size_t rb)
: INHERITED(info.fWidth, info.fHeight) {
SkBitmap::Config config = SkImageInfoToBitmapConfig(info);
fBitmap.setConfig(config, info.fWidth, info.fHeight, rb, info.fAlphaType);
@@ -104,7 +104,7 @@ SkCanvas* SkSurface_Raster::onNewCanvas() {
return SkNEW_ARGS(SkCanvas, (fBitmap));
}
-SkSurface* SkSurface_Raster::onNewSurface(const SkImage::Info& info) {
+SkSurface* SkSurface_Raster::onNewSurface(const SkImageInfo& info) {
return SkSurface::NewRaster(info);
}
@@ -139,7 +139,7 @@ void SkSurface_Raster::onCopyOnWrite(ContentChangeMode mode) {
///////////////////////////////////////////////////////////////////////////////
-SkSurface* SkSurface::NewRasterDirect(const SkImage::Info& info, void* pixels, size_t rowBytes) {
+SkSurface* SkSurface::NewRasterDirect(const SkImageInfo& info, void* pixels, size_t rowBytes) {
if (!SkSurface_Raster::Valid(info, rowBytes)) {
return NULL;
}
@@ -150,7 +150,7 @@ SkSurface* SkSurface::NewRasterDirect(const SkImage::Info& info, void* pixels, s
return SkNEW_ARGS(SkSurface_Raster, (info, pixels, rowBytes));
}
-SkSurface* SkSurface::NewRaster(const SkImage::Info& info) {
+SkSurface* SkSurface::NewRaster(const SkImageInfo& info) {
if (!SkSurface_Raster::Valid(info)) {
return NULL;
}
diff --git a/src/images/SkImageDecoder.cpp b/src/images/SkImageDecoder.cpp
index 74c80bc73f..1ba9365255 100644
--- a/src/images/SkImageDecoder.cpp
+++ b/src/images/SkImageDecoder.cpp
@@ -403,7 +403,7 @@ static bool decode_pixels_to_8888(SkImageDecoder* decoder, SkStream* stream,
}
bool SkImageDecoder::DecodeMemoryToTarget(const void* buffer, size_t size,
- SkImage::Info* info,
+ SkImageInfo* info,
const SkBitmapFactory::Target* target) {
// FIXME: Just to get this working, implement in terms of existing
// ImageDecoder calls.
diff --git a/src/lazy/SkBitmapFactory.cpp b/src/lazy/SkBitmapFactory.cpp
index 5464851402..1bbb6f0de7 100644
--- a/src/lazy/SkBitmapFactory.cpp
+++ b/src/lazy/SkBitmapFactory.cpp
@@ -48,7 +48,7 @@ bool SkBitmapFactory::installPixelRef(SkData* data, SkBitmap* dst) {
return false;
}
- SkImage::Info info;
+ SkImageInfo info;
if (!fDecodeProc(data->data(), data->size(), &info, NULL)) {
return false;
}
diff --git a/src/lazy/SkLazyPixelRef.cpp b/src/lazy/SkLazyPixelRef.cpp
index 59df15fc42..c2ca041b41 100644
--- a/src/lazy/SkLazyPixelRef.cpp
+++ b/src/lazy/SkLazyPixelRef.cpp
@@ -68,7 +68,7 @@ SkLazyPixelRef::~SkLazyPixelRef() {
fImageCache->unref();
}
-static size_t ComputeMinRowBytesAndSize(const SkImage::Info& info, size_t* rowBytes) {
+static size_t ComputeMinRowBytesAndSize(const SkImageInfo& info, size_t* rowBytes) {
*rowBytes = SkImageMinRowBytes(info);
Sk64 safeSize;
@@ -80,9 +80,9 @@ static size_t ComputeMinRowBytesAndSize(const SkImage::Info& info, size_t* rowBy
return safeSize.is32() ? safeSize.get32() : 0;
}
-const SkImage::Info* SkLazyPixelRef::getCachedInfo() {
+const SkImageInfo* SkLazyPixelRef::getCachedInfo() {
if (fLazilyCachedInfo.fWidth < 0) {
- SkImage::Info info;
+ SkImageInfo info;
fErrorInDecoding = !fDecodeProc(fData->data(), fData->size(), &info, NULL);
if (fErrorInDecoding) {
return NULL;
@@ -94,7 +94,7 @@ const SkImage::Info* SkLazyPixelRef::getCachedInfo() {
/**
Returns bitmap->getPixels() on success; NULL on failure */
-static void* decode_into_bitmap(SkImage::Info* info,
+static void* decode_into_bitmap(SkImageInfo* info,
SkBitmapFactory::DecodeProc decodeProc,
size_t* rowBytes,
SkData* data,
@@ -122,7 +122,7 @@ void* SkLazyPixelRef::lockScaledImageCachePixels() {
SkASSERT(!fErrorInDecoding);
SkASSERT(NULL == fImageCache);
SkBitmap bitmap;
- const SkImage::Info* info = this->getCachedInfo();
+ const SkImageInfo* info = this->getCachedInfo();
if (info == NULL) {
return NULL;
}
@@ -147,7 +147,7 @@ void* SkLazyPixelRef::lockScaledImageCachePixels() {
return pixels;
} else {
// Cache has been purged, must re-decode.
- void* pixels = decode_into_bitmap(const_cast<SkImage::Info*>(info),
+ void* pixels = decode_into_bitmap(const_cast<SkImageInfo*>(info),
fDecodeProc, &fRowBytes, fData,
&bitmap);
if (NULL == pixels) {
@@ -204,7 +204,7 @@ void* SkLazyPixelRef::lockImageCachePixels() {
SkASSERT(fData != NULL && fData->size() > 0);
if (NULL == target.fAddr) {
- const SkImage::Info* info = this->getCachedInfo();
+ const SkImageInfo* info = this->getCachedInfo();
if (NULL == info) {
SkASSERT(SkImageCache::UNINITIALIZED_ID == fCacheId);
return NULL;
@@ -262,7 +262,7 @@ SkData* SkLazyPixelRef::onRefEncodedData() {
return fData;
}
-static bool init_from_info(SkBitmap* bm, const SkImage::Info& info,
+static bool init_from_info(SkBitmap* bm, const SkImageInfo& info,
size_t rowBytes) {
SkBitmap::Config config = SkImageInfoToBitmapConfig(info);
if (SkBitmap::kNo_Config == config) {
@@ -284,7 +284,7 @@ bool SkLazyPixelRef::onDecodeInto(int pow2, SkBitmap* bitmap) {
return false;
}
- SkImage::Info info;
+ SkImageInfo info;
// Determine the size of the image in order to determine how much memory to allocate.
// FIXME: As an optimization, only do this part once.
fErrorInDecoding = !fDecodeProc(fData->data(), fData->size(), &info, NULL);
diff --git a/src/lazy/SkLazyPixelRef.h b/src/lazy/SkLazyPixelRef.h
index c7fbd7be65..f8a16d1689 100644
--- a/src/lazy/SkLazyPixelRef.h
+++ b/src/lazy/SkLazyPixelRef.h
@@ -77,7 +77,7 @@ private:
SkScaledImageCache::ID* fScaledCacheId;
};
size_t fRowBytes;
- SkImage::Info fLazilyCachedInfo;
+ SkImageInfo fLazilyCachedInfo;
#if LAZY_CACHE_STATS
static int32_t gCacheHits;
diff --git a/src/ports/SkImageDecoder_empty.cpp b/src/ports/SkImageDecoder_empty.cpp
index ff2fa02f2e..8a45dfac55 100644
--- a/src/ports/SkImageDecoder_empty.cpp
+++ b/src/ports/SkImageDecoder_empty.cpp
@@ -84,7 +84,7 @@ SkBitmap::Allocator* SkImageDecoder::setAllocator(SkBitmap::Allocator*) {
void SkImageDecoder::setSampleSize(int) {}
-bool SkImageDecoder::DecodeMemoryToTarget(const void*, size_t, SkImage::Info*,
+bool SkImageDecoder::DecodeMemoryToTarget(const void*, size_t, SkImageInfo*,
const SkBitmapFactory::Target*) {
return false;
}
diff --git a/tests/CachedDecodingPixelRefTest.cpp b/tests/CachedDecodingPixelRefTest.cpp
index e3b249923e..08d492cda1 100644
--- a/tests/CachedDecodingPixelRefTest.cpp
+++ b/tests/CachedDecodingPixelRefTest.cpp
@@ -55,7 +55,7 @@ static SkData* create_data_from_bitmap(const SkBitmap& bm,
static bool simple_bitmap_factory(SkBitmapFactory::DecodeProc proc,
SkData* data,
SkBitmap* dst) {
- SkImage::Info info;
+ SkImageInfo info;
if (!proc(data->data(), data->size(), &info, NULL)) {
return false;
}
diff --git a/tests/DeferredCanvasTest.cpp b/tests/DeferredCanvasTest.cpp
index 537a810aa9..a9679a339d 100644
--- a/tests/DeferredCanvasTest.cpp
+++ b/tests/DeferredCanvasTest.cpp
@@ -57,7 +57,7 @@ public:
return SkNEW_ARGS(SkCanvas, (fBitmap));
}
- virtual SkSurface* onNewSurface(const SkImage::Info&) SK_OVERRIDE {
+ virtual SkSurface* onNewSurface(const SkImageInfo&) SK_OVERRIDE {
return NULL;
}
@@ -692,10 +692,10 @@ static PixelPtr getSurfacePixelPtr(SkSurface* surface, bool useGpu) {
}
static void TestDeferredCanvasSurface(skiatest::Reporter* reporter, GrContextFactory* factory) {
- SkImage::Info imageSpec = {
+ SkImageInfo imageSpec = {
10, // width
10, // height
- SkImage::kPMColor_ColorType,
+ kPMColor_SkColorType,
kPremul_SkAlphaType
};
SkSurface* surface;
@@ -759,10 +759,10 @@ static void TestDeferredCanvasSurface(skiatest::Reporter* reporter, GrContextFac
}
static void TestDeferredCanvasSetSurface(skiatest::Reporter* reporter, GrContextFactory* factory) {
- SkImage::Info imageSpec = {
+ SkImageInfo imageSpec = {
10, // width
10, // height
- SkImage::kPMColor_ColorType,
+ kPMColor_SkColorType,
kPremul_SkAlphaType
};
SkSurface* surface;
diff --git a/tests/DrawBitmapRectTest.cpp b/tests/DrawBitmapRectTest.cpp
index 119ad2f652..ab667fdfae 100644
--- a/tests/DrawBitmapRectTest.cpp
+++ b/tests/DrawBitmapRectTest.cpp
@@ -19,11 +19,11 @@
#include "SkLruImageCache.h"
// A BitmapFactory that always fails when asked to return pixels.
-static bool FailureDecoder(const void* data, size_t length, SkImage::Info* info,
+static bool FailureDecoder(const void* data, size_t length, SkImageInfo* info,
const SkBitmapFactory::Target* target) {
if (info) {
info->fWidth = info->fHeight = 100;
- info->fColorType = SkImage::kRGBA_8888_ColorType;
+ info->fColorType = kRGBA_8888_SkColorType;
info->fAlphaType = kPremul_SkAlphaType;
}
// this will deliberately return false if they are asking us to decode
diff --git a/tests/SurfaceTest.cpp b/tests/SurfaceTest.cpp
index 61c1e2d6dd..1d713e780b 100644
--- a/tests/SurfaceTest.cpp
+++ b/tests/SurfaceTest.cpp
@@ -24,10 +24,10 @@ enum SurfaceType {
};
static SkSurface* createSurface(SurfaceType surfaceType, GrContext* context) {
- static const SkImage::Info imageSpec = {
+ static const SkImageInfo imageSpec = {
10, // width
10, // height
- SkImage::kPMColor_ColorType,
+ kPMColor_SkColorType,
kPremul_SkAlphaType
};
diff --git a/tools/LazyDecodeBitmap.cpp b/tools/LazyDecodeBitmap.cpp
index 2367154111..c0b7eea724 100644
--- a/tools/LazyDecodeBitmap.cpp
+++ b/tools/LazyDecodeBitmap.cpp
@@ -40,7 +40,7 @@ public:
SkSafeUnref(fPurgeableImageCache);
}
- virtual SkImageCache* selectCache(const SkImage::Info& info) SK_OVERRIDE {
+ virtual SkImageCache* selectCache(const SkImageInfo& info) SK_OVERRIDE {
if (info.fWidth * info.fHeight > 32 * 1024 && fPurgeableImageCache != NULL) {
return fPurgeableImageCache;
}