SkAutoTUnref<SkSurface> surface(canvas->newSurface(info));
if (surface.get()) {
SkCanvas* surfCanvas = surface->getCanvas();
-
+
draw_content(surfCanvas);
SkBitmap bitmap;
-
+
// test peekPixels
{
SkImageInfo info;
canvas->drawBitmap(bitmap, 0, 0, NULL);
}
}
-
+
// test ROCanvasPixels
canvas->translate(120, 0);
SkAutoROCanvasPixels ropixels(surfCanvas);
if (ropixels.asROBitmap(&bitmap)) {
canvas->drawBitmap(bitmap, 0, 0, NULL);
}
-
+
// test Surface
canvas->translate(120, 0);
surface->draw(canvas, 0, 0, NULL);
// returns NULL on failure
const void* addr() const { return fAddr; }
-
+
// undefined if addr() == NULL
size_t rowBytes() const { return fRowBytes; }
-
+
// undefined if addr() == NULL
const SkImageInfo& info() const { return fInfo; }
protected:
// default impl returns NULL
virtual SkSurface* newSurface(const SkImageInfo&);
-
+
// default impl returns NULL
virtual const void* peekPixels(SkImageInfo*, size_t* rowBytes);
-
+
/**
* Leaky properties are those which the device should be applying but it isn't.
* These properties will be applied by the draw, when and as it can.
&info.fAlphaType)) {
return reset_return_false(this);
}
-
+
// require that rowBytes fit in 31bits
int64_t mrb = info.minRowBytes64();
if ((int32_t)mrb != mrb) {
const void* SkSurface::peekPixels(SkImageInfo* info, size_t* rowBytes) {
return this->getCanvas()->peekPixels(info, rowBytes);
}
-
SkASSERT(0);
break;
}
-
+
if (alloc) {
bitmap->allocPixels(info);
} else {
SkBitmap grBitmap;
grBitmap.allocPixels(grCanvas.imageInfo());
grCanvas.readPixels(&grBitmap, 0, 0);
-
+
if (fTestStep == kCompareBits) {
fPixelError = similarBits(grBitmap, bitmap);
int skTime = timePict(pic, &skCanvas);
{ kPicture_ImageType, false },
{ kCodec_ImageType, false },
};
-
+
const SkColor color = SK_ColorRED;
const SkPMColor pmcolor = SkPreMultiplyColor(color);
-
+
for (size_t i = 0; i < SK_ARRAY_COUNT(gRec); ++i) {
SkImageInfo info;
size_t rowBytes;
-
+
SkAutoTUnref<SkImage> image(createImage(gRec[i].fType, NULL, color));
if (!image.get()) {
continue; // gpu may not be enabled