本文整理汇总了C++中SkSafeRef函数的典型用法代码示例。如果您正苦于以下问题:C++ SkSafeRef函数的具体用法?C++ SkSafeRef怎么用?C++ SkSafeRef使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SkSafeRef函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fInputCount
SkImageFilter::SkImageFilter(SkImageFilter* input1, SkImageFilter* input2)
: fInputCount(2), fInputs(new SkImageFilter*[2]) {
fInputs[0] = input1;
fInputs[1] = input2;
SkSafeRef(fInputs[0]);
SkSafeRef(fInputs[1]);
}
示例2: m_alpha
PlatformContextSkia::State::State(const State& other)
: m_alpha(other.m_alpha)
, m_xferMode(other.m_xferMode)
, m_useAntialiasing(other.m_useAntialiasing)
, m_looper(other.m_looper)
, m_fillColor(other.m_fillColor)
, m_fillShader(other.m_fillShader)
, m_strokeStyle(other.m_strokeStyle)
, m_strokeColor(other.m_strokeColor)
, m_strokeShader(other.m_strokeShader)
, m_strokeThickness(other.m_strokeThickness)
, m_dashRatio(other.m_dashRatio)
, m_miterLimit(other.m_miterLimit)
, m_lineCap(other.m_lineCap)
, m_lineJoin(other.m_lineJoin)
, m_dash(other.m_dash)
, m_textDrawingMode(other.m_textDrawingMode)
#if OS(LINUX) || OS(WINDOWS)
, m_imageBufferClip(other.m_imageBufferClip)
, m_clip(other.m_clip)
#endif
{
// Up the ref count of these. saveRef does nothing if 'this' is NULL.
SkSafeRef(m_looper);
SkSafeRef(m_dash);
SkSafeRef(m_fillShader);
SkSafeRef(m_strokeShader);
}
示例3: fMode
SkBlendImageFilter::SkBlendImageFilter(SkBlendImageFilter::Mode mode, SkImageFilter* background, SkImageFilter* foreground)
: fMode(mode), fBackground(background), fForeground(foreground)
{
SkASSERT(NULL != background);
SkSafeRef(fBackground);
SkSafeRef(fForeground);
}
示例4: fInputCount
SkImageFilter::SkImageFilter(SkImageFilter* input1, SkImageFilter* input2, const CropRect* cropRect)
: fInputCount(2), fInputs(new SkImageFilter*[2]),
fCropRect(cropRect ? *cropRect : CropRect(SkRect(), 0x0)) {
fInputs[0] = input1;
fInputs[1] = input2;
SkSafeRef(fInputs[0]);
SkSafeRef(fInputs[1]);
}
示例5: INHERITED
SkGrPixelRef::SkGrPixelRef(const SkImageInfo& info, GrSurface* surface) : INHERITED(info) {
// For surfaces that are both textures and render targets, the texture owns the
// render target but not vice versa. So we ref the texture to keep both alive for
// the lifetime of this pixel ref.
fSurface = SkSafeRef(surface->asTexture());
if (NULL == fSurface) {
fSurface = SkSafeRef(surface);
}
if (fSurface) {
SkASSERT(info.width() <= fSurface->width());
SkASSERT(info.height() <= fSurface->height());
}
}
示例6: LayerAndroid
CanvasLayer::CanvasLayer(const CanvasLayer& layer)
: LayerAndroid(layer)
, m_canvas(0)
, m_bitmap(0)
{
init();
if (!layer.m_canvas) {
// The canvas has already been destroyed - this shouldn't happen
ALOGW("Creating a CanvasLayer for a destroyed canvas!");
m_visibleContentRect = IntRect();
m_offsetFromRenderer = IntSize();
m_texture->setHwAccelerated(false);
return;
}
// We are making a copy for the UI, sync the interesting bits
m_visibleContentRect = layer.visibleContentRect();
m_offsetFromRenderer = layer.offsetFromRenderer();
bool previousState = m_texture->hasValidTexture();
if (!previousState && layer.m_dirtyCanvas.isEmpty()) {
// We were previously in software and don't have anything new to draw,
// so stay in software
m_bitmap = layer.bitmap();
SkSafeRef(m_bitmap);
} else {
// Attempt to upload to a surface texture
if (!m_texture->uploadImageBuffer(layer.m_canvas->buffer())) {
// Blargh, no surface texture or ImageBuffer - fall back to software
m_bitmap = layer.bitmap();
SkSafeRef(m_bitmap);
// Merge the canvas invals with the layer's invals to repaint the needed
// tiles.
SkRegion::Iterator iter(layer.m_dirtyCanvas);
const IntPoint& offset = m_visibleContentRect.location();
for (; !iter.done(); iter.next()) {
SkIRect diff = iter.rect();
diff.fLeft += offset.x();
diff.fRight += offset.x();
diff.fTop += offset.y();
diff.fBottom += offset.y();
m_dirtyRegion.op(diff, SkRegion::kUnion_Op);
}
}
if (previousState != m_texture->hasValidTexture()) {
// Need to do a full inval of the canvas content as we are mode switching
m_dirtyRegion.op(m_visibleContentRect.x(), m_visibleContentRect.y(),
m_visibleContentRect.maxX(), m_visibleContentRect.maxY(), SkRegion::kUnion_Op);
}
}
}
示例7: MCRec
MCRec(const MCRec* prev, int flags) {
if (NULL != prev) {
if (flags & SkCanvas::kMatrix_SaveFlag) {
fMatrixStorage = *prev->fMatrix;
fMatrix = &fMatrixStorage;
} else {
fMatrix = prev->fMatrix;
}
if (flags & SkCanvas::kClip_SaveFlag) {
fRegionStorage = *prev->fRegion;
fRegion = &fRegionStorage;
} else {
fRegion = prev->fRegion;
}
fFilter = prev->fFilter;
SkSafeRef(fFilter);
fTopLayer = prev->fTopLayer;
} else { // no prev
fMatrixStorage.reset();
fMatrix = &fMatrixStorage;
fRegion = &fRegionStorage;
fFilter = NULL;
fTopLayer = NULL;
}
fLayer = NULL;
// don't bother initializing fNext
inc_rec();
}
示例8: m_picture
PictureLayerContent::PictureLayerContent(SkPicture* picture)
: m_picture(picture)
, m_checkedContent(false)
, m_hasText(true)
{
SkSafeRef(m_picture);
}
示例9: onNewPictureSnapshot
SkPicture* onNewPictureSnapshot() override {
SkBigPicture::SnapshotArray* pictList = NULL;
if (fDrawableList) {
// TODO: should we plumb-down the BBHFactory and recordFlags from our host
// PictureRecorder?
pictList = fDrawableList->newDrawableSnapshot();
}
SkAutoTUnref<SkLayerInfo> saveLayerData;
if (fBBH && fDoSaveLayerInfo) {
saveLayerData.reset(SkNEW(SkLayerInfo));
SkBBoxHierarchy* bbh = NULL; // we've already computed fBBH (received in constructor)
// TODO: update saveLayer info computation to reuse the already computed
// bounds in 'fBBH'
SkRecordComputeLayers(fBounds, *fRecord, pictList, bbh, saveLayerData);
}
size_t subPictureBytes = 0;
for (int i = 0; pictList && i < pictList->count(); i++) {
subPictureBytes += SkPictureUtils::ApproximateBytesUsed(pictList->begin()[i]);
}
// SkBigPicture will take ownership of a ref on both fRecord and fBBH.
// We're not willing to give up our ownership, so we must ref them for SkPicture.
return SkNEW_ARGS(SkBigPicture, (fBounds,
SkRef(fRecord.get()),
pictList,
SkSafeRef(fBBH.get()),
saveLayerData.detach(),
subPictureBytes));
}
示例10: INHERITED
SkPictureImageFilter::SkPictureImageFilter(const SkPicture* picture)
: INHERITED(0, 0, NULL)
, fPicture(SkSafeRef(picture))
, fCropRect(picture ? picture->cullRect() : SkRect::MakeEmpty())
, fPictureResolution(kDeviceSpace_PictureResolution)
, fFilterQuality(kLow_SkFilterQuality) {
}
示例11: INHERITED
SkXfermodeImageFilter::SkXfermodeImageFilter(SkXfermode* mode,
SkImageFilter* background,
SkImageFilter* foreground,
const CropRect* cropRect)
: INHERITED(background, foreground, cropRect), fMode(mode) {
SkSafeRef(fMode);
}
示例12: m_compositedRoot
SurfaceCollection::SurfaceCollection(BaseLayerAndroid* layer)
: m_compositedRoot(layer)
{
// layer must be non-null.
SkSafeRef(m_compositedRoot);
// calculate draw transforms and z values
SkRect visibleRect = SkRect::MakeLTRB(0, 0, 1, 1);
m_compositedRoot->updatePositionsRecursive(visibleRect);
// allocate surfaces for layers, merging where possible
ALOGV("new tree, allocating surfaces for tree %p", m_baseLayer);
LayerMergeState layerMergeState(&m_surfaces);
m_compositedRoot->assignSurfaces(&layerMergeState);
// set the layersurfaces' update count, to be drawn on painted tiles
unsigned int updateCount = TilesManager::instance()->incWebkitContentUpdates();
for (unsigned int i = 0; i < m_surfaces.size(); i++)
m_surfaces[i]->setUpdateCount(updateCount);
#ifdef DEBUG_COUNT
ClassTracker::instance()->increment("SurfaceCollection");
#endif
}
示例13: setupPaintForFilling
void PlatformContextSkia::drawRect(SkRect rect)
{
SkPaint paint;
int fillcolorNotTransparent = m_state->m_fillColor & 0xFF000000;
if (fillcolorNotTransparent) {
setupPaintForFilling(&paint);
canvas()->drawRect(rect, paint);
}
if (m_state->m_strokeStyle != WebCore::NoStroke &&
(m_state->m_strokeColor & 0xFF000000)) {
// We do a fill of four rects to simulate the stroke of a border.
SkColor oldFillColor = m_state->m_fillColor;
// setFillColor() will set the shader to NULL, so save a ref to it now.
SkShader* oldFillShader = m_state->m_fillShader;
SkSafeRef(oldFillShader);
setFillColor(m_state->m_strokeColor);
paint.reset();
setupPaintForFilling(&paint);
SkRect topBorder = { rect.fLeft, rect.fTop, rect.fRight, rect.fTop + 1 };
canvas()->drawRect(topBorder, paint);
SkRect bottomBorder = { rect.fLeft, rect.fBottom - 1, rect.fRight, rect.fBottom };
canvas()->drawRect(bottomBorder, paint);
SkRect leftBorder = { rect.fLeft, rect.fTop + 1, rect.fLeft + 1, rect.fBottom - 1 };
canvas()->drawRect(leftBorder, paint);
SkRect rightBorder = { rect.fRight - 1, rect.fTop + 1, rect.fRight, rect.fBottom - 1 };
canvas()->drawRect(rightBorder, paint);
setFillColor(oldFillColor);
setFillShader(oldFillShader);
SkSafeUnref(oldFillShader);
}
}
示例14: INHERITED
SkPictureImageFilter::SkPictureImageFilter(SkPicture* picture)
: INHERITED(0, 0),
fPicture(picture),
fCropRect(SkRect::MakeWH(picture ? SkIntToScalar(picture->width()) : 0,
picture ? SkIntToScalar(picture->height()) : 0)) {
SkSafeRef(fPicture);
}
示例15: SkSafeRef
// draw for base tile - called on TextureGeneration thread
void TreeManager::drawCanvas(SkCanvas* canvas, bool drawLayers)
{
BaseLayerAndroid* paintingTree = 0;
m_paintSwapLock.lock();
if (m_paintingTree)
paintingTree = static_cast<BaseLayerAndroid*>(m_paintingTree);
else
paintingTree = static_cast<BaseLayerAndroid*>(m_drawingTree);
SkSafeRef(paintingTree);
m_paintSwapLock.unlock();
if (!paintingTree)
return;
paintingTree->drawCanvas(canvas);
if (drawLayers && paintingTree->countChildren()) {
// draw the layers onto the canvas as well
Layer* layers = paintingTree->getChild(0);
static_cast<LayerAndroid*>(layers)->drawCanvas(canvas);
}
SkSafeUnref(paintingTree);
}