Revert "Revert "add SK_ATTR_DEPRECATED -- will need to disable for chrome, since it triggers a warning""
This reverts commit 1e787c38fa71f2a21fd728f1b1d620b9b09b0d3d. BUG= Review URL: https://codereview.chromium.org/54603004 git-svn-id: http://skia.googlecode.com/svn/trunk@12057 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
parent
6fcbfcead5
commit
4469938e92
@ -39,18 +39,20 @@ static void draw_into_bitmap(const SkBitmap& bm) {
|
||||
*/
|
||||
|
||||
class BitmapRectBench : public SkBenchmark {
|
||||
SkBitmap fBitmap;
|
||||
bool fDoFilter;
|
||||
bool fSlightMatrix;
|
||||
uint8_t fAlpha;
|
||||
SkString fName;
|
||||
SkRect fSrcR, fDstR;
|
||||
SkBitmap fBitmap;
|
||||
bool fSlightMatrix;
|
||||
uint8_t fAlpha;
|
||||
SkPaint::FilterLevel fFilterLevel;
|
||||
SkString fName;
|
||||
SkRect fSrcR, fDstR;
|
||||
|
||||
static const int kWidth = 128;
|
||||
static const int kHeight = 128;
|
||||
public:
|
||||
BitmapRectBench(U8CPU alpha, bool doFilter, bool slightMatrix) {
|
||||
BitmapRectBench(U8CPU alpha, SkPaint::FilterLevel filterLevel,
|
||||
bool slightMatrix) {
|
||||
fAlpha = SkToU8(alpha);
|
||||
fDoFilter = doFilter;
|
||||
fFilterLevel = filterLevel;
|
||||
fSlightMatrix = slightMatrix;
|
||||
|
||||
fBitmap.setConfig(SkBitmap::kARGB_8888_Config, kWidth, kHeight);
|
||||
@ -59,7 +61,8 @@ public:
|
||||
protected:
|
||||
virtual const char* onGetName() SK_OVERRIDE {
|
||||
fName.printf("bitmaprect_%02X_%sfilter_%s",
|
||||
fAlpha, fDoFilter ? "" : "no",
|
||||
fAlpha,
|
||||
SkPaint::kNone_FilterLevel == fFilterLevel ? "no" : "",
|
||||
fSlightMatrix ? "trans" : "identity");
|
||||
return fName.c_str();
|
||||
}
|
||||
@ -89,7 +92,7 @@ protected:
|
||||
|
||||
SkPaint paint;
|
||||
this->setupPaint(&paint);
|
||||
paint.setFilterBitmap(fDoFilter);
|
||||
paint.setFilterLevel(fFilterLevel);
|
||||
paint.setAlpha(fAlpha);
|
||||
|
||||
for (int i = 0; i < this->getLoops(); i++) {
|
||||
@ -101,10 +104,10 @@ private:
|
||||
typedef SkBenchmark INHERITED;
|
||||
};
|
||||
|
||||
DEF_BENCH(return new BitmapRectBench(0xFF, false, false))
|
||||
DEF_BENCH(return new BitmapRectBench(0x80, false, false))
|
||||
DEF_BENCH(return new BitmapRectBench(0xFF, true, false))
|
||||
DEF_BENCH(return new BitmapRectBench(0x80, true, false))
|
||||
DEF_BENCH(return new BitmapRectBench(0xFF, SkPaint::kNone_FilterLevel, false))
|
||||
DEF_BENCH(return new BitmapRectBench(0x80, SkPaint::kNone_FilterLevel, false))
|
||||
DEF_BENCH(return new BitmapRectBench(0xFF, SkPaint::kLow_FilterLevel, false))
|
||||
DEF_BENCH(return new BitmapRectBench(0x80, SkPaint::kLow_FilterLevel, false))
|
||||
|
||||
DEF_BENCH(return new BitmapRectBench(0xFF, false, true))
|
||||
DEF_BENCH(return new BitmapRectBench(0xFF, true, true))
|
||||
DEF_BENCH(return new BitmapRectBench(0xFF, SkPaint::kNone_FilterLevel, true))
|
||||
DEF_BENCH(return new BitmapRectBench(0xFF, SkPaint::kLow_FilterLevel, true))
|
||||
|
@ -134,11 +134,11 @@ protected:
|
||||
|
||||
SkPaint p;
|
||||
p.setColor(0xFF000000);
|
||||
p.setFilterBitmap(true);
|
||||
p.setFilterLevel(SkPaint::kLow_FilterLevel);
|
||||
|
||||
SkPaint p2; // for drawVertices path
|
||||
p2.setColor(0xFF000000);
|
||||
p2.setFilterBitmap(true);
|
||||
p2.setFilterLevel(SkPaint::kLow_FilterLevel);
|
||||
p2.setShader(SkShader::CreateBitmapShader(fAtlas,
|
||||
SkShader::kClamp_TileMode,
|
||||
SkShader::kClamp_TileMode))->unref();
|
||||
|
@ -13,7 +13,7 @@
|
||||
class Matrix44Bench : public SkBenchmark {
|
||||
SkString fName;
|
||||
public:
|
||||
Matrix44Bench(const char name[]) {
|
||||
Matrix44Bench(const char name[]) {
|
||||
fName.printf("matrix44_%s", name);
|
||||
fIsRendering = false;
|
||||
}
|
||||
@ -39,7 +39,12 @@ private:
|
||||
|
||||
class EqualsMatrix44Bench : public Matrix44Bench {
|
||||
public:
|
||||
EqualsMatrix44Bench() : INHERITED("equals") {
|
||||
EqualsMatrix44Bench()
|
||||
: INHERITED("equals")
|
||||
, fM0(SkMatrix44::kIdentity_Constructor)
|
||||
, fM1(SkMatrix44::kIdentity_Constructor)
|
||||
, fM2(SkMatrix44::kIdentity_Constructor)
|
||||
{
|
||||
fM1.set(0, 0, 0);
|
||||
fM2.set(3, 3, 0);
|
||||
}
|
||||
@ -58,7 +63,10 @@ private:
|
||||
|
||||
class SetIdentityMatrix44Bench : public Matrix44Bench {
|
||||
public:
|
||||
SetIdentityMatrix44Bench() : INHERITED("setidentity") {
|
||||
SetIdentityMatrix44Bench()
|
||||
: INHERITED("setidentity")
|
||||
, mat(SkMatrix44::kIdentity_Constructor)
|
||||
{
|
||||
double rowMajor[16] =
|
||||
{ 1, 2, 3, 4,
|
||||
5, 6, 7, 8,
|
||||
@ -79,7 +87,10 @@ private:
|
||||
|
||||
class PreScaleMatrix44Bench : public Matrix44Bench {
|
||||
public:
|
||||
PreScaleMatrix44Bench() : INHERITED("prescale") {
|
||||
PreScaleMatrix44Bench()
|
||||
: INHERITED("prescale")
|
||||
, fM0(SkMatrix44::kUninitialized_Constructor)
|
||||
{
|
||||
fX = fY = fZ = SkDoubleToMScalar(1.5);
|
||||
}
|
||||
protected:
|
||||
@ -97,7 +108,11 @@ private:
|
||||
|
||||
class InvertMatrix44Bench : public Matrix44Bench {
|
||||
public:
|
||||
InvertMatrix44Bench() : INHERITED("invert") {
|
||||
InvertMatrix44Bench()
|
||||
: INHERITED("invert")
|
||||
, fM0(SkMatrix44::kUninitialized_Constructor)
|
||||
, fM1(SkMatrix44::kUninitialized_Constructor)
|
||||
{
|
||||
fM0.set(0, 0, -1.1);
|
||||
fM0.set(0, 1, 2.1);
|
||||
fM0.set(0, 2, -3.1);
|
||||
@ -128,7 +143,11 @@ private:
|
||||
|
||||
class InvertAffineMatrix44Bench : public Matrix44Bench {
|
||||
public:
|
||||
InvertAffineMatrix44Bench() : INHERITED("invertaffine") {
|
||||
InvertAffineMatrix44Bench()
|
||||
: INHERITED("invertaffine")
|
||||
, fM0(SkMatrix44::kIdentity_Constructor)
|
||||
, fM1(SkMatrix44::kUninitialized_Constructor)
|
||||
{
|
||||
fM0.set(0, 0, -1.1);
|
||||
fM0.set(0, 1, 2.1);
|
||||
fM0.set(0, 2, -3.1);
|
||||
@ -156,7 +175,11 @@ private:
|
||||
|
||||
class InvertScaleTranslateMatrix44Bench : public Matrix44Bench {
|
||||
public:
|
||||
InvertScaleTranslateMatrix44Bench() : INHERITED("invertscaletranslate") {
|
||||
InvertScaleTranslateMatrix44Bench()
|
||||
: INHERITED("invertscaletranslate")
|
||||
, fM0(SkMatrix44::kIdentity_Constructor)
|
||||
, fM1(SkMatrix44::kUninitialized_Constructor)
|
||||
{
|
||||
fM0.set(0, 0, -1.1);
|
||||
fM0.set(0, 3, 4.1);
|
||||
|
||||
@ -179,7 +202,11 @@ private:
|
||||
|
||||
class InvertTranslateMatrix44Bench : public Matrix44Bench {
|
||||
public:
|
||||
InvertTranslateMatrix44Bench() : INHERITED("inverttranslate") {
|
||||
InvertTranslateMatrix44Bench()
|
||||
: INHERITED("inverttranslate")
|
||||
, fM0(SkMatrix44::kIdentity_Constructor)
|
||||
, fM1(SkMatrix44::kUninitialized_Constructor)
|
||||
{
|
||||
fM0.set(0, 3, 4.1);
|
||||
fM0.set(1, 3, 8.1);
|
||||
fM0.set(2, 3, -12.1);
|
||||
@ -197,7 +224,10 @@ private:
|
||||
|
||||
class PostScaleMatrix44Bench : public Matrix44Bench {
|
||||
public:
|
||||
PostScaleMatrix44Bench() : INHERITED("postscale") {
|
||||
PostScaleMatrix44Bench()
|
||||
: INHERITED("postscale")
|
||||
, fM0(SkMatrix44::kUninitialized_Constructor)
|
||||
{
|
||||
fX = fY = fZ = SkDoubleToMScalar(1.5);
|
||||
}
|
||||
protected:
|
||||
@ -215,7 +245,12 @@ private:
|
||||
|
||||
class SetConcatMatrix44Bench : public Matrix44Bench {
|
||||
public:
|
||||
SetConcatMatrix44Bench() : INHERITED("setconcat") {
|
||||
SetConcatMatrix44Bench()
|
||||
: INHERITED("setconcat")
|
||||
, fM0(SkMatrix44::kUninitialized_Constructor)
|
||||
, fM1(SkMatrix44::kUninitialized_Constructor)
|
||||
, fM2(SkMatrix44::kUninitialized_Constructor)
|
||||
{
|
||||
fX = fY = fZ = SkDoubleToMScalar(1.5);
|
||||
fM1.setScale(fX, fY, fZ);
|
||||
fM2.setTranslate(fX, fY, fZ);
|
||||
@ -235,7 +270,10 @@ private:
|
||||
|
||||
class GetTypeMatrix44Bench : public Matrix44Bench {
|
||||
public:
|
||||
GetTypeMatrix44Bench() : INHERITED("gettype") {}
|
||||
GetTypeMatrix44Bench()
|
||||
: INHERITED("gettype")
|
||||
, fMatrix(SkMatrix44::kIdentity_Constructor)
|
||||
{}
|
||||
protected:
|
||||
// Putting random generation of the matrix inside performTest()
|
||||
// would help us avoid anomalous runs, but takes up 25% or
|
||||
|
@ -19,6 +19,7 @@ SkString SkBenchmark::gResourcePath;
|
||||
SkBenchmark::SkBenchmark() {
|
||||
fForceAlpha = 0xFF;
|
||||
fForceAA = true;
|
||||
fForceFilter = false;
|
||||
fDither = SkTriState::kDefault;
|
||||
fIsRendering = true;
|
||||
fOrMask = fClearMask = 0;
|
||||
@ -48,7 +49,8 @@ void SkBenchmark::postDraw() {
|
||||
void SkBenchmark::setupPaint(SkPaint* paint) {
|
||||
paint->setAlpha(fForceAlpha);
|
||||
paint->setAntiAlias(fForceAA);
|
||||
paint->setFilterBitmap(fForceFilter);
|
||||
paint->setFilterLevel(fForceFilter ? SkPaint::kLow_FilterLevel
|
||||
: SkPaint::kNone_FilterLevel);
|
||||
|
||||
paint->setFlags((paint->getFlags() & ~fClearMask) | fOrMask);
|
||||
|
||||
|
@ -85,7 +85,8 @@ protected:
|
||||
virtual void onDraw(SkCanvas* canvas) {
|
||||
SkPaint paint(fPaint);
|
||||
this->setupPaint(&paint);
|
||||
paint.setFilterBitmap(fDoFilter);
|
||||
paint.setFilterLevel(fDoFilter ? SkPaint::kLow_FilterLevel
|
||||
: SkPaint::kNone_FilterLevel);
|
||||
if (fDoTrans) {
|
||||
paint.setColor(SkColorSetARGBMacro(0x80, 0xFF, 0xFF, 0xFF));
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ protected:
|
||||
SkSize scale = SkSize::Make(sk32, sk32);
|
||||
canvas->save();
|
||||
canvas->scale(sk32, sk32);
|
||||
bilinearPaint.setFilterBitmap(true);
|
||||
bilinearPaint.setFilterLevel(SkPaint::kLow_FilterLevel);
|
||||
canvas->drawBitmap(fCheckerboard, 0, 0, &bilinearPaint);
|
||||
canvas->restore();
|
||||
SkAutoTUnref<SkImageFilter> bicubic(SkBicubicImageFilter::CreateMitchell(scale));
|
||||
|
@ -80,7 +80,7 @@ protected:
|
||||
shader->setLocalMatrix(s);
|
||||
paint.setShader(shader)->unref();
|
||||
paint.setAntiAlias(false);
|
||||
paint.setFilterBitmap(true);
|
||||
paint.setFilterLevel(SkPaint::kLow_FilterLevel);
|
||||
rect.setLTRB(pt.fX - small, pt.fY - small,
|
||||
pt.fX + small, pt.fY + small);
|
||||
canvas->drawRect(rect, paint);
|
||||
|
@ -39,7 +39,7 @@ static SkScalar draw_bm(SkCanvas* canvas, const SkBitmap& bm,
|
||||
static SkScalar draw_set(SkCanvas* c, const SkBitmap& bm, SkScalar x,
|
||||
SkPaint* p) {
|
||||
x += draw_bm(c, bm, x, 0, p);
|
||||
p->setFilterBitmap(true);
|
||||
p->setFilterLevel(SkPaint::kLow_FilterLevel);
|
||||
x += draw_bm(c, bm, x, 0, p);
|
||||
p->setDither(true);
|
||||
return x + draw_bm(c, bm, x, 0, p);
|
||||
|
@ -81,7 +81,7 @@ protected:
|
||||
// SkGpuDevice::drawPath() -> SkGpuDevice::drawWithMaskFilter()
|
||||
SkPaint paint;
|
||||
|
||||
paint.setFilterBitmap(true);
|
||||
paint.setFilterLevel(SkPaint::kLow_FilterLevel);
|
||||
|
||||
SkMaskFilter* mf = SkBlurMaskFilter::Create(
|
||||
SkBlurMaskFilter::kNormal_BlurStyle,
|
||||
|
@ -91,7 +91,7 @@ protected:
|
||||
SkRect dst = SkRect::MakeXYWH(0, 0, SkIntToScalar(kBlockSize), SkIntToScalar(kBlockSize));
|
||||
|
||||
SkPaint paint;
|
||||
paint.setFilterBitmap(filter);
|
||||
paint.setFilterLevel(filter ? SkPaint::kLow_FilterLevel : SkPaint::kNone_FilterLevel);
|
||||
|
||||
canvas->save();
|
||||
canvas->translate(SkIntToScalar(transX), SkIntToScalar(transY));
|
||||
@ -108,7 +108,7 @@ protected:
|
||||
SkRect dst = SkRect::MakeXYWH(0, 0, SkIntToScalar(kBlockSize), SkIntToScalar(kBlockSize));
|
||||
|
||||
SkPaint paint;
|
||||
paint.setFilterBitmap(filter);
|
||||
paint.setFilterLevel(filter ? SkPaint::kLow_FilterLevel : SkPaint::kNone_FilterLevel);
|
||||
|
||||
canvas->save();
|
||||
canvas->translate(SkIntToScalar(transX), SkIntToScalar(transY));
|
||||
@ -125,7 +125,7 @@ protected:
|
||||
SkRect dst = SkRect::MakeXYWH(0, 0, SkIntToScalar(kBlockSize), SkIntToScalar(kBlockSize));
|
||||
|
||||
SkPaint paint;
|
||||
paint.setFilterBitmap(filter);
|
||||
paint.setFilterLevel(filter ? SkPaint::kLow_FilterLevel : SkPaint::kNone_FilterLevel);
|
||||
|
||||
canvas->save();
|
||||
canvas->translate(SkIntToScalar(transX), SkIntToScalar(transY));
|
||||
@ -142,7 +142,7 @@ protected:
|
||||
SkRect dst = SkRect::MakeXYWH(0, 0, SkIntToScalar(kBlockSize), SkIntToScalar(kBlockSize));
|
||||
|
||||
SkPaint paint;
|
||||
paint.setFilterBitmap(filter);
|
||||
paint.setFilterLevel(filter ? SkPaint::kLow_FilterLevel : SkPaint::kNone_FilterLevel);
|
||||
SkMaskFilter* mf = SkBlurMaskFilter::Create(SkBlurMaskFilter::kNormal_BlurStyle,
|
||||
SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(3)));
|
||||
paint.setMaskFilter(mf)->unref();
|
||||
|
@ -55,7 +55,7 @@ protected:
|
||||
hairlinePaint.setStrokeWidth(0);
|
||||
|
||||
SkPaint blurPaint;
|
||||
blurPaint.setFilterBitmap(true);
|
||||
blurPaint.setFilterLevel(SkPaint::kLow_FilterLevel);
|
||||
SkMaskFilter* mf = SkBlurMaskFilter::Create(SkBlurMaskFilter::kNormal_BlurStyle,
|
||||
SkBlurMask::ConvertRadiusToSigma(kBlurRadius));
|
||||
blurPaint.setMaskFilter(mf)->unref();
|
||||
|
@ -163,7 +163,7 @@ protected:
|
||||
SkBitmap bm;
|
||||
|
||||
bm = make_chessbm(5, 5);
|
||||
paint.setFilterBitmap(true);
|
||||
paint.setFilterLevel(SkPaint::kLow_FilterLevel);
|
||||
|
||||
srcRect.setXYWH(1, 1, 3, 3);
|
||||
SkMaskFilter* mf = SkBlurMaskFilter::Create(
|
||||
|
@ -110,7 +110,7 @@ protected:
|
||||
s->setLocalMatrix(m);
|
||||
|
||||
paint.setShader(s)->unref();
|
||||
paint.setFilterBitmap(fDoFilter);
|
||||
paint.setFilterLevel(fDoFilter ? SkPaint::kLow_FilterLevel : SkPaint::kNone_FilterLevel);
|
||||
|
||||
canvas->translate(SkIntToScalar(50), SkIntToScalar(50));
|
||||
|
||||
|
@ -93,7 +93,7 @@ protected:
|
||||
SkScalar y = SkIntToScalar(100);
|
||||
|
||||
SkPaint paint;
|
||||
paint.setFilterBitmap(true);
|
||||
paint.setFilterLevel(SkPaint::kLow_FilterLevel);
|
||||
|
||||
for (int iy = 0; iy < 2; ++iy) {
|
||||
for (int ix = 0; ix < 2; ++ix) {
|
||||
|
@ -102,7 +102,7 @@ protected:
|
||||
SkPaint fillPaint;
|
||||
fillPaint.setAntiAlias(true);
|
||||
fillPaint.setTextSize(SkIntToScalar(kPointSize));
|
||||
fillPaint.setFilterBitmap(true);
|
||||
fillPaint.setFilterLevel(SkPaint::kLow_FilterLevel);
|
||||
fillPaint.setShader(shader);
|
||||
|
||||
SkPaint outlinePaint;
|
||||
|
@ -74,7 +74,7 @@ protected:
|
||||
|
||||
SkPaint bmpPaint;
|
||||
bmpPaint.setAntiAlias(true);
|
||||
bmpPaint.setFilterBitmap(true);
|
||||
bmpPaint.setFilterLevel(SkPaint::kLow_FilterLevel);
|
||||
bmpPaint.setAlpha(0x80);
|
||||
canvas->drawBitmap(bmp, 5.f, 5.f, &bmpPaint);
|
||||
|
||||
@ -113,7 +113,7 @@ protected:
|
||||
SkPaint fillPaint;
|
||||
fillPaint.setAntiAlias(true);
|
||||
fillPaint.setTextSize(SkIntToScalar(kPointSize));
|
||||
fillPaint.setFilterBitmap(true);
|
||||
fillPaint.setFilterLevel(SkPaint::kLow_FilterLevel);
|
||||
fillPaint.setShader(shader);
|
||||
|
||||
canvas->drawText(kText, kTextLen, 0, 0, fillPaint);
|
||||
|
@ -47,7 +47,7 @@ static void setup(SkPaint* paint, const SkBitmap& bm, bool filter,
|
||||
SkShader::TileMode tmx, SkShader::TileMode tmy) {
|
||||
SkShader* shader = SkShader::CreateBitmapShader(bm, tmx, tmy);
|
||||
paint->setShader(shader)->unref();
|
||||
paint->setFilterBitmap(filter);
|
||||
paint->setFilterLevel(filter ? SkPaint::kLow_FilterLevel : SkPaint::kNone_FilterLevel);
|
||||
}
|
||||
|
||||
static const SkBitmap::Config gConfigs[] = {
|
||||
|
@ -96,20 +96,19 @@ public:
|
||||
*/
|
||||
bool isNull() const { return NULL == fPixelRef; }
|
||||
|
||||
/** Return the config for the bitmap.
|
||||
*/
|
||||
/** Return the config for the bitmap. */
|
||||
Config config() const { return (Config)fConfig; }
|
||||
/** DEPRECATED, use config()
|
||||
*/
|
||||
|
||||
SK_ATTR_DEPRECATED("use config()")
|
||||
Config getConfig() const { return this->config(); }
|
||||
/** Return the bitmap's width, in pixels.
|
||||
*/
|
||||
|
||||
/** Return the bitmap's width, in pixels. */
|
||||
int width() const { return fWidth; }
|
||||
/** Return the bitmap's height, in pixels.
|
||||
*/
|
||||
|
||||
/** Return the bitmap's height, in pixels. */
|
||||
int height() const { return fHeight; }
|
||||
/** Return the number of bytes between subsequent rows of the bitmap.
|
||||
*/
|
||||
|
||||
/** Return the number of bytes between subsequent rows of the bitmap. */
|
||||
size_t rowBytes() const { return fRowBytes; }
|
||||
|
||||
/** Return the shift amount per pixel (i.e. 0 for 1-byte per pixel, 1 for
|
||||
@ -189,9 +188,7 @@ public:
|
||||
return SkAlphaTypeIsOpaque(this->alphaType());
|
||||
}
|
||||
|
||||
/**
|
||||
* DEPRECATED: use setAlpahType() instead.
|
||||
*/
|
||||
SK_ATTR_DEPRECATED("use setAlphaType")
|
||||
void setIsOpaque(bool opaque) {
|
||||
this->setAlphaType(opaque ? kOpaque_SkAlphaType : kPremul_SkAlphaType);
|
||||
}
|
||||
@ -419,7 +416,7 @@ public:
|
||||
*/
|
||||
void eraseARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b) const;
|
||||
|
||||
// DEPRECATED -- call eraseColor or eraseARGB
|
||||
SK_ATTR_DEPRECATED("use eraseARGB or eraseColor")
|
||||
void eraseRGB(U8CPU r, U8CPU g, U8CPU b) const {
|
||||
this->eraseARGB(0xFF, r, g, b);
|
||||
}
|
||||
@ -553,9 +550,7 @@ public:
|
||||
*/
|
||||
bool canCopyTo(Config newConfig) const;
|
||||
|
||||
/**
|
||||
* DEPRECATED -- will be replaced with API on SkPaint
|
||||
*/
|
||||
SK_ATTR_DEPRECATED("use setFilterLevel on SkPaint")
|
||||
void buildMipMap(bool forceRebuild = false);
|
||||
|
||||
#ifdef SK_BUILD_FOR_ANDROID
|
||||
|
@ -87,7 +87,7 @@ public:
|
||||
|
||||
/** Return the bitmap config of the device's pixels
|
||||
*/
|
||||
virtual SkBitmap::Config config() const SK_OVERRIDE { return fBitmap.getConfig(); }
|
||||
virtual SkBitmap::Config config() const SK_OVERRIDE { return fBitmap.config(); }
|
||||
|
||||
/**
|
||||
* DEPRECATED: This will be made protected once WebKit stops using it.
|
||||
|
@ -57,7 +57,7 @@ public:
|
||||
*/
|
||||
explicit SkCanvas(SkBaseDevice* device);
|
||||
|
||||
/** Deprecated - Construct a canvas with the specified bitmap to draw into.
|
||||
/** Construct a canvas with the specified bitmap to draw into.
|
||||
@param bitmap Specifies a bitmap for the canvas to draw into. Its
|
||||
structure are copied to the canvas.
|
||||
*/
|
||||
@ -942,11 +942,10 @@ public:
|
||||
*/
|
||||
ClipType getClipType() const;
|
||||
|
||||
/** Return the current device clip (concatenation of all clip calls).
|
||||
/** DEPRECATED -- need to move this guy to private/friend
|
||||
* Return the current device clip (concatenation of all clip calls).
|
||||
* This does not account for the translate in any of the devices.
|
||||
* @return the current device clip (concatenation of all clip calls).
|
||||
*
|
||||
* DEPRECATED -- call getClipDeviceBounds() instead.
|
||||
*/
|
||||
const SkRegion& getTotalClip() const;
|
||||
|
||||
@ -1034,8 +1033,8 @@ protected:
|
||||
// can perform copy-on-write or invalidate any cached images
|
||||
void predrawNotify();
|
||||
|
||||
/** DEPRECATED -- use constructor(device)
|
||||
|
||||
/**
|
||||
DEPRECATED -- need to remove when subclass stop relying on it.
|
||||
Marked as 'protected' to avoid new clients using this before we can
|
||||
completely remove it.
|
||||
|
||||
|
@ -90,8 +90,9 @@ public:
|
||||
*/
|
||||
virtual bool isOpaque() const = 0;
|
||||
|
||||
/** DEPRECATED - Return the bitmap config of the device's pixels
|
||||
/** Return the bitmap config of the device's pixels
|
||||
*/
|
||||
SK_ATTR_DEPRECATED("want to hide configness of the device -- don't use")
|
||||
virtual SkBitmap::Config config() const = 0;
|
||||
|
||||
/** Return the bitmap associated with this device. Call this each time you need
|
||||
|
@ -304,18 +304,18 @@ public:
|
||||
void setFilterLevel(FilterLevel);
|
||||
|
||||
/**
|
||||
* DEPRECATED: use setFilterLevel instead.
|
||||
* If the predicate is true, set the filterLevel to Low, else set it to
|
||||
* None.
|
||||
*/
|
||||
SK_ATTR_DEPRECATED("use setFilterLevel")
|
||||
void setFilterBitmap(bool doFilter) {
|
||||
this->setFilterLevel(doFilter ? kLow_FilterLevel : kNone_FilterLevel);
|
||||
}
|
||||
|
||||
/**
|
||||
* DEPRECATED: call getFilterLevel() instead.
|
||||
* Returns true if getFilterLevel() returns anything other than None.
|
||||
*/
|
||||
SK_ATTR_DEPRECATED("use getFilterLevel")
|
||||
bool isFilterBitmap() const {
|
||||
return kNone_FilterLevel != this->getFilterLevel();
|
||||
}
|
||||
@ -638,9 +638,8 @@ public:
|
||||
/**
|
||||
* Returns true if there is an annotation installed on this paint, and
|
||||
* the annotation specifics no-drawing.
|
||||
*
|
||||
* Deprecated: all annotations are no-draw. Please just check getAnnotation().
|
||||
*/
|
||||
SK_ATTR_DEPRECATED("use getAnnotation and check for non-null")
|
||||
bool isNoDrawAnnotation() const { return this->getAnnotation() != NULL; }
|
||||
|
||||
/**
|
||||
|
@ -123,7 +123,6 @@ public:
|
||||
void setConvexity(Convexity);
|
||||
|
||||
/**
|
||||
* DEPRECATED: use getConvexity()
|
||||
* Returns true if the path is flagged as being convex. This is not a
|
||||
* confirmed by any analysis, it is just the value set earlier.
|
||||
*/
|
||||
@ -132,12 +131,12 @@ public:
|
||||
}
|
||||
|
||||
/**
|
||||
* DEPRECATED: use setConvexity()
|
||||
* Set the isConvex flag to true or false. Convex paths may draw faster if
|
||||
* this flag is set, though setting this to true on a path that is in fact
|
||||
* not convex can give undefined results when drawn. Paths default to
|
||||
* isConvex == false
|
||||
*/
|
||||
SK_ATTR_DEPRECATED("use setConvexity")
|
||||
void setIsConvex(bool isConvex) {
|
||||
this->setConvexity(isConvex ? kConvex_Convexity : kConcave_Convexity);
|
||||
}
|
||||
|
@ -353,7 +353,7 @@ struct SK_API SkPoint {
|
||||
/** Return true if this point and the given point are far enough apart
|
||||
such that a vector between them would be non-degenerate.
|
||||
|
||||
WARNING: Unlike the deprecated version of equalsWithinTolerance(),
|
||||
WARNING: Unlike the explicit tolerance version,
|
||||
this method does not use componentwise comparison. Instead, it
|
||||
uses a comparison designed to match judgments elsewhere regarding
|
||||
degeneracy ("points A and B are so close that the vector between them
|
||||
@ -363,10 +363,7 @@ struct SK_API SkPoint {
|
||||
return !CanNormalize(fX - p.fX, fY - p.fY);
|
||||
}
|
||||
|
||||
/** DEPRECATED: Return true if this and the given point are componentwise
|
||||
within tolerance "tol".
|
||||
|
||||
WARNING: There is no guarantee that the result will reflect judgments
|
||||
/** WARNING: There is no guarantee that the result will reflect judgments
|
||||
elsewhere regarding degeneracy ("points A and B are so close that the
|
||||
vector between them is essentially zero").
|
||||
*/
|
||||
|
@ -374,6 +374,11 @@
|
||||
#define SK_UNUSED SK_ATTRIBUTE(unused)
|
||||
#endif
|
||||
|
||||
#if !defined(SK_ATTR_DEPRECATED)
|
||||
// we ignore msg for now...
|
||||
#define SK_ATTR_DEPRECATED(msg) SK_ATTRIBUTE(deprecated)
|
||||
#endif
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SK_PRINTF_LIKE
|
||||
|
@ -14,6 +14,13 @@
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
// Allows embedders that want to disable macros that take arguments to just
|
||||
// define that symbol to be one of these
|
||||
//
|
||||
#define SK_NOTHING_ARG1(arg1)
|
||||
#define SK_NOTHING_ARG2(arg1, arg2)
|
||||
#define SK_NOTHING_ARG3(arg1, arg2, arg3)
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if !defined(SK_BUILD_FOR_ANDROID) && !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_PALM) && !defined(SK_BUILD_FOR_WINCE) && !defined(SK_BUILD_FOR_WIN32) && !defined(SK_BUILD_FOR_UNIX) && !defined(SK_BUILD_FOR_MAC) && !defined(SK_BUILD_FOR_SDL) && !defined(SK_BUILD_FOR_BREW) && !defined(SK_BUILD_FOR_NACL)
|
||||
|
@ -401,7 +401,7 @@ struct SK_API SkRect {
|
||||
return r;
|
||||
}
|
||||
|
||||
// DEPRECATED: call Make(r)
|
||||
SK_ATTR_DEPRECATED("use Make()")
|
||||
static SkRect SK_WARN_UNUSED_RESULT MakeFromIRect(const SkIRect& irect) {
|
||||
SkRect r;
|
||||
r.set(SkIntToScalar(irect.fLeft),
|
||||
|
@ -46,7 +46,8 @@ public:
|
||||
|
||||
// return the current offset (will always be a multiple of 4)
|
||||
size_t bytesWritten() const { return fSize; }
|
||||
// DEPRECATED: use bytesWritten instead TODO(mtklein): clean up
|
||||
|
||||
SK_ATTR_DEPRECATED("use bytesWritten")
|
||||
size_t size() const { return this->bytesWritten(); }
|
||||
|
||||
// Returns true if we've written only into the storage passed into constructor or reset.
|
||||
|
@ -186,7 +186,7 @@ public:
|
||||
*/
|
||||
static bool ModeAsCoeff(Mode mode, Coeff* src, Coeff* dst);
|
||||
|
||||
// DEPRECATED: call AsMode(...)
|
||||
SK_ATTR_DEPRECATED("use AsMode(...)")
|
||||
static bool IsMode(const SkXfermode* xfer, Mode* mode) {
|
||||
return AsMode(xfer, mode);
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ public:
|
||||
SkBlurDrawLooper(SkColor color, SkScalar sigma, SkScalar dx, SkScalar dy,
|
||||
uint32_t flags = kNone_BlurFlag);
|
||||
|
||||
// DEPRECATED - radius-based
|
||||
// SK_ATTR_DEPRECATED("use sigma version")
|
||||
SkBlurDrawLooper(SkScalar radius, SkScalar dx, SkScalar dy, SkColor color,
|
||||
uint32_t flags = kNone_BlurFlag);
|
||||
virtual ~SkBlurDrawLooper();
|
||||
|
@ -33,9 +33,7 @@ public:
|
||||
kAll_BlurFlag = 0x03
|
||||
};
|
||||
|
||||
/**
|
||||
* DEPRECATED - radius-based
|
||||
*/
|
||||
SK_ATTR_DEPRECATED("use sigma version")
|
||||
static SkMaskFilter* Create(SkScalar radius, BlurStyle style,
|
||||
uint32_t flags = kNone_BlurFlag);
|
||||
|
||||
@ -59,7 +57,7 @@ public:
|
||||
static SkMaskFilter* CreateEmboss(SkScalar blurSigma, const SkScalar direction[3],
|
||||
SkScalar ambient, SkScalar specular);
|
||||
|
||||
// DEPRECATED - radius-based
|
||||
SK_ATTR_DEPRECATED("use sigma version")
|
||||
static SkMaskFilter* CreateEmboss(const SkScalar direction[3],
|
||||
SkScalar ambient, SkScalar specular,
|
||||
SkScalar blurRadius);
|
||||
|
@ -25,7 +25,7 @@ public:
|
||||
|
||||
SkEmbossMaskFilter(SkScalar blurSigma, const Light& light);
|
||||
|
||||
// DEPRECATED - radius-based
|
||||
SK_ATTR_DEPRECATED("use sigma version")
|
||||
SkEmbossMaskFilter(const Light& light, SkScalar blurRadius);
|
||||
|
||||
// overrides from SkMaskFilter
|
||||
|
@ -13,8 +13,6 @@
|
||||
|
||||
class SkXfermode;
|
||||
|
||||
/** DEPRECATED - use SkXfermode::Mode instead
|
||||
*/
|
||||
class SK_API SkPorterDuff {
|
||||
public:
|
||||
/** List of predefined xfermodes. In general, the algebra for the modes
|
||||
@ -76,6 +74,6 @@ public:
|
||||
/** Return the corersponding SkXfermode::Mode
|
||||
*/
|
||||
static SkXfermode::Mode ToXfermodeMode(Mode);
|
||||
};
|
||||
} SK_ATTR_DEPRECATED("use SkXfermode::Mode");
|
||||
|
||||
#endif
|
||||
|
@ -25,7 +25,9 @@ public:
|
||||
* If NULL or a given crop edge is not specified, the source
|
||||
* primitive's bounds are used instead.
|
||||
*/
|
||||
/* DEPRECATED */ static SkRectShaderImageFilter* Create(SkShader* s, const SkRect& rect);
|
||||
SK_ATTR_DEPRECATED("use Create(SkShader*, const CropRect*)")
|
||||
static SkRectShaderImageFilter* Create(SkShader* s, const SkRect& rect);
|
||||
|
||||
static SkRectShaderImageFilter* Create(SkShader* s, const CropRect* rect = NULL);
|
||||
virtual ~SkRectShaderImageFilter();
|
||||
|
||||
|
@ -43,16 +43,16 @@ public:
|
||||
SkGpuDevice(GrContext*, SkBitmap::Config, int width, int height, int sampleCount = 0);
|
||||
|
||||
/**
|
||||
* DEPRECATED -- need to make this private, call Create(surface)
|
||||
* New device that will render to the specified renderTarget.
|
||||
* DEPRECATED: Use Create(surface)
|
||||
*/
|
||||
SkGpuDevice(GrContext*, GrRenderTarget*);
|
||||
|
||||
/**
|
||||
* DEPRECATED -- need to make this private, call Create(surface)
|
||||
* New device that will render to the texture (as a rendertarget).
|
||||
* The GrTexture's asRenderTarget() must be non-NULL or device will not
|
||||
* function.
|
||||
* DEPRECATED: Use Create(surface)
|
||||
*/
|
||||
SkGpuDevice(GrContext*, GrTexture*);
|
||||
|
||||
|
@ -112,7 +112,7 @@ public:
|
||||
SkMatrix44(Uninitialized_Constructor) { }
|
||||
SkMatrix44(Identity_Constructor) { this->setIdentity(); }
|
||||
|
||||
// DEPRECATED: use the constructors that take an enum
|
||||
SK_ATTR_DEPRECATED("use the constructors that take an enum")
|
||||
SkMatrix44() { this->setIdentity(); }
|
||||
|
||||
SkMatrix44(const SkMatrix44& src) {
|
||||
@ -335,11 +335,12 @@ public:
|
||||
this->mapScalars(vec, vec);
|
||||
}
|
||||
|
||||
// DEPRECATED: call mapScalars()
|
||||
SK_ATTR_DEPRECATED("use mapScalars")
|
||||
void map(const SkScalar src[4], SkScalar dst[4]) const {
|
||||
this->mapScalars(src, dst);
|
||||
}
|
||||
// DEPRECATED: call mapScalars()
|
||||
|
||||
SK_ATTR_DEPRECATED("use mapScalars")
|
||||
void map(SkScalar vec[4]) const {
|
||||
this->mapScalars(vec, vec);
|
||||
}
|
||||
@ -357,7 +358,7 @@ public:
|
||||
|
||||
friend SkVector4 operator*(const SkMatrix44& m, const SkVector4& src) {
|
||||
SkVector4 dst;
|
||||
m.map(src.fData, dst.fData);
|
||||
m.mapScalars(src.fData, dst.fData);
|
||||
return dst;
|
||||
}
|
||||
|
||||
|
@ -505,7 +505,8 @@ public:
|
||||
paint->setAntiAlias(SkOSMenu::kOnState == fAAState);
|
||||
}
|
||||
if (SkOSMenu::kMixedState != fFilterState) {
|
||||
paint->setFilterBitmap(SkOSMenu::kOnState == fFilterState);
|
||||
paint->setFilterLevel(SkOSMenu::kOnState == fFilterState ?
|
||||
SkPaint::kLow_FilterLevel : SkPaint::kNone_FilterLevel);
|
||||
}
|
||||
if (SkOSMenu::kMixedState != fSubpixelState) {
|
||||
paint->setSubpixelText(SkOSMenu::kOnState == fSubpixelState);
|
||||
|
@ -133,7 +133,7 @@ protected:
|
||||
canvas->drawRect(srcR, paint);
|
||||
|
||||
for (int i = 0; i < 2; ++i) {
|
||||
paint.setFilterBitmap(1 == i);
|
||||
paint.setFilterLevel(1 == i ? SkPaint::kLow_FilterLevel : SkPaint::kNone_FilterLevel);
|
||||
canvas->drawBitmapRectToRect(bitmap, &srcR, fDstR[i], &paint);
|
||||
canvas->drawRect(fDstR[i], paint);
|
||||
}
|
||||
@ -226,7 +226,7 @@ protected:
|
||||
paint.setColor(SK_ColorYELLOW);
|
||||
|
||||
for (int i = 0; i < 2; ++i) {
|
||||
paint.setFilterBitmap(1 == i);
|
||||
paint.setFilterLevel(1 == i ? SkPaint::kLow_FilterLevel : SkPaint::kNone_FilterLevel);
|
||||
canvas->drawBitmapRectToRect(fBitmap, &fSrcR, fDstR[i], &paint);
|
||||
canvas->drawRect(fDstR[i], paint);
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ static SkScalar draw_bm(SkCanvas* canvas, const SkBitmap& bm,
|
||||
|
||||
static SkScalar draw_set(SkCanvas* c, const SkBitmap& bm, SkScalar x, SkPaint* p) {
|
||||
x += draw_bm(c, bm, x, 0, p);
|
||||
p->setFilterBitmap(true);
|
||||
p->setFilterLevel(SkPaint::kLow_FilterLevel);
|
||||
x += draw_bm(c, bm, x, 0, p);
|
||||
p->setDither(true);
|
||||
return x + draw_bm(c, bm, x, 0, p);
|
||||
|
@ -76,7 +76,7 @@ protected:
|
||||
canvas->scale(SK_Scalar1, scale);
|
||||
|
||||
for (int k = 0; k < 2; k++) {
|
||||
paint.setFilterBitmap(k == 1);
|
||||
paint.setFilterLevel(k == 1 ? SkPaint::kLow_FilterLevel : SkPaint::kNone_FilterLevel);
|
||||
for (int j = 0; j < 2; j++) {
|
||||
paint.setDither(j == 1);
|
||||
for (int i = 0; i < fBitmapCount; i++) {
|
||||
@ -93,7 +93,7 @@ protected:
|
||||
SkString s("dither=");
|
||||
s.appendS32(paint.isDither());
|
||||
s.append(" filter=");
|
||||
s.appendS32(paint.isFilterBitmap());
|
||||
s.appendS32(paint.getFilterLevel() != SkPaint::kNone_FilterLevel);
|
||||
canvas->drawText(s.c_str(), s.size(), x + W/2,
|
||||
y - p.getTextSize(), p);
|
||||
}
|
||||
|
@ -231,9 +231,9 @@ static SkImageFilter* make_image_filter(bool canBeNull = true) {
|
||||
make_scalar(true), make_scalar(true), R(10.0f), make_scalar()) :
|
||||
SkPerlinNoiseShader::CreateTubulence(
|
||||
make_scalar(true), make_scalar(true), R(10.0f), make_scalar()));
|
||||
filter = SkRectShaderImageFilter::Create(shader,
|
||||
SkRect::MakeWH(SkIntToScalar(kBitmapSize),
|
||||
SkIntToScalar(kBitmapSize)));
|
||||
SkImageFilter::CropRect cropR(SkRect::MakeWH(SkIntToScalar(kBitmapSize),
|
||||
SkIntToScalar(kBitmapSize)));
|
||||
filter = SkRectShaderImageFilter::Create(shader, &cropR);
|
||||
}
|
||||
break;
|
||||
case DROP_SHADOW:
|
||||
|
@ -269,7 +269,7 @@ protected:
|
||||
virtual void onDrawContent(SkCanvas* canvas) {
|
||||
SkPaint paint;
|
||||
paint.setDither(true);
|
||||
paint.setFilterBitmap(true);
|
||||
paint.setFilterLevel(SkPaint::kLow_FilterLevel);
|
||||
|
||||
canvas->translate(SkIntToScalar(20), 0);
|
||||
|
||||
|
@ -444,7 +444,7 @@ static void mesh_slide(SkCanvas* canvas) {
|
||||
|
||||
SkPaint paint;
|
||||
paint.setDither(true);
|
||||
paint.setFilterBitmap(true);
|
||||
paint.setFilterLevel(SkPaint::kLow_FilterLevel);
|
||||
|
||||
for (size_t i = 0; i < SK_ARRAY_COUNT(fRecs); i++) {
|
||||
canvas->save();
|
||||
|
@ -48,7 +48,7 @@ protected:
|
||||
SkIRect srcRect;
|
||||
SkRect dstRect;
|
||||
SkPaint paint;
|
||||
paint.setFilterBitmap(true);
|
||||
paint.setFilterLevel(SkPaint::kLow_FilterLevel);
|
||||
|
||||
// Test that bitmap draws from malloc-backed bitmaps respect
|
||||
// the constrained texture domain.
|
||||
|
@ -52,7 +52,7 @@ static void setup(SkPaint* paint, const SkBitmap& bm, bool filter,
|
||||
SkShader::TileMode tmx, SkShader::TileMode tmy) {
|
||||
SkShader* shader = SkShader::CreateBitmapShader(bm, tmx, tmy);
|
||||
paint->setShader(shader)->unref();
|
||||
paint->setFilterBitmap(filter);
|
||||
paint->setFilterLevel(filter ? SkPaint::kLow_FilterLevel : SkPaint::kNone_FilterLevel);
|
||||
}
|
||||
|
||||
static const SkBitmap::Config gConfigs[] = {
|
||||
|
@ -91,7 +91,7 @@ protected:
|
||||
virtual void onDrawContent(SkCanvas* canvas) {
|
||||
SkPaint paint;
|
||||
paint.setDither(true);
|
||||
paint.setFilterBitmap(true);
|
||||
paint.setFilterLevel(SkPaint::kLow_FilterLevel);
|
||||
|
||||
for (size_t i = 0; i < SK_ARRAY_COUNT(fRecs); i++) {
|
||||
canvas->save();
|
||||
|
@ -220,7 +220,7 @@ void SkDrawPaint::setupPaint(SkPaint* paint) const {
|
||||
if (fakeBold != -1)
|
||||
paint->setFakeBoldText(SkToBool(fakeBold));
|
||||
if (filterBitmap != -1)
|
||||
paint->setFilterBitmap(SkToBool(filterBitmap));
|
||||
paint->setFilterLevel(filterBitmap ? SkPaint::kLow_FilterLevel : SkPaint::kNone_FilterLevel);
|
||||
// stroke is legacy; style setting if present overrides stroke
|
||||
if (stroke != -1)
|
||||
paint->setStyle(SkToBool(stroke) ? SkPaint::kStroke_Style : SkPaint::kFill_Style);
|
||||
|
@ -22,7 +22,7 @@ SkBBoxHierarchyRecord::SkBBoxHierarchyRecord(uint32_t recordFlags,
|
||||
void SkBBoxHierarchyRecord::handleBBox(const SkRect& bounds) {
|
||||
SkIRect r;
|
||||
bounds.roundOut(&r);
|
||||
SkPictureStateTree::Draw* draw = fStateTree->appendDraw(this->writeStream().size());
|
||||
SkPictureStateTree::Draw* draw = fStateTree->appendDraw(this->writeStream().bytesWritten());
|
||||
fBoundingHierarchy->insert(draw, r, true);
|
||||
}
|
||||
|
||||
@ -33,7 +33,7 @@ int SkBBoxHierarchyRecord::save(SaveFlags flags) {
|
||||
|
||||
int SkBBoxHierarchyRecord::saveLayer(const SkRect* bounds, const SkPaint* paint,
|
||||
SaveFlags flags) {
|
||||
fStateTree->appendSaveLayer(this->writeStream().size());
|
||||
fStateTree->appendSaveLayer(this->writeStream().bytesWritten());
|
||||
return INHERITED::saveLayer(bounds, paint, flags);
|
||||
}
|
||||
|
||||
@ -80,27 +80,27 @@ void SkBBoxHierarchyRecord::setMatrix(const SkMatrix& matrix) {
|
||||
bool SkBBoxHierarchyRecord::clipRect(const SkRect& rect,
|
||||
SkRegion::Op op,
|
||||
bool doAntiAlias) {
|
||||
fStateTree->appendClip(this->writeStream().size());
|
||||
fStateTree->appendClip(this->writeStream().bytesWritten());
|
||||
return INHERITED::clipRect(rect, op, doAntiAlias);
|
||||
}
|
||||
|
||||
bool SkBBoxHierarchyRecord::clipRegion(const SkRegion& region,
|
||||
SkRegion::Op op) {
|
||||
fStateTree->appendClip(this->writeStream().size());
|
||||
fStateTree->appendClip(this->writeStream().bytesWritten());
|
||||
return INHERITED::clipRegion(region, op);
|
||||
}
|
||||
|
||||
bool SkBBoxHierarchyRecord::clipPath(const SkPath& path,
|
||||
SkRegion::Op op,
|
||||
bool doAntiAlias) {
|
||||
fStateTree->appendClip(this->writeStream().size());
|
||||
fStateTree->appendClip(this->writeStream().bytesWritten());
|
||||
return INHERITED::clipPath(path, op, doAntiAlias);
|
||||
}
|
||||
|
||||
bool SkBBoxHierarchyRecord::clipRRect(const SkRRect& rrect,
|
||||
SkRegion::Op op,
|
||||
bool doAntiAlias) {
|
||||
fStateTree->appendClip(this->writeStream().size());
|
||||
fStateTree->appendClip(this->writeStream().bytesWritten());
|
||||
return INHERITED::clipRRect(rrect, op, doAntiAlias);
|
||||
}
|
||||
|
||||
@ -109,7 +109,7 @@ bool SkBBoxHierarchyRecord::shouldRewind(void* data) {
|
||||
// SkPicture has rewound its command stream. To match that rewind in the
|
||||
// BBH, we rewind all draws that reference commands that were recorded
|
||||
// past the point to which the SkPicture has rewound, which is given by
|
||||
// writeStream().size().
|
||||
// writeStream().bytesWritten().
|
||||
SkPictureStateTree::Draw* draw = static_cast<SkPictureStateTree::Draw*>(data);
|
||||
return draw->fOffset >= writeStream().size();
|
||||
return draw->fOffset >= writeStream().bytesWritten();
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ void SkBBoxRecord::drawPath(const SkPath& path, const SkPaint& paint) {
|
||||
// path's device-space bounding box.
|
||||
SkIRect clipBounds;
|
||||
if (this->getClipDeviceBounds(&clipBounds)) {
|
||||
this->handleBBox(SkRect::MakeFromIRect(clipBounds));
|
||||
this->handleBBox(SkRect::Make(clipBounds));
|
||||
INHERITED::drawPath(path, paint);
|
||||
}
|
||||
} else if (this->transformBounds(path.getBounds(), &paint)) {
|
||||
|
@ -502,11 +502,11 @@ size_t SkBitmap::getSafeSize() const {
|
||||
// This is intended to be a size_t version of ComputeSafeSize64(), just
|
||||
// faster. The computation is meant to be identical.
|
||||
return (fHeight ? ((fHeight - 1) * fRowBytes) +
|
||||
ComputeRowBytes(getConfig(), fWidth): 0);
|
||||
ComputeRowBytes(this->config(), fWidth): 0);
|
||||
}
|
||||
|
||||
Sk64 SkBitmap::getSafeSize64() const {
|
||||
return ComputeSafeSize64(getConfig(), fWidth, fHeight, fRowBytes);
|
||||
return ComputeSafeSize64(this->config(), fWidth, fHeight, fRowBytes);
|
||||
}
|
||||
|
||||
bool SkBitmap::copyPixelsTo(void* const dst, size_t dstSize,
|
||||
@ -516,12 +516,12 @@ bool SkBitmap::copyPixelsTo(void* const dst, size_t dstSize,
|
||||
dstRowBytes = fRowBytes;
|
||||
}
|
||||
|
||||
if (dstRowBytes < ComputeRowBytes(getConfig(), fWidth) ||
|
||||
if (dstRowBytes < ComputeRowBytes(this->config(), fWidth) ||
|
||||
dst == NULL || (getPixels() == NULL && pixelRef() == NULL))
|
||||
return false;
|
||||
|
||||
if (!preserveDstPad && static_cast<uint32_t>(dstRowBytes) == fRowBytes) {
|
||||
size_t safeSize = getSafeSize();
|
||||
size_t safeSize = this->getSafeSize();
|
||||
if (safeSize > dstSize || safeSize == 0)
|
||||
return false;
|
||||
else {
|
||||
@ -535,12 +535,12 @@ bool SkBitmap::copyPixelsTo(void* const dst, size_t dstSize,
|
||||
}
|
||||
} else {
|
||||
// If destination has different stride than us, then copy line by line.
|
||||
if (ComputeSafeSize(getConfig(), fWidth, fHeight, dstRowBytes) >
|
||||
if (ComputeSafeSize(this->config(), fWidth, fHeight, dstRowBytes) >
|
||||
dstSize)
|
||||
return false;
|
||||
else {
|
||||
// Just copy what we need on each line.
|
||||
size_t rowBytes = ComputeRowBytes(getConfig(), fWidth);
|
||||
size_t rowBytes = ComputeRowBytes(this->config(), fWidth);
|
||||
SkAutoLockPixels lock(*this);
|
||||
const uint8_t* srcP = reinterpret_cast<const uint8_t*>(getPixels());
|
||||
uint8_t* dstP = reinterpret_cast<uint8_t*>(dst);
|
||||
@ -874,7 +874,7 @@ void SkBitmap::eraseArea(const SkIRect& rect, SkColor c) const {
|
||||
* within the bounds of the SkPixelRef being used.
|
||||
*/
|
||||
static size_t get_sub_offset(const SkBitmap& bm, int x, int y) {
|
||||
switch (bm.getConfig()) {
|
||||
switch (bm.config()) {
|
||||
case SkBitmap::kA8_Config:
|
||||
case SkBitmap:: kIndex8_Config:
|
||||
// x is fine as is for the calculation
|
||||
@ -1005,7 +1005,7 @@ bool SkBitmap::extractSubset(SkBitmap* result, const SkIRect& subset) const {
|
||||
#include "SkPaint.h"
|
||||
|
||||
bool SkBitmap::canCopyTo(Config dstConfig) const {
|
||||
if (this->getConfig() == kNo_Config) {
|
||||
if (this->config() == kNo_Config) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1028,7 +1028,7 @@ bool SkBitmap::canCopyTo(Config dstConfig) const {
|
||||
}
|
||||
|
||||
// do not copy src if srcConfig == kA1_Config while dstConfig != kA1_Config
|
||||
if (this->getConfig() == kA1_Config && !sameConfigs) {
|
||||
if (this->config() == kA1_Config && !sameConfigs) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1305,7 +1305,7 @@ void SkBitmap::buildMipMap(bool forceRebuild) {
|
||||
|
||||
void (*proc)(SkBitmap* dst, int x, int y, const SkBitmap& src);
|
||||
|
||||
const SkBitmap::Config config = this->getConfig();
|
||||
const SkBitmap::Config config = this->config();
|
||||
|
||||
switch (config) {
|
||||
case kARGB_8888_Config:
|
||||
@ -1444,7 +1444,7 @@ static bool GetBitmapAlpha(const SkBitmap& src, uint8_t* SK_RESTRICT alpha,
|
||||
SkASSERT(alpha != NULL);
|
||||
SkASSERT(alphaRowBytes >= src.width());
|
||||
|
||||
SkBitmap::Config config = src.getConfig();
|
||||
SkBitmap::Config config = src.config();
|
||||
int w = src.width();
|
||||
int h = src.height();
|
||||
size_t rb = src.rowBytes();
|
||||
|
@ -13,8 +13,8 @@
|
||||
|
||||
SK_DEFINE_INST_COUNT(SkBitmapDevice)
|
||||
|
||||
#define CHECK_FOR_NODRAW_ANNOTATION(paint) \
|
||||
do { if (paint.isNoDrawAnnotation()) { return; } } while (0)
|
||||
#define CHECK_FOR_ANNOTATION(paint) \
|
||||
do { if (paint.getAnnotation()) { return; } } while (0)
|
||||
|
||||
SkBitmapDevice::SkBitmapDevice(const SkBitmap& bitmap)
|
||||
: fBitmap(bitmap) {
|
||||
@ -210,17 +210,17 @@ void SkBitmapDevice::drawPaint(const SkDraw& draw, const SkPaint& paint) {
|
||||
|
||||
void SkBitmapDevice::drawPoints(const SkDraw& draw, SkCanvas::PointMode mode, size_t count,
|
||||
const SkPoint pts[], const SkPaint& paint) {
|
||||
CHECK_FOR_NODRAW_ANNOTATION(paint);
|
||||
CHECK_FOR_ANNOTATION(paint);
|
||||
draw.drawPoints(mode, count, pts, paint);
|
||||
}
|
||||
|
||||
void SkBitmapDevice::drawRect(const SkDraw& draw, const SkRect& r, const SkPaint& paint) {
|
||||
CHECK_FOR_NODRAW_ANNOTATION(paint);
|
||||
CHECK_FOR_ANNOTATION(paint);
|
||||
draw.drawRect(r, paint);
|
||||
}
|
||||
|
||||
void SkBitmapDevice::drawOval(const SkDraw& draw, const SkRect& oval, const SkPaint& paint) {
|
||||
CHECK_FOR_NODRAW_ANNOTATION(paint);
|
||||
CHECK_FOR_ANNOTATION(paint);
|
||||
|
||||
SkPath path;
|
||||
path.addOval(oval);
|
||||
@ -230,7 +230,7 @@ void SkBitmapDevice::drawOval(const SkDraw& draw, const SkRect& oval, const SkPa
|
||||
}
|
||||
|
||||
void SkBitmapDevice::drawRRect(const SkDraw& draw, const SkRRect& rrect, const SkPaint& paint) {
|
||||
CHECK_FOR_NODRAW_ANNOTATION(paint);
|
||||
CHECK_FOR_ANNOTATION(paint);
|
||||
|
||||
SkPath path;
|
||||
path.addRRect(rrect);
|
||||
@ -242,7 +242,7 @@ void SkBitmapDevice::drawRRect(const SkDraw& draw, const SkRRect& rrect, const S
|
||||
void SkBitmapDevice::drawPath(const SkDraw& draw, const SkPath& path,
|
||||
const SkPaint& paint, const SkMatrix* prePathMatrix,
|
||||
bool pathIsMutable) {
|
||||
CHECK_FOR_NODRAW_ANNOTATION(paint);
|
||||
CHECK_FOR_ANNOTATION(paint);
|
||||
draw.drawPath(path, paint, prePathMatrix, pathIsMutable);
|
||||
}
|
||||
|
||||
|
@ -259,7 +259,7 @@ bool SkBitmapHeap::copyBitmap(const SkBitmap& originalBitmap, SkBitmap& copiedBi
|
||||
// copiedBitmap.setPixelRef(sharedPixelRef, originalBitmap.pixelRefOffset());
|
||||
} else if (originalBitmap.empty()) {
|
||||
copiedBitmap.reset();
|
||||
} else if (!originalBitmap.deepCopyTo(&copiedBitmap, originalBitmap.getConfig())) {
|
||||
} else if (!originalBitmap.deepCopyTo(&copiedBitmap, originalBitmap.config())) {
|
||||
return false;
|
||||
}
|
||||
copiedBitmap.setImmutable();
|
||||
|
@ -857,7 +857,7 @@ SkBlitter* SkBlitter::Choose(const SkBitmap& device,
|
||||
|
||||
// which check, in case we're being called by a client with a dummy device
|
||||
// (e.g. they have a bounder that always aborts the draw)
|
||||
if (SkBitmap::kNo_Config == device.getConfig()) {
|
||||
if (SkBitmap::kNo_Config == device.config()) {
|
||||
SK_PLACEMENT_NEW(blitter, SkNullBlitter, storage, storageSize);
|
||||
return blitter;
|
||||
}
|
||||
@ -940,7 +940,7 @@ SkBlitter* SkBlitter::Choose(const SkBitmap& device,
|
||||
return blitter;
|
||||
}
|
||||
|
||||
switch (device.getConfig()) {
|
||||
switch (device.config()) {
|
||||
case SkBitmap::kA1_Config:
|
||||
SK_PLACEMENT_NEW_ARGS(blitter, SkA1_Blitter,
|
||||
storage, storageSize, (device, *paint));
|
||||
|
@ -66,7 +66,7 @@ SkBlitter* SkBlitter::ChooseSprite( const SkBitmap& device,
|
||||
|
||||
SkSpriteBlitter* blitter;
|
||||
|
||||
switch (device.getConfig()) {
|
||||
switch (device.config()) {
|
||||
case SkBitmap::kRGB_565_Config:
|
||||
blitter = SkSpriteBlitter::ChooseD16(source, paint, storage,
|
||||
storageSize);
|
||||
|
@ -1307,7 +1307,7 @@ bool SkCanvas::updateClipConservativelyUsingBounds(const SkRect& bounds, SkRegio
|
||||
SkRect deviceBounds;
|
||||
SkIRect deviceIBounds;
|
||||
this->getDevice()->getGlobalBounds(&deviceIBounds);
|
||||
deviceBounds = SkRect::MakeFromIRect(deviceIBounds);
|
||||
deviceBounds = SkRect::Make(deviceIBounds);
|
||||
this->SkCanvas::save(SkCanvas::kMatrix_SaveFlag);
|
||||
// set the clip in device space
|
||||
this->SkCanvas::setMatrix(SkMatrix::I());
|
||||
|
@ -1156,7 +1156,7 @@ static bool just_translate(const SkMatrix& matrix, const SkBitmap& bitmap) {
|
||||
|
||||
void SkDraw::drawBitmapAsMask(const SkBitmap& bitmap,
|
||||
const SkPaint& paint) const {
|
||||
SkASSERT(bitmap.getConfig() == SkBitmap::kA8_Config);
|
||||
SkASSERT(bitmap.config() == SkBitmap::kA8_Config);
|
||||
|
||||
if (just_translate(*fMatrix, bitmap)) {
|
||||
int ix = SkScalarRound(fMatrix->getTranslateX());
|
||||
@ -1264,7 +1264,7 @@ void SkDraw::drawBitmap(const SkBitmap& bitmap, const SkMatrix& prematrix,
|
||||
// nothing to draw
|
||||
if (fRC->isEmpty() ||
|
||||
bitmap.width() == 0 || bitmap.height() == 0 ||
|
||||
bitmap.getConfig() == SkBitmap::kNo_Config) {
|
||||
bitmap.config() == SkBitmap::kNo_Config) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1290,7 +1290,7 @@ void SkDraw::drawBitmap(const SkBitmap& bitmap, const SkMatrix& prematrix,
|
||||
}
|
||||
}
|
||||
|
||||
if (bitmap.getConfig() != SkBitmap::kA8_Config &&
|
||||
if (bitmap.config() != SkBitmap::kA8_Config &&
|
||||
just_translate(matrix, bitmap)) {
|
||||
//
|
||||
// It is safe to call lock pixels now, since we know the matrix is
|
||||
@ -1323,7 +1323,7 @@ void SkDraw::drawBitmap(const SkBitmap& bitmap, const SkMatrix& prematrix,
|
||||
SkDraw draw(*this);
|
||||
draw.fMatrix = &matrix;
|
||||
|
||||
if (bitmap.getConfig() == SkBitmap::kA8_Config) {
|
||||
if (bitmap.config() == SkBitmap::kA8_Config) {
|
||||
draw.drawBitmapAsMask(bitmap, paint);
|
||||
} else {
|
||||
SkAutoBitmapShaderInstall install(bitmap, paint);
|
||||
@ -1343,7 +1343,7 @@ void SkDraw::drawSprite(const SkBitmap& bitmap, int x, int y,
|
||||
// nothing to draw
|
||||
if (fRC->isEmpty() ||
|
||||
bitmap.width() == 0 || bitmap.height() == 0 ||
|
||||
bitmap.getConfig() == SkBitmap::kNo_Config) {
|
||||
bitmap.config() == SkBitmap::kNo_Config) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -129,7 +129,7 @@ SkMipMap::Level* SkMipMap::AllocLevels(int levelCount, size_t pixelSize) {
|
||||
SkMipMap* SkMipMap::Build(const SkBitmap& src) {
|
||||
void (*proc)(SkBitmap* dst, int x, int y, const SkBitmap& src);
|
||||
|
||||
const SkBitmap::Config config = src.getConfig();
|
||||
const SkBitmap::Config config = src.config();
|
||||
switch (config) {
|
||||
case SkBitmap::kARGB_8888_Config:
|
||||
proc = downsampleby2_proc32;
|
||||
|
@ -310,10 +310,10 @@ void SkOrderedWriteBuffer::writeFlattenable(const SkFlattenable* flattenable) {
|
||||
// make room for the size of the flattened object
|
||||
(void)fWriter.reserve(sizeof(uint32_t));
|
||||
// record the current size, so we can subtract after the object writes.
|
||||
uint32_t offset = fWriter.size();
|
||||
uint32_t offset = fWriter.bytesWritten();
|
||||
// now flatten the object
|
||||
flattenObject(flattenable, *this);
|
||||
uint32_t objSize = fWriter.size() - offset;
|
||||
uint32_t objSize = fWriter.bytesWritten() - offset;
|
||||
// record the obj's size
|
||||
*fWriter.peek32(offset - sizeof(uint32_t)) = objSize;
|
||||
}
|
||||
|
@ -97,7 +97,8 @@ public:
|
||||
}
|
||||
|
||||
~SkAutoPathBoundsUpdate() {
|
||||
fPath->setIsConvex(fDegenerate);
|
||||
fPath->setConvexity(fDegenerate ? SkPath::kConvex_Convexity
|
||||
: SkPath::kUnknown_Convexity);
|
||||
if (fEmpty || fHasValidBounds) {
|
||||
fPath->setBounds(fRect);
|
||||
}
|
||||
|
@ -66,10 +66,10 @@ SkPicturePlayback::SkPicturePlayback(const SkPictureRecord& record, bool deepCop
|
||||
record.dumpPaints();
|
||||
#endif
|
||||
|
||||
record.validate(record.writeStream().size(), 0);
|
||||
record.validate(record.writeStream().bytesWritten(), 0);
|
||||
const SkWriter32& writer = record.writeStream();
|
||||
init();
|
||||
if (writer.size() == 0) {
|
||||
if (writer.bytesWritten() == 0) {
|
||||
fOpData = SkData::NewEmpty();
|
||||
return;
|
||||
}
|
||||
@ -85,7 +85,7 @@ SkPicturePlayback::SkPicturePlayback(const SkPictureRecord& record, bool deepCop
|
||||
}
|
||||
|
||||
{
|
||||
size_t size = writer.size();
|
||||
size_t size = writer.bytesWritten();
|
||||
void* buffer = sk_malloc_throw(size);
|
||||
writer.flatten(buffer);
|
||||
SkASSERT(!fOpData);
|
||||
|
@ -146,7 +146,7 @@ SkBaseDevice* SkPictureRecord::setDevice(SkBaseDevice* device) {
|
||||
int SkPictureRecord::save(SaveFlags flags) {
|
||||
// record the offset to us, making it non-positive to distinguish a save
|
||||
// from a clip entry.
|
||||
fRestoreOffsetStack.push(-(int32_t)fWriter.size());
|
||||
fRestoreOffsetStack.push(-(int32_t)fWriter.bytesWritten());
|
||||
|
||||
// op + flags
|
||||
uint32_t size = kSaveSize;
|
||||
@ -161,7 +161,7 @@ int SkPictureRecord::saveLayer(const SkRect* bounds, const SkPaint* paint,
|
||||
SaveFlags flags) {
|
||||
// record the offset to us, making it non-positive to distinguish a save
|
||||
// from a clip entry.
|
||||
fRestoreOffsetStack.push(-(int32_t)fWriter.size());
|
||||
fRestoreOffsetStack.push(-(int32_t)fWriter.bytesWritten());
|
||||
|
||||
// op + bool for 'bounds'
|
||||
uint32_t size = 2 * kUInt32Size;
|
||||
@ -175,7 +175,7 @@ int SkPictureRecord::saveLayer(const SkRect* bounds, const SkPaint* paint,
|
||||
|
||||
size_t initialOffset = this->addDraw(SAVE_LAYER, &size);
|
||||
addRectPtr(bounds);
|
||||
SkASSERT(initialOffset+getPaintOffset(SAVE_LAYER, size) == fWriter.size());
|
||||
SkASSERT(initialOffset+getPaintOffset(SAVE_LAYER, size) == fWriter.bytesWritten());
|
||||
addPaintPtr(paint);
|
||||
addInt(flags);
|
||||
|
||||
@ -248,19 +248,19 @@ struct CommandInfo {
|
||||
*/
|
||||
static bool match(SkWriter32* writer, uint32_t offset,
|
||||
int* pattern, CommandInfo* result, int numCommands) {
|
||||
SkASSERT(offset < writer->size());
|
||||
SkASSERT(offset < writer->bytesWritten());
|
||||
|
||||
uint32_t curOffset = offset;
|
||||
uint32_t curSize = 0;
|
||||
int numMatched;
|
||||
for (numMatched = 0; numMatched < numCommands && curOffset < writer->size(); ++numMatched) {
|
||||
for (numMatched = 0; numMatched < numCommands && curOffset < writer->bytesWritten(); ++numMatched) {
|
||||
DrawType op = peek_op_and_size(writer, curOffset, &curSize);
|
||||
while (NOOP == op && curOffset < writer->size()) {
|
||||
while (NOOP == op && curOffset < writer->bytesWritten()) {
|
||||
curOffset += curSize;
|
||||
op = peek_op_and_size(writer, curOffset, &curSize);
|
||||
}
|
||||
|
||||
if (curOffset >= writer->size()) {
|
||||
if (curOffset >= writer->bytesWritten()) {
|
||||
return false; // ran out of byte stream
|
||||
}
|
||||
|
||||
@ -285,7 +285,7 @@ static bool match(SkWriter32* writer, uint32_t offset,
|
||||
}
|
||||
|
||||
curOffset += curSize;
|
||||
if (curOffset < writer->size()) {
|
||||
if (curOffset < writer->bytesWritten()) {
|
||||
// Something else between the last command and the end of the stream
|
||||
return false;
|
||||
}
|
||||
@ -464,7 +464,7 @@ static bool collapse_save_clip_restore(SkWriter32* writer, int32_t offset,
|
||||
gCollapseCalls += 1;
|
||||
#endif
|
||||
|
||||
int32_t restoreOffset = (int32_t)writer->size();
|
||||
int32_t restoreOffset = (int32_t)writer->bytesWritten();
|
||||
|
||||
// back up to the save block
|
||||
while (offset > 0) {
|
||||
@ -585,7 +585,7 @@ void SkPictureRecord::restore() {
|
||||
if ((*gPictureRecordOpts[opt].fProc)(&fWriter, fRestoreOffsetStack.top(), &fPaints)) {
|
||||
// Some optimization fired so don't add the RESTORE
|
||||
size = 0;
|
||||
initialOffset = fWriter.size();
|
||||
initialOffset = fWriter.bytesWritten();
|
||||
apply_optimization_to_bbh(gPictureRecordOpts[opt].fType,
|
||||
fStateTree, fBoundingHierarchy);
|
||||
break;
|
||||
@ -596,7 +596,7 @@ void SkPictureRecord::restore() {
|
||||
if ((fRecordFlags & SkPicture::kDisableRecordOptimizations_RecordingFlag) ||
|
||||
SK_ARRAY_COUNT(gPictureRecordOpts) == opt) {
|
||||
// No optimization fired so add the RESTORE
|
||||
fillRestoreOffsetPlaceholdersForCurrentStackLevel((uint32_t)fWriter.size());
|
||||
fillRestoreOffsetPlaceholdersForCurrentStackLevel((uint32_t)fWriter.bytesWritten());
|
||||
size = 1 * kUInt32Size; // RESTORE consists solely of 1 op code
|
||||
initialOffset = this->addDraw(RESTORE, &size);
|
||||
}
|
||||
@ -647,7 +647,7 @@ bool SkPictureRecord::skew(SkScalar sx, SkScalar sy) {
|
||||
}
|
||||
|
||||
bool SkPictureRecord::concat(const SkMatrix& matrix) {
|
||||
this->validate(fWriter.size(), 0);
|
||||
this->validate(fWriter.bytesWritten(), 0);
|
||||
// op + matrix index
|
||||
uint32_t size = 2 * kUInt32Size;
|
||||
size_t initialOffset = this->addDraw(CONCAT, &size);
|
||||
@ -657,7 +657,7 @@ bool SkPictureRecord::concat(const SkMatrix& matrix) {
|
||||
}
|
||||
|
||||
void SkPictureRecord::setMatrix(const SkMatrix& matrix) {
|
||||
this->validate(fWriter.size(), 0);
|
||||
this->validate(fWriter.bytesWritten(), 0);
|
||||
// op + matrix index
|
||||
uint32_t size = 2 * kUInt32Size;
|
||||
size_t initialOffset = this->addDraw(SET_MATRIX, &size);
|
||||
@ -734,7 +734,7 @@ void SkPictureRecord::recordRestoreOffsetPlaceholder(SkRegion::Op op) {
|
||||
prevOffset = 0;
|
||||
}
|
||||
|
||||
size_t offset = fWriter.size();
|
||||
size_t offset = fWriter.bytesWritten();
|
||||
addInt(prevOffset);
|
||||
fRestoreOffsetStack.top() = offset;
|
||||
}
|
||||
@ -840,7 +840,7 @@ void SkPictureRecord::drawPaint(const SkPaint& paint) {
|
||||
// op + paint index
|
||||
uint32_t size = 2 * kUInt32Size;
|
||||
size_t initialOffset = this->addDraw(DRAW_PAINT, &size);
|
||||
SkASSERT(initialOffset+getPaintOffset(DRAW_PAINT, size) == fWriter.size());
|
||||
SkASSERT(initialOffset+getPaintOffset(DRAW_PAINT, size) == fWriter.bytesWritten());
|
||||
addPaint(paint);
|
||||
this->validate(initialOffset, size);
|
||||
}
|
||||
@ -850,7 +850,7 @@ void SkPictureRecord::drawPoints(PointMode mode, size_t count, const SkPoint pts
|
||||
// op + paint index + mode + count + point data
|
||||
uint32_t size = 4 * kUInt32Size + count * sizeof(SkPoint);
|
||||
size_t initialOffset = this->addDraw(DRAW_POINTS, &size);
|
||||
SkASSERT(initialOffset+getPaintOffset(DRAW_POINTS, size) == fWriter.size());
|
||||
SkASSERT(initialOffset+getPaintOffset(DRAW_POINTS, size) == fWriter.bytesWritten());
|
||||
addPaint(paint);
|
||||
addInt(mode);
|
||||
addInt(count);
|
||||
@ -862,7 +862,7 @@ void SkPictureRecord::drawOval(const SkRect& oval, const SkPaint& paint) {
|
||||
// op + paint index + rect
|
||||
uint32_t size = 2 * kUInt32Size + sizeof(oval);
|
||||
size_t initialOffset = this->addDraw(DRAW_OVAL, &size);
|
||||
SkASSERT(initialOffset+getPaintOffset(DRAW_OVAL, size) == fWriter.size());
|
||||
SkASSERT(initialOffset+getPaintOffset(DRAW_OVAL, size) == fWriter.bytesWritten());
|
||||
addPaint(paint);
|
||||
addRect(oval);
|
||||
this->validate(initialOffset, size);
|
||||
@ -872,7 +872,7 @@ void SkPictureRecord::drawRect(const SkRect& rect, const SkPaint& paint) {
|
||||
// op + paint index + rect
|
||||
uint32_t size = 2 * kUInt32Size + sizeof(rect);
|
||||
size_t initialOffset = this->addDraw(DRAW_RECT, &size);
|
||||
SkASSERT(initialOffset+getPaintOffset(DRAW_RECT, size) == fWriter.size());
|
||||
SkASSERT(initialOffset+getPaintOffset(DRAW_RECT, size) == fWriter.bytesWritten());
|
||||
addPaint(paint);
|
||||
addRect(rect);
|
||||
this->validate(initialOffset, size);
|
||||
@ -888,7 +888,7 @@ void SkPictureRecord::drawRRect(const SkRRect& rrect, const SkPaint& paint) {
|
||||
uint32_t initialOffset, size;
|
||||
size = 2 * kUInt32Size + SkRRect::kSizeInMemory;
|
||||
initialOffset = this->addDraw(DRAW_RRECT, &size);
|
||||
SkASSERT(initialOffset+getPaintOffset(DRAW_RRECT, size) == fWriter.size());
|
||||
SkASSERT(initialOffset+getPaintOffset(DRAW_RRECT, size) == fWriter.bytesWritten());
|
||||
addPaint(paint);
|
||||
addRRect(rrect);
|
||||
this->validate(initialOffset, size);
|
||||
@ -899,7 +899,7 @@ void SkPictureRecord::drawPath(const SkPath& path, const SkPaint& paint) {
|
||||
// op + paint index + path index
|
||||
uint32_t size = 3 * kUInt32Size;
|
||||
size_t initialOffset = this->addDraw(DRAW_PATH, &size);
|
||||
SkASSERT(initialOffset+getPaintOffset(DRAW_PATH, size) == fWriter.size());
|
||||
SkASSERT(initialOffset+getPaintOffset(DRAW_PATH, size) == fWriter.bytesWritten());
|
||||
addPaint(paint);
|
||||
addPath(path);
|
||||
this->validate(initialOffset, size);
|
||||
@ -910,7 +910,7 @@ void SkPictureRecord::drawBitmap(const SkBitmap& bitmap, SkScalar left, SkScalar
|
||||
// op + paint index + bitmap index + left + top
|
||||
uint32_t size = 3 * kUInt32Size + 2 * sizeof(SkScalar);
|
||||
size_t initialOffset = this->addDraw(DRAW_BITMAP, &size);
|
||||
SkASSERT(initialOffset+getPaintOffset(DRAW_BITMAP, size) == fWriter.size());
|
||||
SkASSERT(initialOffset+getPaintOffset(DRAW_BITMAP, size) == fWriter.bytesWritten());
|
||||
addPaintPtr(paint);
|
||||
addBitmap(bitmap);
|
||||
addScalar(left);
|
||||
@ -929,7 +929,7 @@ void SkPictureRecord::drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect*
|
||||
size += sizeof(dst); // + rect
|
||||
|
||||
size_t initialOffset = this->addDraw(DRAW_BITMAP_RECT_TO_RECT, &size);
|
||||
SkASSERT(initialOffset+getPaintOffset(DRAW_BITMAP_RECT_TO_RECT, size) == fWriter.size());
|
||||
SkASSERT(initialOffset+getPaintOffset(DRAW_BITMAP_RECT_TO_RECT, size) == fWriter.bytesWritten());
|
||||
addPaintPtr(paint);
|
||||
addBitmap(bitmap);
|
||||
addRectPtr(src); // may be null
|
||||
@ -943,7 +943,7 @@ void SkPictureRecord::drawBitmapMatrix(const SkBitmap& bitmap, const SkMatrix& m
|
||||
// id + paint index + bitmap index + matrix index
|
||||
uint32_t size = 4 * kUInt32Size;
|
||||
size_t initialOffset = this->addDraw(DRAW_BITMAP_MATRIX, &size);
|
||||
SkASSERT(initialOffset+getPaintOffset(DRAW_BITMAP_MATRIX, size) == fWriter.size());
|
||||
SkASSERT(initialOffset+getPaintOffset(DRAW_BITMAP_MATRIX, size) == fWriter.bytesWritten());
|
||||
addPaintPtr(paint);
|
||||
addBitmap(bitmap);
|
||||
addMatrix(matrix);
|
||||
@ -955,7 +955,7 @@ void SkPictureRecord::drawBitmapNine(const SkBitmap& bitmap, const SkIRect& cent
|
||||
// op + paint index + bitmap id + center + dst rect
|
||||
uint32_t size = 3 * kUInt32Size + sizeof(center) + sizeof(dst);
|
||||
size_t initialOffset = this->addDraw(DRAW_BITMAP_NINE, &size);
|
||||
SkASSERT(initialOffset+getPaintOffset(DRAW_BITMAP_NINE, size) == fWriter.size());
|
||||
SkASSERT(initialOffset+getPaintOffset(DRAW_BITMAP_NINE, size) == fWriter.bytesWritten());
|
||||
addPaintPtr(paint);
|
||||
addBitmap(bitmap);
|
||||
addIRect(center);
|
||||
@ -968,7 +968,7 @@ void SkPictureRecord::drawSprite(const SkBitmap& bitmap, int left, int top,
|
||||
// op + paint index + bitmap index + left + top
|
||||
uint32_t size = 5 * kUInt32Size;
|
||||
size_t initialOffset = this->addDraw(DRAW_SPRITE, &size);
|
||||
SkASSERT(initialOffset+getPaintOffset(DRAW_SPRITE, size) == fWriter.size());
|
||||
SkASSERT(initialOffset+getPaintOffset(DRAW_SPRITE, size) == fWriter.bytesWritten());
|
||||
addPaintPtr(paint);
|
||||
addBitmap(bitmap);
|
||||
addInt(left);
|
||||
@ -1007,7 +1007,7 @@ void SkPictureRecord::drawText(const void* text, size_t byteLength, SkScalar x,
|
||||
|
||||
DrawType op = fast ? DRAW_TEXT_TOP_BOTTOM : DRAW_TEXT;
|
||||
size_t initialOffset = this->addDraw(op, &size);
|
||||
SkASSERT(initialOffset+getPaintOffset(op, size) == fWriter.size());
|
||||
SkASSERT(initialOffset+getPaintOffset(op, size) == fWriter.bytesWritten());
|
||||
const SkFlatData* flatPaintData = addPaint(paint);
|
||||
SkASSERT(flatPaintData);
|
||||
addText(text, byteLength);
|
||||
@ -1073,14 +1073,14 @@ void SkPictureRecord::drawPosText(const void* text, size_t byteLength,
|
||||
op = DRAW_POS_TEXT;
|
||||
}
|
||||
size_t initialOffset = this->addDraw(op, &size);
|
||||
SkASSERT(initialOffset+getPaintOffset(op, size) == fWriter.size());
|
||||
SkASSERT(initialOffset+getPaintOffset(op, size) == fWriter.bytesWritten());
|
||||
const SkFlatData* flatPaintData = addPaint(paint);
|
||||
SkASSERT(flatPaintData);
|
||||
addText(text, byteLength);
|
||||
addInt(points);
|
||||
|
||||
#ifdef SK_DEBUG_SIZE
|
||||
size_t start = fWriter.size();
|
||||
size_t start = fWriter.bytesWritten();
|
||||
#endif
|
||||
if (canUseDrawH) {
|
||||
if (fast) {
|
||||
@ -1097,7 +1097,7 @@ void SkPictureRecord::drawPosText(const void* text, size_t byteLength,
|
||||
}
|
||||
}
|
||||
#ifdef SK_DEBUG_SIZE
|
||||
fPointBytes += fWriter.size() - start;
|
||||
fPointBytes += fWriter.bytesWritten() - start;
|
||||
fPointWrites += points;
|
||||
#endif
|
||||
this->validate(initialOffset, size);
|
||||
@ -1136,7 +1136,7 @@ void SkPictureRecord::drawPosTextHImpl(const void* text, size_t byteLength,
|
||||
addInt(points);
|
||||
|
||||
#ifdef SK_DEBUG_SIZE
|
||||
size_t start = fWriter.size();
|
||||
size_t start = fWriter.bytesWritten();
|
||||
#endif
|
||||
if (fast) {
|
||||
addFontMetricsTopBottom(paint, *flatPaintData, constY, constY);
|
||||
@ -1144,7 +1144,7 @@ void SkPictureRecord::drawPosTextHImpl(const void* text, size_t byteLength,
|
||||
addScalar(constY);
|
||||
fWriter.writeMul4(xpos, points * sizeof(SkScalar));
|
||||
#ifdef SK_DEBUG_SIZE
|
||||
fPointBytes += fWriter.size() - start;
|
||||
fPointBytes += fWriter.bytesWritten() - start;
|
||||
fPointWrites += points;
|
||||
#endif
|
||||
this->validate(initialOffset, size);
|
||||
@ -1156,7 +1156,7 @@ void SkPictureRecord::drawTextOnPath(const void* text, size_t byteLength,
|
||||
// op + paint index + length + 'length' worth of data + path index + matrix index
|
||||
uint32_t size = 3 * kUInt32Size + SkAlign4(byteLength) + 2 * kUInt32Size;
|
||||
size_t initialOffset = this->addDraw(DRAW_TEXT_ON_PATH, &size);
|
||||
SkASSERT(initialOffset+getPaintOffset(DRAW_TEXT_ON_PATH, size) == fWriter.size());
|
||||
SkASSERT(initialOffset+getPaintOffset(DRAW_TEXT_ON_PATH, size) == fWriter.bytesWritten());
|
||||
addPaint(paint);
|
||||
addText(text, byteLength);
|
||||
addPath(path);
|
||||
@ -1202,7 +1202,7 @@ void SkPictureRecord::drawVertices(VertexMode vmode, int vertexCount,
|
||||
}
|
||||
|
||||
size_t initialOffset = this->addDraw(DRAW_VERTICES, &size);
|
||||
SkASSERT(initialOffset+getPaintOffset(DRAW_VERTICES, size) == fWriter.size());
|
||||
SkASSERT(initialOffset+getPaintOffset(DRAW_VERTICES, size) == fWriter.bytesWritten());
|
||||
addPaint(paint);
|
||||
addInt(flags);
|
||||
addInt(vmode);
|
||||
@ -1311,11 +1311,11 @@ void SkPictureRecord::addPicture(SkPicture& picture) {
|
||||
|
||||
void SkPictureRecord::addPoint(const SkPoint& point) {
|
||||
#ifdef SK_DEBUG_SIZE
|
||||
size_t start = fWriter.size();
|
||||
size_t start = fWriter.bytesWritten();
|
||||
#endif
|
||||
fWriter.writePoint(point);
|
||||
#ifdef SK_DEBUG_SIZE
|
||||
fPointBytes += fWriter.size() - start;
|
||||
fPointBytes += fWriter.bytesWritten() - start;
|
||||
fPointWrites++;
|
||||
#endif
|
||||
}
|
||||
@ -1330,11 +1330,11 @@ void SkPictureRecord::addPoints(const SkPoint pts[], int count) {
|
||||
|
||||
void SkPictureRecord::addRect(const SkRect& rect) {
|
||||
#ifdef SK_DEBUG_SIZE
|
||||
size_t start = fWriter.size();
|
||||
size_t start = fWriter.bytesWritten();
|
||||
#endif
|
||||
fWriter.writeRect(rect);
|
||||
#ifdef SK_DEBUG_SIZE
|
||||
fRectBytes += fWriter.size() - start;
|
||||
fRectBytes += fWriter.bytesWritten() - start;
|
||||
fRectWrites++;
|
||||
#endif
|
||||
}
|
||||
@ -1365,12 +1365,12 @@ void SkPictureRecord::addRegion(const SkRegion& region) {
|
||||
|
||||
void SkPictureRecord::addText(const void* text, size_t byteLength) {
|
||||
#ifdef SK_DEBUG_SIZE
|
||||
size_t start = fWriter.size();
|
||||
size_t start = fWriter.bytesWritten();
|
||||
#endif
|
||||
addInt(byteLength);
|
||||
fWriter.writePad(text, byteLength);
|
||||
#ifdef SK_DEBUG_SIZE
|
||||
fTextBytes += fWriter.size() - start;
|
||||
fTextBytes += fWriter.bytesWritten() - start;
|
||||
fTextWrites++;
|
||||
#endif
|
||||
}
|
||||
|
@ -131,7 +131,7 @@ private:
|
||||
* operates in this manner.
|
||||
*/
|
||||
size_t addDraw(DrawType drawType, uint32_t* size) {
|
||||
size_t offset = fWriter.size();
|
||||
size_t offset = fWriter.bytesWritten();
|
||||
|
||||
this->predrawNotify();
|
||||
|
||||
@ -212,7 +212,7 @@ private:
|
||||
#else
|
||||
public:
|
||||
void validate(size_t initialOffset, uint32_t size) const {
|
||||
SkASSERT(fWriter.size() == initialOffset + size);
|
||||
SkASSERT(fWriter.bytesWritten() == initialOffset + size);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -51,7 +51,7 @@ bool SkShader::setContext(const SkBitmap& device,
|
||||
const SkMatrix* m = &matrix;
|
||||
SkMatrix total;
|
||||
|
||||
fDeviceConfig = SkToU8(device.getConfig());
|
||||
fDeviceConfig = SkToU8(device.config());
|
||||
fPaintAlpha = paint.getAlpha();
|
||||
if (this->hasLocalMatrix()) {
|
||||
total.setConcat(matrix, this->getLocalMatrix());
|
||||
|
@ -277,7 +277,7 @@ SkSpriteBlitter* SkSpriteBlitter::ChooseD32(const SkBitmap& source,
|
||||
SkColorFilter* filter = paint.getColorFilter();
|
||||
SkSpriteBlitter* blitter = NULL;
|
||||
|
||||
switch (source.getConfig()) {
|
||||
switch (source.config()) {
|
||||
case SkBitmap::kARGB_4444_Config:
|
||||
if (alpha != 0xFF) {
|
||||
return NULL; // we only have opaque sprites
|
||||
|
@ -324,7 +324,7 @@ SkSpriteBlitter* SkSpriteBlitter::ChooseD16(const SkBitmap& source,
|
||||
SkSpriteBlitter* blitter = NULL;
|
||||
unsigned alpha = paint.getAlpha();
|
||||
|
||||
switch (source.getConfig()) {
|
||||
switch (source.config()) {
|
||||
case SkBitmap::kARGB_8888_Config:
|
||||
SK_PLACEMENT_NEW_ARGS(blitter, Sprite_D16_S32_BlitRowProc,
|
||||
storage, storageSize, (source));
|
||||
|
@ -249,7 +249,7 @@ GrEffectRef* BATShader::asNewEffect(GrContext* context, const SkPaint& paint) co
|
||||
context->setMatrix(matrix);
|
||||
|
||||
while (!iter.done()) {
|
||||
SkRect rect = SkRect::MakeFromIRect(iter.rect());
|
||||
SkRect rect = SkRect::Make(iter.rect());
|
||||
context->drawRect(grPaint, rect);
|
||||
iter.next();
|
||||
}
|
||||
|
@ -44,17 +44,19 @@ public:
|
||||
Style style,
|
||||
SkIPoint* margin = NULL);
|
||||
|
||||
// DEPRECATED - radius-based
|
||||
SK_ATTR_DEPRECATED("use sigma version")
|
||||
static bool BlurRect(SkMask *dst, const SkRect &src,
|
||||
SkScalar radius, Style style,
|
||||
SkIPoint *margin = NULL,
|
||||
SkMask::CreateMode createMode =
|
||||
SkMask::kComputeBoundsAndRenderImage_CreateMode);
|
||||
// DEPRECATED - radius-based
|
||||
|
||||
SK_ATTR_DEPRECATED("use sigma version")
|
||||
static bool Blur(SkMask* dst, const SkMask& src,
|
||||
SkScalar radius, Style style, Quality quality,
|
||||
SkIPoint* margin = NULL);
|
||||
// DEPRECATED - radius-based
|
||||
|
||||
SK_ATTR_DEPRECATED("use sigma version")
|
||||
static bool BlurGroundTruth(SkMask* dst, const SkMask& src,
|
||||
SkScalar radius, Style style,
|
||||
SkIPoint* margin = NULL);
|
||||
|
@ -386,7 +386,7 @@ bool SkBlurMaskFilterImpl::canFilterMaskGPU(const SkRect& srcBounds,
|
||||
|
||||
float sigma3 = 3 * SkScalarToFloat(xformedSigma);
|
||||
|
||||
SkRect clipRect = SkRect::MakeFromIRect(clipBounds);
|
||||
SkRect clipRect = SkRect::Make(clipBounds);
|
||||
SkRect srcRect(srcBounds);
|
||||
|
||||
// Outset srcRect and clipRect by 3 * sigma, to compute affected blur area.
|
||||
|
@ -501,7 +501,7 @@ void apply_morphology_pass(GrContext* context,
|
||||
direction,
|
||||
radius,
|
||||
morphType))->unref();
|
||||
context->drawRectToRect(paint, SkRect::MakeFromIRect(dstRect), SkRect::MakeFromIRect(srcRect));
|
||||
context->drawRectToRect(paint, SkRect::Make(dstRect), SkRect::Make(srcRect));
|
||||
}
|
||||
|
||||
bool apply_morphology(const SkBitmap& input,
|
||||
|
@ -72,7 +72,7 @@ SkXfermode* SkPorterDuff::CreateXfermode(SkPorterDuff::Mode mode) {
|
||||
|
||||
bool SkPorterDuff::IsMode(SkXfermode* xfer, Mode* pdmode) {
|
||||
SkXfermode::Mode xfmode;
|
||||
if (!SkXfermode::IsMode(xfer, &xfmode)) {
|
||||
if (!SkXfermode::AsMode(xfer, &xfmode)) {
|
||||
return false;
|
||||
}
|
||||
return find_pdmode(xfmode, pdmode);
|
||||
|
@ -48,7 +48,7 @@ bool SkDownSampleImageFilter::onFilterImage(Proxy* proxy, const SkBitmap& src,
|
||||
OwnDeviceCanvas canvas(dev);
|
||||
SkPaint paint;
|
||||
|
||||
paint.setFilterBitmap(true);
|
||||
paint.setFilterLevel(SkPaint::kLow_FilterLevel);
|
||||
canvas.scale(scale, scale);
|
||||
canvas.drawBitmap(src, 0, 0, &paint);
|
||||
tmp = dev->accessBitmap(false);
|
||||
|
@ -23,7 +23,7 @@ bool SkTransparentShader::setContext(const SkBitmap& device,
|
||||
uint32_t SkTransparentShader::getFlags() {
|
||||
uint32_t flags = this->INHERITED::getFlags();
|
||||
|
||||
switch (fDevice->getConfig()) {
|
||||
switch (fDevice->config()) {
|
||||
case SkBitmap::kRGB_565_Config:
|
||||
flags |= kHasSpan16_Flag;
|
||||
if (fAlpha == 255)
|
||||
@ -42,7 +42,7 @@ uint32_t SkTransparentShader::getFlags() {
|
||||
void SkTransparentShader::shadeSpan(int x, int y, SkPMColor span[], int count) {
|
||||
unsigned scale = SkAlpha255To256(fAlpha);
|
||||
|
||||
switch (fDevice->getConfig()) {
|
||||
switch (fDevice->config()) {
|
||||
case SkBitmap::kARGB_8888_Config:
|
||||
if (scale == 256) {
|
||||
SkPMColor* src = fDevice->getAddr32(x, y);
|
||||
@ -103,7 +103,7 @@ void SkTransparentShader::shadeSpan(int x, int y, SkPMColor span[], int count) {
|
||||
}
|
||||
|
||||
void SkTransparentShader::shadeSpan16(int x, int y, uint16_t span[], int count) {
|
||||
SkASSERT(fDevice->getConfig() == SkBitmap::kRGB_565_Config);
|
||||
SkASSERT(fDevice->config() == SkBitmap::kRGB_565_Config);
|
||||
|
||||
uint16_t* src = fDevice->getAddr16(x, y);
|
||||
if (src != span) {
|
||||
|
@ -366,7 +366,7 @@ void GrClipMaskManager::mergeMask(GrTexture* dstMask,
|
||||
GrTextureDomainEffect::MakeTexelDomain(srcMask, srcBound),
|
||||
GrTextureDomainEffect::kDecal_WrapMode,
|
||||
GrTextureParams::kNone_FilterMode))->unref();
|
||||
fGpu->drawSimpleRect(SkRect::MakeFromIRect(dstBound), NULL);
|
||||
fGpu->drawSimpleRect(SkRect::Make(dstBound), NULL);
|
||||
}
|
||||
|
||||
// get a texture to act as a temporary buffer for AA clip boolean operations
|
||||
@ -722,7 +722,7 @@ bool GrClipMaskManager::createStencilClipMask(InitialState initialState,
|
||||
SET_RANDOM_COLOR
|
||||
// The view matrix is setup to do clip space -> stencil space translation, so
|
||||
// draw rect in clip space.
|
||||
fGpu->drawSimpleRect(SkRect::MakeFromIRect(clipSpaceIBounds), NULL);
|
||||
fGpu->drawSimpleRect(SkRect::Make(clipSpaceIBounds), NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -961,7 +961,7 @@ GrTexture* GrClipMaskManager::createSoftwareClipMask(int32_t clipStackGenID,
|
||||
// but leave the pixels inside the geometry alone. For reverse difference we invert all
|
||||
// the pixels before clearing the ones outside the geometry.
|
||||
if (SkRegion::kReverseDifference_Op == op) {
|
||||
SkRect temp = SkRect::MakeFromIRect(clipSpaceIBounds);
|
||||
SkRect temp = SkRect::Make(clipSpaceIBounds);
|
||||
// invert the entire scene
|
||||
helper.draw(temp, SkRegion::kXOR_Op, false, 0xFF);
|
||||
}
|
||||
|
@ -362,7 +362,7 @@ public:
|
||||
this->drawRect(rect, matrix, NULL, NULL);
|
||||
}
|
||||
void drawSimpleRect(const SkIRect& irect, const SkMatrix* matrix = NULL) {
|
||||
SkRect rect = SkRect::MakeFromIRect(irect);
|
||||
SkRect rect = SkRect::Make(irect);
|
||||
this->drawRect(rect, matrix, NULL, NULL);
|
||||
}
|
||||
|
||||
|
@ -213,7 +213,7 @@ bool GrInOrderDrawBuffer::quickInsideClip(const SkRect& devBounds) {
|
||||
// free via the viewport. We don't want to think that clipping must be enabled in this
|
||||
// case. So we extend the clip outward from the edge to avoid these false negatives.
|
||||
fClipProxyState = kValid_ClipProxyState;
|
||||
fClipProxy = SkRect::MakeFromIRect(rect);
|
||||
fClipProxy = SkRect::Make(rect);
|
||||
|
||||
if (fClipProxy.fLeft <= 0) {
|
||||
fClipProxy.fLeft = SK_ScalarMin;
|
||||
|
@ -51,7 +51,7 @@ void ReduceClipStack(const SkClipStack& stack,
|
||||
|
||||
const SkIRect* bounds = &queryBounds;
|
||||
|
||||
SkRect scalarQueryBounds = SkRect::MakeFromIRect(queryBounds);
|
||||
SkRect scalarQueryBounds = SkRect::Make(queryBounds);
|
||||
|
||||
if (iior) {
|
||||
SkASSERT(SkClipStack::kNormal_BoundsType == stackBoundsType);
|
||||
@ -67,7 +67,7 @@ void ReduceClipStack(const SkClipStack& stack,
|
||||
} else if (isectRect.intersect(stackBounds, scalarQueryBounds)) {
|
||||
if (NULL != tighterBounds) {
|
||||
isectRect.roundOut(tighterBounds);
|
||||
SkRect scalarTighterBounds = SkRect::MakeFromIRect(*tighterBounds);
|
||||
SkRect scalarTighterBounds = SkRect::Make(*tighterBounds);
|
||||
if (scalarTighterBounds == isectRect) {
|
||||
// the round-out didn't add any area outside the clip rect.
|
||||
*requiresAA = false;
|
||||
@ -119,7 +119,7 @@ void ReduceClipStack(const SkClipStack& stack,
|
||||
}
|
||||
}
|
||||
|
||||
SkRect scalarBounds = SkRect::MakeFromIRect(*bounds);
|
||||
SkRect scalarBounds = SkRect::Make(*bounds);
|
||||
|
||||
// Now that we have determined the bounds to use and filtered out the trivial cases, call the
|
||||
// helper that actually walks the stack.
|
||||
|
@ -53,8 +53,8 @@
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define CHECK_FOR_NODRAW_ANNOTATION(paint) \
|
||||
do { if (paint.isNoDrawAnnotation()) { return; } } while (0)
|
||||
#define CHECK_FOR_ANNOTATION(paint) \
|
||||
do { if (paint.getAnnotation()) { return; } } while (0)
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -572,7 +572,7 @@ static const GrPrimitiveType gPointMode2PrimtiveType[] = {
|
||||
|
||||
void SkGpuDevice::drawPoints(const SkDraw& draw, SkCanvas::PointMode mode,
|
||||
size_t count, const SkPoint pts[], const SkPaint& paint) {
|
||||
CHECK_FOR_NODRAW_ANNOTATION(paint);
|
||||
CHECK_FOR_ANNOTATION(paint);
|
||||
CHECK_SHOULD_DRAW(draw, false);
|
||||
|
||||
SkScalar width = paint.getStrokeWidth();
|
||||
@ -606,7 +606,7 @@ void SkGpuDevice::drawPoints(const SkDraw& draw, SkCanvas::PointMode mode,
|
||||
|
||||
void SkGpuDevice::drawRect(const SkDraw& draw, const SkRect& rect,
|
||||
const SkPaint& paint) {
|
||||
CHECK_FOR_NODRAW_ANNOTATION(paint);
|
||||
CHECK_FOR_ANNOTATION(paint);
|
||||
CHECK_SHOULD_DRAW(draw, false);
|
||||
|
||||
bool doStroke = paint.getStyle() != SkPaint::kFill_Style;
|
||||
@ -662,7 +662,7 @@ void SkGpuDevice::drawRect(const SkDraw& draw, const SkRect& rect,
|
||||
|
||||
void SkGpuDevice::drawRRect(const SkDraw& draw, const SkRRect& rect,
|
||||
const SkPaint& paint) {
|
||||
CHECK_FOR_NODRAW_ANNOTATION(paint);
|
||||
CHECK_FOR_ANNOTATION(paint);
|
||||
CHECK_SHOULD_DRAW(draw, false);
|
||||
|
||||
bool usePath = !rect.isSimple();
|
||||
@ -695,7 +695,7 @@ void SkGpuDevice::drawRRect(const SkDraw& draw, const SkRRect& rect,
|
||||
|
||||
void SkGpuDevice::drawOval(const SkDraw& draw, const SkRect& oval,
|
||||
const SkPaint& paint) {
|
||||
CHECK_FOR_NODRAW_ANNOTATION(paint);
|
||||
CHECK_FOR_ANNOTATION(paint);
|
||||
CHECK_SHOULD_DRAW(draw, false);
|
||||
|
||||
bool usePath = false;
|
||||
@ -787,7 +787,7 @@ bool draw_with_mask_filter(GrContext* context, const SkPath& devPath,
|
||||
texture->writePixels(0, 0, desc.fWidth, desc.fHeight, desc.fConfig,
|
||||
dstM.fImage, dstM.fRowBytes);
|
||||
|
||||
SkRect maskRect = SkRect::MakeFromIRect(dstM.fBounds);
|
||||
SkRect maskRect = SkRect::Make(dstM.fBounds);
|
||||
|
||||
return draw_mask(context, maskRect, grp, texture);
|
||||
}
|
||||
@ -860,7 +860,7 @@ SkBitmap wrap_texture(GrTexture* texture) {
|
||||
void SkGpuDevice::drawPath(const SkDraw& draw, const SkPath& origSrcPath,
|
||||
const SkPaint& paint, const SkMatrix* prePathMatrix,
|
||||
bool pathIsMutable) {
|
||||
CHECK_FOR_NODRAW_ANNOTATION(paint);
|
||||
CHECK_FOR_ANNOTATION(paint);
|
||||
CHECK_SHOULD_DRAW(draw, false);
|
||||
|
||||
GrPaint grPaint;
|
||||
@ -1017,7 +1017,7 @@ static void determine_clipped_src_rect(const GrContext* context,
|
||||
clippedSrcIRect->setEmpty();
|
||||
return;
|
||||
}
|
||||
SkRect clippedSrcRect = SkRect::MakeFromIRect(*clippedSrcIRect);
|
||||
SkRect clippedSrcRect = SkRect::Make(*clippedSrcIRect);
|
||||
inv.mapRect(&clippedSrcRect);
|
||||
if (NULL != srcRectPtr) {
|
||||
if (!clippedSrcRect.intersect(*srcRectPtr)) {
|
||||
@ -1236,7 +1236,7 @@ void SkGpuDevice::drawTiledBitmap(const SkBitmap& bitmap,
|
||||
const SkPaint& paint,
|
||||
SkCanvas::DrawBitmapRectFlags flags,
|
||||
int tileSize) {
|
||||
SkRect clippedSrcRect = SkRect::MakeFromIRect(clippedSrcIRect);
|
||||
SkRect clippedSrcRect = SkRect::Make(clippedSrcIRect);
|
||||
|
||||
int nx = bitmap.width() / tileSize;
|
||||
int ny = bitmap.height() / tileSize;
|
||||
|
@ -229,7 +229,7 @@ bool SkImageDecoder::cropBitmap(SkBitmap *dst, SkBitmap *src, int sampleSize,
|
||||
int srcX, int srcY) {
|
||||
int w = width / sampleSize;
|
||||
int h = height / sampleSize;
|
||||
if (src->getConfig() == SkBitmap::kIndex8_Config) {
|
||||
if (src->config() == SkBitmap::kIndex8_Config) {
|
||||
// kIndex8 does not allow drawing via an SkCanvas, as is done below.
|
||||
// Instead, use extractSubset. Note that this shares the SkPixelRef and
|
||||
// SkColorTable.
|
||||
@ -245,7 +245,7 @@ bool SkImageDecoder::cropBitmap(SkBitmap *dst, SkBitmap *src, int sampleSize,
|
||||
}
|
||||
// if the destination has no pixels then we must allocate them.
|
||||
if (dst->isNull()) {
|
||||
dst->setConfig(src->getConfig(), w, h, 0, src->alphaType());
|
||||
dst->setConfig(src->config(), w, h, 0, src->alphaType());
|
||||
|
||||
if (!this->allocPixelRef(dst, NULL)) {
|
||||
SkDEBUGF(("failed to allocate pixels needed to crop the bitmap"));
|
||||
|
@ -1123,7 +1123,7 @@ private:
|
||||
|
||||
bool SkPNGImageEncoder::onEncode(SkWStream* stream, const SkBitmap& bitmap,
|
||||
int /*quality*/) {
|
||||
SkBitmap::Config config = bitmap.getConfig();
|
||||
SkBitmap::Config config = bitmap.config();
|
||||
|
||||
const bool hasAlpha = !bitmap.isOpaque();
|
||||
int colorType = PNG_COLOR_MASK_COLOR;
|
||||
|
@ -521,7 +521,7 @@ private:
|
||||
|
||||
bool SkWEBPImageEncoder::onEncode(SkWStream* stream, const SkBitmap& bm,
|
||||
int quality) {
|
||||
const SkBitmap::Config config = bm.getConfig();
|
||||
const SkBitmap::Config config = bm.config();
|
||||
const ScanlineImporter scanline_import = ChooseImporter(config);
|
||||
if (NULL == scanline_import) {
|
||||
return false;
|
||||
|
@ -87,7 +87,7 @@ static ScanlineImporter ChooseImporter(const SkBitmap::Config& config) {
|
||||
}
|
||||
|
||||
bool SkARGBImageEncoder::onEncode(SkWStream* stream, const SkBitmap& bitmap, int) {
|
||||
const SkBitmap::Config config = bitmap.getConfig();
|
||||
const SkBitmap::Config config = bitmap.config();
|
||||
const ScanlineImporter scanline_import = ChooseImporter(config);
|
||||
if (NULL == scanline_import) {
|
||||
return false;
|
||||
|
@ -1607,13 +1607,13 @@ bool SkPDFDevice::handleRectAnnotation(const SkRect& r, const SkMatrix& matrix,
|
||||
SkData* urlData = annotationInfo->find(SkAnnotationKeys::URL_Key());
|
||||
if (urlData) {
|
||||
handleLinkToURL(urlData, r, matrix);
|
||||
return p.isNoDrawAnnotation();
|
||||
return p.getAnnotation() != NULL;
|
||||
}
|
||||
SkData* linkToName = annotationInfo->find(
|
||||
SkAnnotationKeys::Link_Named_Dest_Key());
|
||||
if (linkToName) {
|
||||
handleLinkToNamedDest(linkToName, r, matrix);
|
||||
return p.isNoDrawAnnotation();
|
||||
return p.getAnnotation() != NULL;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -1631,7 +1631,7 @@ bool SkPDFDevice::handlePointAnnotation(const SkPoint* points, size_t count,
|
||||
for (size_t i = 0; i < count; i++) {
|
||||
defineNamedDestination(nameData, points[i], matrix);
|
||||
}
|
||||
return paint.isNoDrawAnnotation();
|
||||
return paint.getAnnotation() != NULL;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ static bool skip_compression(SkPDFCatalog* catalog) {
|
||||
|
||||
static size_t get_uncompressed_size(const SkBitmap& bitmap,
|
||||
const SkIRect& srcRect) {
|
||||
switch (bitmap.getConfig()) {
|
||||
switch (bitmap.config()) {
|
||||
case SkBitmap::kIndex8_Config:
|
||||
return srcRect.width() * srcRect.height();
|
||||
case SkBitmap::kARGB_4444_Config:
|
||||
@ -491,7 +491,7 @@ static SkBitmap unpremultiply_bitmap(const SkBitmap& bitmap,
|
||||
SkPDFImage* SkPDFImage::CreateImage(const SkBitmap& bitmap,
|
||||
const SkIRect& srcRect,
|
||||
SkPicture::EncodeBitmap encoder) {
|
||||
if (bitmap.getConfig() == SkBitmap::kNo_Config) {
|
||||
if (bitmap.config() == SkBitmap::kNo_Config) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -569,7 +569,7 @@ SkPDFImage::SkPDFImage(SkStream* stream,
|
||||
fStreamValid = false;
|
||||
}
|
||||
|
||||
SkBitmap::Config config = fBitmap.getConfig();
|
||||
SkBitmap::Config config = fBitmap.config();
|
||||
|
||||
insertName("Type", "XObject");
|
||||
insertName("Subtype", "Image");
|
||||
|
@ -294,7 +294,7 @@ private:
|
||||
|
||||
inline void doNotify() {
|
||||
if (!fDone) {
|
||||
size_t bytes = fWriter.size() - fBytesNotified;
|
||||
size_t bytes = fWriter.bytesWritten() - fBytesNotified;
|
||||
if (bytes > 0) {
|
||||
fController->notifyWritten(bytes);
|
||||
fBytesNotified += bytes;
|
||||
@ -467,7 +467,7 @@ bool SkGPipeCanvas::needOpBytes(size_t needed) {
|
||||
}
|
||||
|
||||
needed += 4; // size of DrawOp atom
|
||||
if (fWriter.size() + needed > fBlockSize) {
|
||||
if (fWriter.bytesWritten() + needed > fBlockSize) {
|
||||
// Before we wipe out any data that has already been written, read it
|
||||
// out.
|
||||
this->doNotify();
|
||||
|
@ -219,7 +219,7 @@ bool SkImageEncoder_CG::onEncode(SkWStream* stream, const SkBitmap& bm,
|
||||
// format.
|
||||
// <Error>: CGImageDestinationFinalize image destination does not have enough images
|
||||
// So instead we copy to 8888.
|
||||
if (bm.getConfig() == SkBitmap::kARGB_4444_Config) {
|
||||
if (bm.config() == SkBitmap::kARGB_4444_Config) {
|
||||
bm.copyTo(&bitmap8888, SkBitmap::kARGB_8888_Config);
|
||||
bmPtr = &bitmap8888;
|
||||
}
|
||||
|
@ -171,7 +171,7 @@ static void setup_MC_state(SkMCState* state, const SkMatrix& matrix, const SkReg
|
||||
}
|
||||
|
||||
// allocate memory for the clip then and copy them to the struct
|
||||
state->clipRects = (ClipRect*) sk_malloc_throw(clipWriter.size());
|
||||
state->clipRects = (ClipRect*) sk_malloc_throw(clipWriter.bytesWritten());
|
||||
clipWriter.flatten(state->clipRects);
|
||||
}
|
||||
|
||||
@ -239,9 +239,9 @@ SkCanvasState* SkCanvasStateUtils::CaptureCanvasState(SkCanvas* canvas) {
|
||||
}
|
||||
|
||||
// allocate memory for the layers and then and copy them to the struct
|
||||
SkASSERT(layerWriter.size() == layerCount * sizeof(SkCanvasLayerState));
|
||||
SkASSERT(layerWriter.bytesWritten() == layerCount * sizeof(SkCanvasLayerState));
|
||||
canvasState->layerCount = layerCount;
|
||||
canvasState->layers = (SkCanvasLayerState*) sk_malloc_throw(layerWriter.size());
|
||||
canvasState->layers = (SkCanvasLayerState*) sk_malloc_throw(layerWriter.bytesWritten());
|
||||
layerWriter.flatten(canvasState->layers);
|
||||
|
||||
// for now, just ignore any client supplied DrawFilter.
|
||||
|
@ -109,8 +109,8 @@ public:
|
||||
|
||||
/**
|
||||
Returns the vector of draw commands
|
||||
DEPRECATED: please use getDrawCommandAt and getSize instead
|
||||
*/
|
||||
SK_ATTR_DEPRECATED("please use getDrawCommandAt and getSize instead")
|
||||
const SkTDArray<SkDrawCommand*>& getDrawCommands() const;
|
||||
|
||||
/**
|
||||
|
@ -31,7 +31,7 @@ SkString* SkObjectParser::BitmapToString(const SkBitmap& bitmap) {
|
||||
SkASSERT(SkBitmap::kConfigCount == 7);
|
||||
|
||||
mBitmap->append(" Config: ");
|
||||
mBitmap->append(gConfigStrings[bitmap.getConfig()]);
|
||||
mBitmap->append(gConfigStrings[bitmap.config()]);
|
||||
|
||||
if (bitmap.isOpaque()) {
|
||||
mBitmap->append(" opaque");
|
||||
|
@ -117,7 +117,7 @@ void SkWindow::eraseARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b)
|
||||
|
||||
void SkWindow::eraseRGB(U8CPU r, U8CPU g, U8CPU b)
|
||||
{
|
||||
fBitmap.eraseRGB(r, g, b);
|
||||
fBitmap.eraseARGB(0xFF, r, g, b);
|
||||
}
|
||||
|
||||
bool SkWindow::handleInval(const SkRect* localR)
|
||||
|
@ -96,7 +96,7 @@ static uint32_t getPixel(int x, int y, const SkBitmap& bm) {
|
||||
SkAutoLockPixels lock(bm);
|
||||
const void* rawAddr = bm.getAddr(x,y);
|
||||
|
||||
switch (bm.getConfig()) {
|
||||
switch (bm.config()) {
|
||||
case SkBitmap::kARGB_8888_Config:
|
||||
memcpy(&val, rawAddr, sizeof(uint32_t));
|
||||
break;
|
||||
@ -130,7 +130,7 @@ static void setPixel(int x, int y, uint32_t val, SkBitmap& bm) {
|
||||
SkAutoLockPixels lock(bm);
|
||||
void* rawAddr = bm.getAddr(x,y);
|
||||
|
||||
switch (bm.getConfig()) {
|
||||
switch (bm.config()) {
|
||||
case SkBitmap::kARGB_8888_Config:
|
||||
memcpy(rawAddr, &val, sizeof(uint32_t));
|
||||
break;
|
||||
@ -162,7 +162,7 @@ static void setPixel(int x, int y, uint32_t val, SkBitmap& bm) {
|
||||
// Utility to return string containing name of each format, to
|
||||
// simplify diagnostic output.
|
||||
static const char* getSkConfigName(const SkBitmap& bm) {
|
||||
switch (bm.getConfig()) {
|
||||
switch (bm.config()) {
|
||||
case SkBitmap::kNo_Config: return "SkBitmap::kNo_Config";
|
||||
case SkBitmap::kA1_Config: return "SkBitmap::kA1_Config";
|
||||
case SkBitmap::kA8_Config: return "SkBitmap::kA8_Config";
|
||||
@ -458,7 +458,7 @@ static void TestBitmapCopy(skiatest::Reporter* reporter) {
|
||||
|
||||
srcReady = src.extractSubset(&subset, r);
|
||||
} else {
|
||||
srcReady = src.copyTo(&subset, src.getConfig());
|
||||
srcReady = src.copyTo(&subset, src.config());
|
||||
}
|
||||
|
||||
// Not all configurations will generate a valid 'subset'.
|
||||
@ -469,7 +469,7 @@ static void TestBitmapCopy(skiatest::Reporter* reporter) {
|
||||
// buf to a SkBitmap, but copies are done using the
|
||||
// raw buffer pointer.
|
||||
const size_t bufSize = subH *
|
||||
SkBitmap::ComputeRowBytes(src.getConfig(), subW) * 2;
|
||||
SkBitmap::ComputeRowBytes(src.config(), subW) * 2;
|
||||
SkAutoMalloc autoBuf (bufSize);
|
||||
uint8_t* buf = static_cast<uint8_t*>(autoBuf.get());
|
||||
|
||||
@ -496,8 +496,7 @@ static void TestBitmapCopy(skiatest::Reporter* reporter) {
|
||||
memset(buf, 0xFF, bufSize);
|
||||
// Config with stride greater than src but that fits in buf.
|
||||
bufBm.setConfig(gPairs[i].fConfig, subW, subH,
|
||||
SkBitmap::ComputeRowBytes(subset.getConfig(), subW)
|
||||
* 2);
|
||||
SkBitmap::ComputeRowBytes(subset.config(), subW) * 2);
|
||||
bufBm.setPixels(buf);
|
||||
successExpected = false;
|
||||
// Then attempt to copy with a stride that is too large
|
||||
|
@ -139,7 +139,7 @@ static void TestGpuBitmapCopy(skiatest::Reporter* reporter, GrContextFactory* fa
|
||||
SkCanvas drawingCanvas(device);
|
||||
SkPaint paint;
|
||||
paint.setColor(SK_ColorRED);
|
||||
drawingCanvas.drawRect(SkRect::MakeFromIRect(subsetRect), paint);
|
||||
drawingCanvas.drawRect(SkRect::Make(subsetRect), paint);
|
||||
|
||||
// Extract a subset. If this succeeds we will test copying the subset.
|
||||
SkBitmap subset;
|
||||
|
@ -73,8 +73,7 @@ static bool nearly_equal(const SkMatrix44& a, const SkMatrix44& b) {
|
||||
}
|
||||
|
||||
static bool is_identity(const SkMatrix44& m) {
|
||||
SkMatrix44 identity;
|
||||
identity.reset();
|
||||
SkMatrix44 identity(SkMatrix44::kIdentity_Constructor);
|
||||
return nearly_equal(m, identity);
|
||||
}
|
||||
|
||||
@ -85,7 +84,7 @@ static bool bits_isonly(int value, int mask) {
|
||||
|
||||
static void test_constructor(skiatest::Reporter* reporter) {
|
||||
// Allocate a matrix on the heap
|
||||
SkMatrix44* placeholderMatrix = new SkMatrix44();
|
||||
SkMatrix44* placeholderMatrix = new SkMatrix44(SkMatrix44::kUninitialized_Constructor);
|
||||
SkAutoTDelete<SkMatrix44> deleteMe(placeholderMatrix);
|
||||
|
||||
for (int row = 0; row < 4; ++row) {
|
||||
@ -115,7 +114,8 @@ static void test_constructor(skiatest::Reporter* reporter) {
|
||||
}
|
||||
|
||||
static void test_translate(skiatest::Reporter* reporter) {
|
||||
SkMatrix44 mat, inverse;
|
||||
SkMatrix44 mat(SkMatrix44::kUninitialized_Constructor);
|
||||
SkMatrix44 inverse(SkMatrix44::kUninitialized_Constructor);
|
||||
|
||||
mat.setTranslate(0, 0, 0);
|
||||
REPORTER_ASSERT(reporter, bits_isonly(mat.getType(), SkMatrix44::kIdentity_Mask));
|
||||
@ -124,7 +124,9 @@ static void test_translate(skiatest::Reporter* reporter) {
|
||||
REPORTER_ASSERT(reporter, mat.invert(&inverse));
|
||||
REPORTER_ASSERT(reporter, bits_isonly(inverse.getType(), SkMatrix44::kTranslate_Mask));
|
||||
|
||||
SkMatrix44 a, b, c;
|
||||
SkMatrix44 a(SkMatrix44::kUninitialized_Constructor);
|
||||
SkMatrix44 b(SkMatrix44::kUninitialized_Constructor);
|
||||
SkMatrix44 c(SkMatrix44::kUninitialized_Constructor);
|
||||
a.set3x3(1, 2, 3, 4, 5, 6, 7, 8, 9);
|
||||
b.setTranslate(10, 11, 12);
|
||||
|
||||
@ -140,7 +142,8 @@ static void test_translate(skiatest::Reporter* reporter) {
|
||||
}
|
||||
|
||||
static void test_scale(skiatest::Reporter* reporter) {
|
||||
SkMatrix44 mat, inverse;
|
||||
SkMatrix44 mat(SkMatrix44::kUninitialized_Constructor);
|
||||
SkMatrix44 inverse(SkMatrix44::kUninitialized_Constructor);
|
||||
|
||||
mat.setScale(1, 1, 1);
|
||||
REPORTER_ASSERT(reporter, bits_isonly(mat.getType(), SkMatrix44::kIdentity_Mask));
|
||||
@ -149,7 +152,9 @@ static void test_scale(skiatest::Reporter* reporter) {
|
||||
REPORTER_ASSERT(reporter, mat.invert(&inverse));
|
||||
REPORTER_ASSERT(reporter, bits_isonly(inverse.getType(), SkMatrix44::kScale_Mask));
|
||||
|
||||
SkMatrix44 a, b, c;
|
||||
SkMatrix44 a(SkMatrix44::kUninitialized_Constructor);
|
||||
SkMatrix44 b(SkMatrix44::kUninitialized_Constructor);
|
||||
SkMatrix44 c(SkMatrix44::kUninitialized_Constructor);
|
||||
a.set3x3(1, 2, 3, 4, 5, 6, 7, 8, 9);
|
||||
b.setScale(10, 11, 12);
|
||||
|
||||
@ -207,7 +212,7 @@ static void test_map2(skiatest::Reporter* reporter, const SkMatrix44& mat) {
|
||||
}
|
||||
|
||||
static void test_map2(skiatest::Reporter* reporter) {
|
||||
SkMatrix44 mat;
|
||||
SkMatrix44 mat(SkMatrix44::kUninitialized_Constructor);
|
||||
|
||||
for (size_t i = 0; i < SK_ARRAY_COUNT(gMakeProcs); ++i) {
|
||||
gMakeProcs[i](&mat);
|
||||
@ -216,7 +221,7 @@ static void test_map2(skiatest::Reporter* reporter) {
|
||||
}
|
||||
|
||||
static void test_gettype(skiatest::Reporter* reporter) {
|
||||
SkMatrix44 matrix;
|
||||
SkMatrix44 matrix(SkMatrix44::kIdentity_Constructor);
|
||||
|
||||
REPORTER_ASSERT(reporter, matrix.isIdentity());
|
||||
REPORTER_ASSERT(reporter, SkMatrix44::kIdentity_Mask == matrix.getType());
|
||||
@ -251,7 +256,7 @@ static void test_gettype(skiatest::Reporter* reporter) {
|
||||
}
|
||||
|
||||
static void test_common_angles(skiatest::Reporter* reporter) {
|
||||
SkMatrix44 rot;
|
||||
SkMatrix44 rot(SkMatrix44::kUninitialized_Constructor);
|
||||
// Test precision of rotation in common cases
|
||||
int common_angles[] = { 0, 90, -90, 180, -180, 270, -270, 360, -360 };
|
||||
for (int i = 0; i < 9; ++i) {
|
||||
@ -264,7 +269,10 @@ static void test_common_angles(skiatest::Reporter* reporter) {
|
||||
|
||||
static void test_concat(skiatest::Reporter* reporter) {
|
||||
int i;
|
||||
SkMatrix44 a, b, c, d;
|
||||
SkMatrix44 a(SkMatrix44::kUninitialized_Constructor);
|
||||
SkMatrix44 b(SkMatrix44::kUninitialized_Constructor);
|
||||
SkMatrix44 c(SkMatrix44::kUninitialized_Constructor);
|
||||
SkMatrix44 d(SkMatrix44::kUninitialized_Constructor);
|
||||
|
||||
a.setTranslate(10, 10, 10);
|
||||
b.setScale(2, 2, 2);
|
||||
@ -301,11 +309,11 @@ static void test_concat(skiatest::Reporter* reporter) {
|
||||
}
|
||||
|
||||
static void test_determinant(skiatest::Reporter* reporter) {
|
||||
SkMatrix44 a;
|
||||
SkMatrix44 a(SkMatrix44::kIdentity_Constructor);
|
||||
REPORTER_ASSERT(reporter, nearly_equal_double(1, a.determinant()));
|
||||
a.set(1, 1, 2);
|
||||
REPORTER_ASSERT(reporter, nearly_equal_double(2, a.determinant()));
|
||||
SkMatrix44 b;
|
||||
SkMatrix44 b(SkMatrix44::kUninitialized_Constructor);
|
||||
REPORTER_ASSERT(reporter, a.invert(&b));
|
||||
REPORTER_ASSERT(reporter, nearly_equal_double(0.5, b.determinant()));
|
||||
SkMatrix44 c = b = a;
|
||||
@ -326,11 +334,10 @@ static void test_determinant(skiatest::Reporter* reporter) {
|
||||
}
|
||||
|
||||
static void test_invert(skiatest::Reporter* reporter) {
|
||||
SkMatrix44 inverse;
|
||||
SkMatrix44 inverse(SkMatrix44::kUninitialized_Constructor);
|
||||
double inverseData[16];
|
||||
|
||||
SkMatrix44 identity;
|
||||
identity.setIdentity();
|
||||
SkMatrix44 identity(SkMatrix44::kIdentity_Constructor);
|
||||
identity.invert(&inverse);
|
||||
inverse.asRowMajord(inverseData);
|
||||
assert16<double>(reporter, inverseData,
|
||||
@ -339,7 +346,7 @@ static void test_invert(skiatest::Reporter* reporter) {
|
||||
0, 0, 1, 0,
|
||||
0, 0, 0, 1);
|
||||
|
||||
SkMatrix44 translation;
|
||||
SkMatrix44 translation(SkMatrix44::kUninitialized_Constructor);
|
||||
translation.setTranslate(2, 3, 4);
|
||||
translation.invert(&inverse);
|
||||
inverse.asRowMajord(inverseData);
|
||||
@ -349,7 +356,7 @@ static void test_invert(skiatest::Reporter* reporter) {
|
||||
0, 0, 1, -4,
|
||||
0, 0, 0, 1);
|
||||
|
||||
SkMatrix44 scale;
|
||||
SkMatrix44 scale(SkMatrix44::kUninitialized_Constructor);
|
||||
scale.setScale(2, 4, 8);
|
||||
scale.invert(&inverse);
|
||||
inverse.asRowMajord(inverseData);
|
||||
@ -359,7 +366,7 @@ static void test_invert(skiatest::Reporter* reporter) {
|
||||
0, 0, 0.125, 0,
|
||||
0, 0, 0, 1);
|
||||
|
||||
SkMatrix44 scaleTranslation;
|
||||
SkMatrix44 scaleTranslation(SkMatrix44::kUninitialized_Constructor);
|
||||
scaleTranslation.setScale(10, 100, 1000);
|
||||
scaleTranslation.preTranslate(2, 3, 4);
|
||||
scaleTranslation.invert(&inverse);
|
||||
@ -370,10 +377,10 @@ static void test_invert(skiatest::Reporter* reporter) {
|
||||
0, 0, 0.001, -4,
|
||||
0, 0, 0, 1);
|
||||
|
||||
SkMatrix44 rotation;
|
||||
SkMatrix44 rotation(SkMatrix44::kUninitialized_Constructor);
|
||||
rotation.setRotateDegreesAbout(0, 0, 1, 90);
|
||||
rotation.invert(&inverse);
|
||||
SkMatrix44 expected;
|
||||
SkMatrix44 expected(SkMatrix44::kUninitialized_Constructor);
|
||||
double expectedInverseRotation[16] =
|
||||
{0, 1, 0, 0,
|
||||
-1, 0, 0, 0,
|
||||
@ -382,7 +389,7 @@ static void test_invert(skiatest::Reporter* reporter) {
|
||||
expected.setRowMajord(expectedInverseRotation);
|
||||
REPORTER_ASSERT(reporter, nearly_equal(expected, inverse));
|
||||
|
||||
SkMatrix44 affine;
|
||||
SkMatrix44 affine(SkMatrix44::kUninitialized_Constructor);
|
||||
affine.setRotateDegreesAbout(0, 0, 1, 90);
|
||||
affine.preScale(10, 20, 100);
|
||||
affine.preTranslate(2, 3, 4);
|
||||
@ -395,8 +402,7 @@ static void test_invert(skiatest::Reporter* reporter) {
|
||||
expected.setRowMajord(expectedInverseAffine);
|
||||
REPORTER_ASSERT(reporter, nearly_equal(expected, inverse));
|
||||
|
||||
SkMatrix44 perspective;
|
||||
perspective.setIdentity();
|
||||
SkMatrix44 perspective(SkMatrix44::kIdentity_Constructor);
|
||||
perspective.setDouble(3, 2, 1.0);
|
||||
perspective.invert(&inverse);
|
||||
double expectedInversePerspective[16] =
|
||||
@ -407,8 +413,7 @@ static void test_invert(skiatest::Reporter* reporter) {
|
||||
expected.setRowMajord(expectedInversePerspective);
|
||||
REPORTER_ASSERT(reporter, nearly_equal(expected, inverse));
|
||||
|
||||
SkMatrix44 affineAndPerspective;
|
||||
affineAndPerspective.setIdentity();
|
||||
SkMatrix44 affineAndPerspective(SkMatrix44::kIdentity_Constructor);
|
||||
affineAndPerspective.setDouble(3, 2, 1.0);
|
||||
affineAndPerspective.preScale(10, 20, 100);
|
||||
affineAndPerspective.preTranslate(2, 3, 4);
|
||||
@ -423,8 +428,8 @@ static void test_invert(skiatest::Reporter* reporter) {
|
||||
}
|
||||
|
||||
static void test_transpose(skiatest::Reporter* reporter) {
|
||||
SkMatrix44 a;
|
||||
SkMatrix44 b;
|
||||
SkMatrix44 a(SkMatrix44::kUninitialized_Constructor);
|
||||
SkMatrix44 b(SkMatrix44::kUninitialized_Constructor);
|
||||
|
||||
int i = 0;
|
||||
for (int row = 0; row < 4; ++row) {
|
||||
@ -439,7 +444,7 @@ static void test_transpose(skiatest::Reporter* reporter) {
|
||||
}
|
||||
|
||||
static void test_get_set_double(skiatest::Reporter* reporter) {
|
||||
SkMatrix44 a;
|
||||
SkMatrix44 a(SkMatrix44::kUninitialized_Constructor);
|
||||
for (int row = 0; row < 4; ++row) {
|
||||
for (int col = 0; col < 4; ++col) {
|
||||
a.setDouble(row, col, 3.141592653589793);
|
||||
@ -454,7 +459,9 @@ static void test_get_set_double(skiatest::Reporter* reporter) {
|
||||
}
|
||||
|
||||
static void test_set_row_col_major(skiatest::Reporter* reporter) {
|
||||
SkMatrix44 a, b, c, d;
|
||||
SkMatrix44 a(SkMatrix44::kUninitialized_Constructor);
|
||||
SkMatrix44 b(SkMatrix44::kUninitialized_Constructor);
|
||||
|
||||
for (int row = 0; row < 4; ++row) {
|
||||
for (int col = 0; col < 4; ++col) {
|
||||
a.setDouble(row, col, row * 4 + col);
|
||||
@ -489,7 +496,7 @@ static void test_3x3_conversion(skiatest::Reporter* reporter) {
|
||||
5, 6, 0, 8,
|
||||
0, 0, 1, 0,
|
||||
13, 14, 0, 16 };
|
||||
SkMatrix44 a44;
|
||||
SkMatrix44 a44(SkMatrix44::kUninitialized_Constructor);
|
||||
a44.setRowMajor(values4x4);
|
||||
|
||||
SkMatrix a33 = a44;
|
||||
@ -498,7 +505,7 @@ static void test_3x3_conversion(skiatest::Reporter* reporter) {
|
||||
REPORTER_ASSERT(reporter, expected33 == a33);
|
||||
|
||||
SkMatrix44 a44flattened = a33;
|
||||
SkMatrix44 expected44flattened;
|
||||
SkMatrix44 expected44flattened(SkMatrix44::kUninitialized_Constructor);
|
||||
expected44flattened.setRowMajor(values4x4flattened);
|
||||
REPORTER_ASSERT(reporter, nearly_equal(a44flattened, expected44flattened));
|
||||
|
||||
@ -522,9 +529,12 @@ static void test_3x3_conversion(skiatest::Reporter* reporter) {
|
||||
}
|
||||
|
||||
static void TestMatrix44(skiatest::Reporter* reporter) {
|
||||
SkMatrix44 mat, inverse, iden1, iden2, rot;
|
||||
SkMatrix44 mat(SkMatrix44::kUninitialized_Constructor);
|
||||
SkMatrix44 inverse(SkMatrix44::kUninitialized_Constructor);
|
||||
SkMatrix44 iden1(SkMatrix44::kUninitialized_Constructor);
|
||||
SkMatrix44 iden2(SkMatrix44::kUninitialized_Constructor);
|
||||
SkMatrix44 rot(SkMatrix44::kUninitialized_Constructor);
|
||||
|
||||
mat.reset();
|
||||
mat.setTranslate(1, 1, 1);
|
||||
mat.invert(&inverse);
|
||||
iden1.setConcat(mat, inverse);
|
||||
|
@ -1768,7 +1768,7 @@ static void write_and_read_back(skiatest::Reporter* reporter,
|
||||
const SkPath& p) {
|
||||
SkWriter32 writer(100);
|
||||
writer.writePath(p);
|
||||
size_t size = writer.size();
|
||||
size_t size = writer.bytesWritten();
|
||||
SkAutoMalloc storage(size);
|
||||
writer.flatten(storage.get());
|
||||
SkReader32 reader(storage.get(), size);
|
||||
|
@ -37,7 +37,8 @@ static void test_asShaderMode(skiatest::Reporter* reporter) {
|
||||
SkShader* s = SkGradientShader::CreateRadial(
|
||||
center, radius, colors, pos, SK_ARRAY_COUNT(colors), SkShader::kClamp_TileMode);
|
||||
SkPaint paint;
|
||||
paint.setImageFilter(SkRectShaderImageFilter::Create(s, r))->unref();
|
||||
SkImageFilter::CropRect cr(r);
|
||||
paint.setImageFilter(SkRectShaderImageFilter::Create(s, &cr))->unref();
|
||||
canvasFilter.drawRect(r, paint);
|
||||
s->unref();
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ static void test_ptr(skiatest::Reporter* reporter) {
|
||||
writer.writePtr(p1);
|
||||
writer.write8(0x66);
|
||||
|
||||
size_t size = writer.size();
|
||||
size_t size = writer.bytesWritten();
|
||||
REPORTER_ASSERT(reporter, 2 * sizeof(void*) + 2 * sizeof(int32_t));
|
||||
|
||||
char buffer[32];
|
||||
@ -103,14 +103,14 @@ static void test_ptr(skiatest::Reporter* reporter) {
|
||||
static void test1(skiatest::Reporter* reporter, SkWriter32* writer) {
|
||||
const uint32_t data[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
|
||||
for (size_t i = 0; i < SK_ARRAY_COUNT(data); ++i) {
|
||||
REPORTER_ASSERT(reporter, i*4 == writer->size());
|
||||
REPORTER_ASSERT(reporter, i*4 == writer->bytesWritten());
|
||||
writer->write32(data[i]);
|
||||
uint32_t* addr = writer->peek32(i * 4);
|
||||
REPORTER_ASSERT(reporter, data[i] == *addr);
|
||||
}
|
||||
|
||||
char buffer[sizeof(data)];
|
||||
REPORTER_ASSERT(reporter, sizeof(buffer) == writer->size());
|
||||
REPORTER_ASSERT(reporter, sizeof(buffer) == writer->bytesWritten());
|
||||
writer->flatten(buffer);
|
||||
REPORTER_ASSERT(reporter, !memcmp(data, buffer, sizeof(buffer)));
|
||||
}
|
||||
@ -124,7 +124,7 @@ static void test2(skiatest::Reporter* reporter, SkWriter32* writer) {
|
||||
len += SkWriter32::WriteStringSize(gStr, i);
|
||||
writer->writeString(gStr, i);
|
||||
}
|
||||
REPORTER_ASSERT(reporter, writer->size() == len);
|
||||
REPORTER_ASSERT(reporter, writer->bytesWritten() == len);
|
||||
|
||||
SkAutoMalloc storage(len);
|
||||
writer->flatten(storage.get());
|
||||
@ -167,7 +167,7 @@ static void testWritePad(skiatest::Reporter* reporter, SkWriter32* writer) {
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t totalBytes = writer->size();
|
||||
uint32_t totalBytes = writer->bytesWritten();
|
||||
|
||||
SkAutoMalloc readStorage(totalBytes);
|
||||
writer->flatten(readStorage.get());
|
||||
|
@ -23,7 +23,7 @@ static void test_asMode(skiatest::Reporter* reporter) {
|
||||
REPORTER_ASSERT(reporter, reportedMode != mode);
|
||||
|
||||
// test IsMode
|
||||
REPORTER_ASSERT(reporter, SkXfermode::IsMode(xfer, &reportedMode));
|
||||
REPORTER_ASSERT(reporter, SkXfermode::AsMode(xfer, &reportedMode));
|
||||
REPORTER_ASSERT(reporter, reportedMode == mode);
|
||||
|
||||
// repeat that test, but with asMode instead
|
||||
@ -41,7 +41,7 @@ static void test_asMode(skiatest::Reporter* reporter) {
|
||||
SkXfermode::Mode reportedMode = ILLEGAL_MODE;
|
||||
REPORTER_ASSERT(reporter, !bogusXfer->asMode(&reportedMode));
|
||||
REPORTER_ASSERT(reporter, reportedMode == ILLEGAL_MODE);
|
||||
REPORTER_ASSERT(reporter, !SkXfermode::IsMode(bogusXfer, &reportedMode));
|
||||
REPORTER_ASSERT(reporter, !SkXfermode::AsMode(bogusXfer, &reportedMode));
|
||||
REPORTER_ASSERT(reporter, reportedMode == ILLEGAL_MODE);
|
||||
bogusXfer->unref();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user