remove unneeded flags (have been purged from chrome and android)
TBR= Author: reed@google.com Review URL: https://codereview.chromium.org/372793003
This commit is contained in:
parent
9a9eae21ed
commit
060c41a499
@ -96,19 +96,6 @@ public:
|
||||
SkColorType colorType() const { return fInfo.fColorType; }
|
||||
SkAlphaType alphaType() const { return fInfo.fAlphaType; }
|
||||
|
||||
#ifdef SK_SUPPORT_LEGACY_ASIMAGEINFO
|
||||
bool asImageInfo(SkImageInfo* info) const {
|
||||
// compatibility: return false for kUnknown
|
||||
if (kUnknown_SkColorType == this->colorType()) {
|
||||
return false;
|
||||
}
|
||||
if (info) {
|
||||
*info = this->info();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Return the number of bytes per pixel based on the colortype. If the colortype is
|
||||
* kUnknown_SkColorType, then 0 is returned.
|
||||
@ -229,28 +216,6 @@ public:
|
||||
*/
|
||||
void reset();
|
||||
|
||||
#ifdef SK_SUPPORT_LEGACY_COMPUTE_CONFIG_SIZE
|
||||
/** Given a config and a width, this computes the optimal rowBytes value. This is called automatically
|
||||
if you pass 0 for rowBytes to setConfig().
|
||||
*/
|
||||
static size_t ComputeRowBytes(Config c, int width);
|
||||
|
||||
/** Return the bytes-per-pixel for the specified config. If the config is
|
||||
not at least 1-byte per pixel, return 0, including for kNo_Config.
|
||||
*/
|
||||
static int ComputeBytesPerPixel(Config c);
|
||||
|
||||
/** Return the shift-per-pixel for the specified config. If the config is
|
||||
not at least 1-byte per pixel, return 0, including for kNo_Config.
|
||||
*/
|
||||
static int ComputeShiftPerPixel(Config c) {
|
||||
return ComputeBytesPerPixel(c) >> 1;
|
||||
}
|
||||
|
||||
static int64_t ComputeSize64(Config, int width, int height);
|
||||
static size_t ComputeSize(Config, int width, int height);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* This will brute-force return true if all of the pixels in the bitmap
|
||||
* are opaque. If it fails to read the pixels, or encounters an error,
|
||||
@ -268,27 +233,8 @@ public:
|
||||
void getBounds(SkRect* bounds) const;
|
||||
void getBounds(SkIRect* bounds) const;
|
||||
|
||||
#ifdef SK_SUPPORT_LEGACY_SETCONFIG
|
||||
/** Set the bitmap's config and dimensions. If rowBytes is 0, then
|
||||
ComputeRowBytes() is called to compute the optimal value. This resets
|
||||
any pixel/colortable ownership, just like reset().
|
||||
*/
|
||||
bool setConfig(Config, int width, int height, size_t rowBytes, SkAlphaType);
|
||||
|
||||
bool setConfig(Config config, int width, int height, size_t rowBytes = 0) {
|
||||
return this->setConfig(config, width, height, rowBytes,
|
||||
kPremul_SkAlphaType);
|
||||
}
|
||||
#endif
|
||||
|
||||
bool setInfo(const SkImageInfo&, size_t rowBytes = 0);
|
||||
|
||||
#ifdef SK_SUPPORT_LEGACY_SETCONFIG_INFO
|
||||
bool setConfig(const SkImageInfo& info, size_t rowBytes = 0) {
|
||||
return this->setInfo(info, rowBytes);
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Allocate the bitmap's pixels to match the requested image info. If the Factory
|
||||
* is non-null, call it to allcoate the pixelref. If the ImageInfo requires
|
||||
|
@ -97,48 +97,6 @@ SkBitmap::Config SkBitmap::config() const {
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef SK_SUPPORT_LEGACY_COMPUTE_CONFIG_SIZE
|
||||
int SkBitmap::ComputeBytesPerPixel(SkBitmap::Config config) {
|
||||
int bpp;
|
||||
switch (config) {
|
||||
case kNo_Config:
|
||||
bpp = 0; // not applicable
|
||||
break;
|
||||
case kA8_Config:
|
||||
case kIndex8_Config:
|
||||
bpp = 1;
|
||||
break;
|
||||
case kRGB_565_Config:
|
||||
case kARGB_4444_Config:
|
||||
bpp = 2;
|
||||
break;
|
||||
case kARGB_8888_Config:
|
||||
bpp = 4;
|
||||
break;
|
||||
default:
|
||||
SkDEBUGFAIL("unknown config");
|
||||
bpp = 0; // error
|
||||
break;
|
||||
}
|
||||
return bpp;
|
||||
}
|
||||
|
||||
size_t SkBitmap::ComputeRowBytes(Config c, int width) {
|
||||
return SkColorTypeMinRowBytes(SkBitmapConfigToColorType(c), width);
|
||||
}
|
||||
|
||||
int64_t SkBitmap::ComputeSize64(Config config, int width, int height) {
|
||||
SkColorType ct = SkBitmapConfigToColorType(config);
|
||||
int64_t rowBytes = sk_64_mul(SkColorTypeBytesPerPixel(ct), width);
|
||||
return rowBytes * height;
|
||||
}
|
||||
|
||||
size_t SkBitmap::ComputeSize(Config c, int width, int height) {
|
||||
int64_t size = SkBitmap::ComputeSize64(c, width, height);
|
||||
return sk_64_isS32(size) ? sk_64_asS32(size) : 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
void SkBitmap::getBounds(SkRect* bounds) const {
|
||||
SkASSERT(bounds);
|
||||
bounds->set(0, 0,
|
||||
@ -188,14 +146,6 @@ bool SkBitmap::setInfo(const SkImageInfo& origInfo, size_t rowBytes) {
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef SK_SUPPORT_LEGACY_SETCONFIG
|
||||
bool SkBitmap::setConfig(Config config, int width, int height, size_t rowBytes,
|
||||
SkAlphaType alphaType) {
|
||||
SkColorType ct = SkBitmapConfigToColorType(config);
|
||||
return this->setInfo(SkImageInfo::Make(width, height, ct, alphaType), rowBytes);
|
||||
}
|
||||
#endif
|
||||
|
||||
bool SkBitmap::setAlphaType(SkAlphaType alphaType) {
|
||||
if (!SkColorTypeValidateAlphaType(fInfo.fColorType, alphaType, &alphaType)) {
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user