void SkPictureImageFilter::flatten(SkWriteBuffer& buffer) const { this->INHERITED::flatten(buffer); if (!buffer.isCrossProcess()) { bool hasPicture = (fPicture != NULL); buffer.writeBool(hasPicture); if (hasPicture) { fPicture->flatten(buffer); } } else { buffer.writeBool(false); } buffer.writeRect(fCropRect); }
void SkPicture::flatten(SkWriteBuffer& buffer) const { SkPictInfo info = this->createHeader(); SkAutoTDelete<SkPictureData> data(this->backport()); buffer.writeByteArray(&info.fMagic, sizeof(info.fMagic)); buffer.writeUInt(info.fVersion); buffer.writeRect(info.fCullRect); buffer.writeUInt(info.fFlags); if (data) { buffer.writeBool(true); data->flatten(buffer); } else { buffer.writeBool(false); } }
void flatten(SkWriteBuffer& buffer) const override { this->INHERITED::flatten(buffer); for (int i = 0; i < 4; ++i) { buffer.writeScalar(fK[i]); } buffer.writeBool(fEnforcePMColor); }
void SkColor4Shader::flatten(SkWriteBuffer& buffer) const { buffer.writeScalar(fColor4.fR); // writeFloat() buffer.writeScalar(fColor4.fG); buffer.writeScalar(fColor4.fB); buffer.writeScalar(fColor4.fA); buffer.writeBool(false); // TODO how do we flatten colorspaces? }
void SkMergeImageFilter::flatten(SkWriteBuffer& buffer) const { this->INHERITED::flatten(buffer); buffer.writeBool(fModes != nullptr); if (fModes) { buffer.writeByteArray(fModes, this->countInputs() * sizeof(fModes[0])); } }
void SkPictureImageFilter::flatten(SkWriteBuffer& buffer) const { if (buffer.isCrossProcess() && SkPicture::PictureIOSecurityPrecautionsEnabled()) { buffer.writeBool(false); } else { bool hasPicture = (fPicture != NULL); buffer.writeBool(hasPicture); if (hasPicture) { fPicture->flatten(buffer); } } buffer.writeRect(fCropRect); buffer.writeInt(fPictureResolution); if (kLocalSpace_PictureResolution == fPictureResolution) { buffer.writeInt(fFilterQuality); } }
void SkGradientShaderBase::Descriptor::flatten(SkWriteBuffer& buffer) const { buffer.writeColorArray(fColors, fCount); if (fPos) { buffer.writeBool(true); buffer.writeScalarArray(fPos, fCount); } else { buffer.writeBool(false); } buffer.write32(fTileMode); buffer.write32(fGradFlags); if (fLocalMatrix) { buffer.writeBool(true); buffer.writeMatrix(*fLocalMatrix); } else { buffer.writeBool(false); } }
void SkShader::flatten(SkWriteBuffer& buffer) const { this->INHERITED::flatten(buffer); bool hasLocalM = !fLocalMatrix.isIdentity(); buffer.writeBool(hasLocalM); if (hasLocalM) { buffer.writeMatrix(fLocalMatrix); } }
void SkPaintOptionsAndroid::flatten(SkWriteBuffer& buffer) const { buffer.writeUInt(fFontVariant); #ifdef SKLANG_OPT buffer.writeString(getLanguage().getTag().c_str()); #else buffer.writeString(fLanguage.getTag().c_str()); #endif buffer.writeBool(fUseFontFallbacks); }
void SkDashPathEffect::flatten(SkWriteBuffer& buffer) const { SkASSERT(fInitialDashLength >= 0); this->INHERITED::flatten(buffer); buffer.writeInt(fInitialDashIndex); buffer.writeScalar(fInitialDashLength); buffer.writeScalar(fIntervalLength); buffer.writeBool(fScaleToFit); buffer.writeScalarArray(fIntervals, fCount); }
void SkPerlinNoiseShader::flatten(SkWriteBuffer& buffer) const { this->INHERITED::flatten(buffer); buffer.writeInt((int) fType); buffer.writeScalar(fBaseFrequencyX); buffer.writeScalar(fBaseFrequencyY); buffer.writeInt(fNumOctaves); buffer.writeScalar(fSeed); buffer.writeBool(fStitchTiles); buffer.writeInt(fTileSize.fWidth); buffer.writeInt(fTileSize.fHeight); }
void SkImageFilter::flatten(SkWriteBuffer& buffer) const { buffer.writeInt(fInputCount); for (int i = 0; i < fInputCount; i++) { SkImageFilter* input = this->getInput(i); buffer.writeBool(input != nullptr); if (input != nullptr) { buffer.writeFlattenable(input); } } buffer.writeRect(fCropRect.rect()); buffer.writeUInt(fCropRect.flags()); }
void SkPicture::flatten(SkWriteBuffer& buffer) const { SkPicturePlayback* playback = fPlayback; if (NULL == playback && fRecord) { playback = SkNEW_ARGS(SkPicturePlayback, (*fRecord)); } SkPictInfo header; this->createHeader(&header); buffer.writeByteArray(&header, sizeof(header)); if (playback) { buffer.writeBool(true); playback->flatten(buffer); // delete playback if it is a local version (i.e. cons'd up just now) if (playback != fPlayback) { SkDELETE(playback); } } else { buffer.writeBool(false); } }
void SkMatrixConvolutionImageFilter::flatten(SkWriteBuffer& buffer) const { this->INHERITED::flatten(buffer); buffer.writeInt(fKernelSize.fWidth); buffer.writeInt(fKernelSize.fHeight); buffer.writeScalarArray(fKernel, fKernelSize.fWidth * fKernelSize.fHeight); buffer.writeScalar(fGain); buffer.writeScalar(fBias); buffer.writeInt(fKernelOffset.fX); buffer.writeInt(fKernelOffset.fY); buffer.writeInt((int) fTileMode); buffer.writeBool(fConvolveAlpha); }
void SkMallocPixelRef::flatten(SkWriteBuffer& buffer) const { this->INHERITED::flatten(buffer); buffer.write32(SkToU32(fRB)); // TODO: replace this bulk write with a chunky one that can trim off any // trailing bytes on each scanline (in case rowbytes > width*size) size_t size = this->info().getSafeSize(fRB); buffer.writeByteArray(fStorage, size); buffer.writeBool(fCTable != NULL); if (fCTable) { fCTable->writeToBuffer(buffer); } }
void SkLayerDrawLooper::flatten(SkWriteBuffer& buffer) const { buffer.writeInt(fCount); Rec* rec = fRecs; for (int i = 0; i < fCount; i++) { // Legacy "flagsmask" field -- now ignored, remove when we bump version buffer.writeInt(0); buffer.writeInt(rec->fInfo.fPaintBits); buffer.writeInt(rec->fInfo.fColorMode); buffer.writePoint(rec->fInfo.fOffset); buffer.writeBool(rec->fInfo.fPostTranslate); buffer.writePaint(rec->fPaint); rec = rec->fNext; } }
void SkPixelRef::flatten(SkWriteBuffer& buffer) const { this->INHERITED::flatten(buffer); fInfo.flatten(buffer); buffer.writeBool(fIsImmutable); // We write the gen ID into the picture for within-process recording. This // is safe since the same genID will never refer to two different sets of // pixels (barring overflow). However, each process has its own "namespace" // of genIDs. So for cross-process recording we write a zero which will // trigger assignment of a new genID in playback. if (buffer.isCrossProcess()) { buffer.writeUInt(0); } else { buffer.writeUInt(fGenerationID); fUniqueGenerationID = false; // Conservative, a copy is probably about to exist. } }
void SkImageRef::flatten(SkWriteBuffer& buffer) const { this->INHERITED::flatten(buffer); buffer.writeInt(fSampleSize); buffer.writeBool(fDoDither); // FIXME: Consider moving this logic should go into writeStream itself. // writeStream currently has no other callers, so this may be fine for // now. if (!fStream->rewind()) { SkDEBUGF(("Failed to rewind SkImageRef stream!")); buffer.write32(0); } else { // FIXME: Handle getLength properly here. Perhaps this class should // take an SkStreamAsset. buffer.writeStream(fStream, fStream->getLength()); } }
void SkLights::flatten(SkWriteBuffer& buf) const { buf.writeScalarArray(&this->ambientLightColor().fX, 3); buf.writeInt(this->numLights()); for (int l = 0; l < this->numLights(); ++l) { const Light& light = this->light(l); bool isPoint = Light::kPoint_LightType == light.type(); buf.writeBool(isPoint); buf.writeScalarArray(&light.color().fX, 3); buf.writeScalarArray(&light.dir().fX, 3); if (isPoint) { buf.writeScalar(light.intensity()); } } }
void SkColor4Shader::flatten(SkWriteBuffer& buffer) const { buffer.writeColor4f(fColor4); buffer.writeBool(false); // TODO how do we flatten colorspaces? }