зеркало из https://github.com/mozilla/moz-skia.git
Sanitizing source files in Housekeeper-Nightly
git-svn-id: http://skia.googlecode.com/svn/trunk@14320 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
Родитель
8798ae37da
Коммит
ede0c5c778
|
@ -135,35 +135,35 @@ static void test_image(SkCanvas* canvas, const SkImageInfo& info) {
|
|||
} else {
|
||||
bm.eraseColor(0);
|
||||
}
|
||||
|
||||
|
||||
SkPaint paint;
|
||||
paint.setAntiAlias(true);
|
||||
paint.setColor(SK_ColorBLUE);
|
||||
newc->drawCircle(50, 50, 49, paint);
|
||||
canvas->drawBitmap(bm, 10, 10);
|
||||
|
||||
|
||||
CGImageRef image = SkCreateCGImageRefWithColorspace(bm, NULL);
|
||||
|
||||
|
||||
SkBitmap bm2;
|
||||
SkCreateBitmapFromCGImage(&bm2, image);
|
||||
CGImageRelease(image);
|
||||
|
||||
|
||||
canvas->drawBitmap(bm2, 10, 120);
|
||||
}
|
||||
|
||||
class CGImageGM : public skiagm::GM {
|
||||
public:
|
||||
CGImageGM() {}
|
||||
|
||||
|
||||
protected:
|
||||
virtual SkString onShortName() SK_OVERRIDE {
|
||||
return SkString("cgimage");
|
||||
}
|
||||
|
||||
|
||||
virtual SkISize onISize() SK_OVERRIDE {
|
||||
return SkISize::Make(800, 250);
|
||||
}
|
||||
|
||||
|
||||
virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
|
||||
const struct {
|
||||
SkColorType fCT;
|
||||
|
@ -179,16 +179,16 @@ protected:
|
|||
{ kBGRA_8888_SkColorType, kUnpremul_SkAlphaType },
|
||||
{ kBGRA_8888_SkColorType, kOpaque_SkAlphaType },
|
||||
};
|
||||
|
||||
|
||||
for (size_t i = 0; i < SK_ARRAY_COUNT(rec); ++i) {
|
||||
SkImageInfo info = SkImageInfo::Make(100, 100, rec[i].fCT, rec[i].fAT);
|
||||
test_image(canvas, info);
|
||||
canvas->translate(info.width() + 10, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
virtual uint32_t onGetFlags() const SK_OVERRIDE { return kSkipPipe_Flag; }
|
||||
|
||||
|
||||
private:
|
||||
typedef skiagm::GM INHERITED;
|
||||
};
|
||||
|
|
|
@ -372,4 +372,3 @@ static GMRegistry reg2(MyFactory2);
|
|||
static GM* MyFactory3(void*) { return new ConicalGradientsGM(kEdge_GradCaseType); }
|
||||
static GMRegistry reg3(MyFactory3);
|
||||
}
|
||||
|
||||
|
|
|
@ -453,7 +453,7 @@ GrEffectRef* FocalOutside2PtConicalEffect::TestCreate(SkRandom* random,
|
|||
SkScalar radius2;
|
||||
do {
|
||||
center2.set(random->nextUScalar1(), random->nextUScalar1());
|
||||
// Need to make sure the centers are not the same or else focal point will be inside
|
||||
// Need to make sure the centers are not the same or else focal point will be inside
|
||||
} while (center1 == center2);
|
||||
SkPoint diff = center2 - center1;
|
||||
SkScalar diffLen = diff.length();
|
||||
|
@ -501,8 +501,8 @@ void GLFocalOutside2PtConicalEffect::emitCode(GrGLShaderBuilder* builder,
|
|||
builder->getUniformVariable(fParamUni).appendArrayAccess(1, &p1);
|
||||
|
||||
// if we have a vec3 from being in perspective, convert it to a vec2 first
|
||||
SkString coords2DString = builder->ensureFSCoords2D(coords, 0);
|
||||
const char* coords2D = coords2DString.c_str();
|
||||
SkString coords2DString = builder->ensureFSCoords2D(coords, 0);
|
||||
const char* coords2D = coords2DString.c_str();
|
||||
|
||||
// t = p.x * focal.x +/- sqrt(p.x^2 + (1 - focal.x^2) * p.y^2)
|
||||
|
||||
|
@ -706,8 +706,8 @@ void GLFocalInside2PtConicalEffect::emitCode(GrGLShaderBuilder* builder,
|
|||
GrGLShaderVar focal = builder->getUniformVariable(fFocalUni);
|
||||
|
||||
// if we have a vec3 from being in perspective, convert it to a vec2 first
|
||||
SkString coords2DString = builder->ensureFSCoords2D(coords, 0);
|
||||
const char* coords2D = coords2DString.c_str();
|
||||
SkString coords2DString = builder->ensureFSCoords2D(coords, 0);
|
||||
const char* coords2D = coords2DString.c_str();
|
||||
|
||||
// t = p.x * focalX + length(p)
|
||||
builder->fsCodeAppendf("\tfloat %s = %s.x * %s + length(%s);\n", tName.c_str(),
|
||||
|
@ -955,8 +955,8 @@ void GLCircleInside2PtConicalEffect::emitCode(GrGLShaderBuilder* builder,
|
|||
GrGLShaderVar params = builder->getUniformVariable(fParamUni);
|
||||
|
||||
// if we have a vec3 from being in perspective, convert it to a vec2 first
|
||||
SkString coords2DString = builder->ensureFSCoords2D(coords, 0);
|
||||
const char* coords2D = coords2DString.c_str();
|
||||
SkString coords2DString = builder->ensureFSCoords2D(coords, 0);
|
||||
const char* coords2D = coords2DString.c_str();
|
||||
|
||||
// p = coords2D
|
||||
// e = center end
|
||||
|
@ -1187,8 +1187,8 @@ void GLCircleOutside2PtConicalEffect::emitCode(GrGLShaderBuilder* builder,
|
|||
GrGLShaderVar params = builder->getUniformVariable(fParamUni);
|
||||
|
||||
// if we have a vec3 from being in perspective, convert it to a vec2 first
|
||||
SkString coords2DString = builder->ensureFSCoords2D(coords, 0);
|
||||
const char* coords2D = coords2DString.c_str();
|
||||
SkString coords2DString = builder->ensureFSCoords2D(coords, 0);
|
||||
const char* coords2D = coords2DString.c_str();
|
||||
|
||||
// output will default to transparent black (we simply won't write anything
|
||||
// else to it if invalid, instead of discarding or returning prematurely)
|
||||
|
|
|
@ -78,7 +78,7 @@ bool SkImageDecoder_CG::onDecode(SkStream* stream, SkBitmap* bm, Mode mode) {
|
|||
if (!this->allocPixelRef(bm, NULL)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
SkAutoLockPixels alp(*bm);
|
||||
|
||||
if (!SkCopyPixelsFromCGImage(bm->info(), bm->rowBytes(), bm->getPixels(), image)) {
|
||||
|
|
|
@ -313,4 +313,3 @@ bool SkCreateBitmapFromCGImage(SkBitmap* dst, CGImageRef image, SkISize* scaleTo
|
|||
*dst = tmp;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче