Ejemplo n.º 1
0
bool EllipsisBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, LayoutUnit lineTop, LayoutUnit lineBottom)
{
    LayoutPoint adjustedLocation = accumulatedOffset + roundedLayoutPoint(topLeft());

    // Hit test the markup box.
    if (InlineBox* markupBox = this->markupBox()) {
        RenderStyle* style = renderer().style(isFirstLineStyle());
        LayoutUnit mtx = adjustedLocation.x() + m_logicalWidth - markupBox->x();
        LayoutUnit mty = adjustedLocation.y() + style->fontMetrics().ascent() - (markupBox->y() + markupBox->renderer().style(isFirstLineStyle())->fontMetrics().ascent());
        if (markupBox->nodeAtPoint(request, result, locationInContainer, LayoutPoint(mtx, mty), lineTop, lineBottom)) {
            renderer().updateHitTestResult(result, locationInContainer.point() - LayoutSize(mtx, mty));
            return true;
        }
    }

    FloatPoint boxOrigin = locationIncludingFlipping();
    boxOrigin.moveBy(accumulatedOffset);
    FloatRect boundsRect(boxOrigin, size());
    if (visibleToHitTestRequest(request) && boundsRect.intersects(HitTestLocation::rectForPoint(locationInContainer.point(), 0, 0, 0, 0))) {
        renderer().updateHitTestResult(result, locationInContainer.point() - toLayoutSize(adjustedLocation));
        if (!result.addNodeToRectBasedTestResult(renderer().node(), request, locationInContainer, boundsRect))
            return true;
    }

    return false;
}
Ejemplo n.º 2
0
void GuiGradientCtrl::onRender(Point2I offset, const RectI& updateRect)
{
   if (mStateBlock.isNull())
   {
      GFXStateBlockDesc desc;
      desc.setBlend(true, GFXBlendSrcAlpha, GFXBlendInvSrcAlpha);
      desc.setZReadWrite(false);
      desc.zWriteEnable = false;
      desc.setCullMode(GFXCullNone);
      mStateBlock = GFX->createStateBlock( desc );
   }

   RectI boundsRect(offset, getExtent()); 
   renderColorBox(boundsRect);

   if (mPositionChanged) 
   {
      mPositionChanged = false;

      // Now do onAction() if we are allowed
      if (mActionOnMove) 
			onAction();  
   }
   
   //render the children
   renderChildControls( offset, updateRect);
}
Ejemplo n.º 3
0
void GuiColorPickerCtrl::onRender(Point2I offset, const RectI& updateRect)
{
   if (mStateBlock.isNull())
   {
      GFXStateBlockDesc desc;
      desc.setBlend(true, GFXBlendSrcAlpha, GFXBlendInvSrcAlpha);
      desc.setZReadWrite(false);
      desc.zWriteEnable = false;
      desc.setCullMode(GFXCullNone);
      mStateBlock = GFX->createStateBlock( desc );
   }

   RectI boundsRect(offset, getExtent()); 
   renderColorBox(boundsRect);

   if (mPositionChanged) 
   {
      mPositionChanged = false;
      Point2I extent = getRoot()->getExtent();
      // If we are anything but a pallete, change the pick color
      if (mDisplayMode != pPallet)
      {
         Point2I resolution = getRoot()->getExtent();

         U32 buf_x = offset.x + mSelectorPos.x + 1;
         U32 buf_y = ( extent.y - ( offset.y + mSelectorPos.y + 1 ) );
         if(GFX->getAdapterType() != OpenGL)
            buf_y = resolution.y - buf_y;

         GFXTexHandle bb( resolution.x, 
                          resolution.y, 
                          GFXFormatR8G8B8A8, &GFXDefaultRenderTargetProfile, avar("%s() - bb (line %d)", __FUNCTION__, __LINE__) );
         
         Point2I tmpPt( buf_x, buf_y );

         GFXTarget *targ = GFX->getActiveRenderTarget();
         targ->resolveTo( bb );
         
         GBitmap bmp( bb.getWidth(), bb.getHeight() );

         bb.copyToBmp( &bmp );
         
         //bmp.writePNGDebug( "foo.png" );

         ColorI tmp;
         bmp.getColor( buf_x, buf_y, tmp );

         mPickColor = (ColorF)tmp;

         // Now do onAction() if we are allowed
         if (mActionOnMove) 
            onAction();
      }
      
   }
   
   //render the children
   renderChildControls( offset, updateRect);
}
Ejemplo n.º 4
0
nsresult imgFrame::ImageUpdated(const nsIntRect &aUpdateRect)
{
  mDecoded.UnionRect(mDecoded, aUpdateRect);

  // clamp to bounds, in case someone sends a bogus updateRect (I'm looking at
  // you, gif decoder)
  nsIntRect boundsRect(mOffset, mSize);
  mDecoded.IntersectRect(mDecoded, boundsRect);

#ifdef XP_MACOSX
  if (mQuartzSurface)
    mQuartzSurface->Flush();
#endif
  return NS_OK;
}
Ejemplo n.º 5
0
bool EllipsisBox::nodeAtPoint(HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, LayoutUnit lineTop, LayoutUnit lineBottom)
{
    // FIXME: the call to roundedLayoutPoint() below is temporary and should be removed once
    // the transition to LayoutUnit-based types is complete (crbug.com/321237)
    LayoutPoint adjustedLocation = accumulatedOffset + topLeft();

    LayoutPoint boxOrigin = locationIncludingFlipping();
    boxOrigin.moveBy(accumulatedOffset);
    LayoutRect boundsRect(boxOrigin, size());
    if (visibleToHitTestRequest(result.hitTestRequest()) && boundsRect.intersects(LayoutRect(HitTestLocation::rectForPoint(locationInContainer.point(), 0, 0, 0, 0)))) {
        lineLayoutItem().updateHitTestResult(result, locationInContainer.point() - toLayoutSize(adjustedLocation));
        if (result.addNodeToListBasedTestResult(lineLayoutItem().node(), locationInContainer, boundsRect) == StopHitTesting)
            return true;
    }

    return false;
}
Ejemplo n.º 6
0
ossimDrect shapefileClip::LineSampleToWorld(ossimIrect rect, ossimRefPtr<ossimImageGeometry> ImageGeom)
{
	ossimGpt gp1;
	ossimGpt gp2;
	ossimGpt gp3;
	ossimGpt gp4;

	ImageGeom->localToWorld(rect.ul(), gp1);
	ImageGeom->localToWorld(rect.ur(), gp2);
	ImageGeom->localToWorld(rect.lr(), gp3);
	ImageGeom->localToWorld(rect.ll(), gp4);
   
	ossimDrect boundsRect(ossimDpt(gp1.lond(), gp1.latd()),
		ossimDpt(gp2.lond(), gp2.latd()),
		ossimDpt(gp3.lond(), gp3.latd()),	
		ossimDpt(gp4.lond(), gp4.latd()),
		OSSIM_RIGHT_HANDED);

	return boundsRect;
}
Ejemplo n.º 7
0
void PluginView::viewGeometryDidChange()
{
    if (!m_isInitialized || !m_plugin || !parent())
        return;

    ASSERT(frame());
    float pageScaleFactor = frame()->page() ? frame()->page()->pageScaleFactor() : 1;

    IntPoint scaledFrameRectLocation(frameRect().location().x() * pageScaleFactor, frameRect().location().y() * pageScaleFactor);
    IntPoint scaledLocationInRootViewCoordinates(parent()->contentsToRootView(scaledFrameRectLocation));

    // FIXME: We still don't get the right coordinates for transformed plugins.
    AffineTransform transform;
    transform.translate(scaledLocationInRootViewCoordinates.x(), scaledLocationInRootViewCoordinates.y());
    transform.scale(pageScaleFactor);

    // FIXME: The clip rect isn't correct.
    IntRect clipRect = boundsRect();
    m_plugin->geometryDidChange(size(), clipRect, transform);
}
Ejemplo n.º 8
0
// Hit Testing
bool RenderRegion::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, const LayoutPoint& pointInContainer, const LayoutPoint& accumulatedOffset, HitTestAction action)
{
    if (!isValid())
        return false;

    LayoutPoint adjustedLocation = accumulatedOffset + location();

    // Check our bounds next. For this purpose always assume that we can only be hit in the
    // foreground phase (which is true for replaced elements like images).
    LayoutRect boundsRect(adjustedLocation, size());
    if (visibleToHitTesting() && action == HitTestForeground && boundsRect.intersects(result.rectForPoint(pointInContainer))) {
        // Check the contents of the RenderFlowThread.
        if (m_flowThread && m_flowThread->hitTestRegion(this, request, result, pointInContainer, LayoutPoint(adjustedLocation.x() + borderLeft() + paddingLeft(), adjustedLocation.y() + borderTop() + paddingTop())))
            return true;
        updateHitTestResult(result, pointInContainer - toLayoutSize(adjustedLocation));
        if (!result.addNodeToRectBasedTestResult(node(), pointInContainer, boundsRect))
            return true;
    }

    return false;
}
Ejemplo n.º 9
0
bool LayoutSVGRoot::nodeAtPoint(HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction hitTestAction)
{
    LayoutPoint pointInParent = locationInContainer.point() - toLayoutSize(accumulatedOffset);
    LayoutPoint pointInBorderBox = pointInParent - toLayoutSize(location());

    // Only test SVG content if the point is in our content box, or in case we
    // don't clip to the viewport, the visual overflow rect.
    // FIXME: This should be an intersection when rect-based hit tests are supported by nodeAtFloatPoint.
    if (contentBoxRect().contains(pointInBorderBox) || (!shouldApplyViewportClip() && visualOverflowRect().contains(pointInBorderBox))) {
        const AffineTransform& localToParentTransform = this->localToParentTransform();
        if (localToParentTransform.isInvertible()) {
            FloatPoint localPoint = localToParentTransform.inverse().mapPoint(FloatPoint(pointInParent));

            for (LayoutObject* child = lastChild(); child; child = child->previousSibling()) {
                // FIXME: nodeAtFloatPoint() doesn't handle rect-based hit tests yet.
                if (child->nodeAtFloatPoint(result, localPoint, hitTestAction)) {
                    updateHitTestResult(result, pointInBorderBox);
                    if (result.addNodeToListBasedTestResult(child->node(), locationInContainer) == StopHitTesting)
                        return true;
                }
            }
        }
    }

    // If we didn't early exit above, we've just hit the container <svg> element. Unlike SVG 1.1, 2nd Edition allows container elements to be hit.
    if ((hitTestAction == HitTestBlockBackground || hitTestAction == HitTestChildBlockBackground) && visibleToHitTestRequest(result.hitTestRequest())) {
        // Only return true here, if the last hit testing phase 'BlockBackground' (or 'ChildBlockBackground' - depending on context) is executed.
        // If we'd return true in the 'Foreground' phase, hit testing would stop immediately. For SVG only trees this doesn't matter.
        // Though when we have a <foreignObject> subtree we need to be able to detect hits on the background of a <div> element.
        // If we'd return true here in the 'Foreground' phase, we are not able to detect these hits anymore.
        LayoutRect boundsRect(accumulatedOffset + location(), size());
        if (locationInContainer.intersects(boundsRect)) {
            updateHitTestResult(result, pointInBorderBox);
            if (result.addNodeToListBasedTestResult(node(), locationInContainer, boundsRect) == StopHitTesting)
                return true;
        }
    }

    return false;
}
Ejemplo n.º 10
0
bool RenderSVGRoot::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction hitTestAction)
{
    LayoutPoint pointInParent = locationInContainer.point() - toLayoutSize(accumulatedOffset);
    LayoutPoint pointInBorderBox = pointInParent - toLayoutSize(location());

    // Only test SVG content if the point is in our content box.
    // FIXME: This should be an intersection when rect-based hit tests are supported by nodeAtFloatPoint.
    if (contentBoxRect().contains(pointInBorderBox)) {
        FloatPoint localPoint = localToParentTransform().inverse().mapPoint(FloatPoint(pointInParent));

        for (RenderObject* child = lastChild(); child; child = child->previousSibling()) {
            // FIXME: nodeAtFloatPoint() doesn't handle rect-based hit tests yet.
            if (child->nodeAtFloatPoint(request, result, localPoint, hitTestAction)) {
                updateHitTestResult(result, pointInBorderBox);
                if (!result.addNodeToRectBasedTestResult(child->node(), request, locationInContainer))
                    return true;
            }
        }
    }

    // If we didn't early exit above, we've just hit the container <svg> element. Unlike SVG 1.1, 2nd Edition allows container elements to be hit.
    if (hitTestAction == HitTestBlockBackground && visibleToHitTesting()) {
        // Only return true here, if the last hit testing phase 'BlockBackground' is executed. If we'd return true in the 'Foreground' phase,
        // hit testing would stop immediately. For SVG only trees this doesn't matter. Though when we have a <foreignObject> subtree we need
        // to be able to detect hits on the background of a <div> element. If we'd return true here in the 'Foreground' phase, we are not able
        // to detect these hits anymore.
        LayoutRect boundsRect(accumulatedOffset + location(), size());
        if (locationInContainer.intersects(boundsRect)) {
            updateHitTestResult(result, pointInBorderBox);
            if (!result.addNodeToRectBasedTestResult(&svgSVGElement(), request, locationInContainer, boundsRect))
                return true;
        }
    }

    return false;
}
Ejemplo n.º 11
0
bool EllipsisBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, LayoutUnit lineTop, LayoutUnit lineBottom, HitTestAction hitTestAction)
{
    LayoutPoint adjustedLocation = accumulatedOffset + LayoutPoint(topLeft());

    // Hit test the markup box.
    if (InlineBox* markupBox = this->markupBox()) {
        const RenderStyle& lineStyle = this->lineStyle();
        LayoutUnit mtx = adjustedLocation.x() + m_logicalWidth - markupBox->x();
        LayoutUnit mty = adjustedLocation.y() + lineStyle.fontMetrics().ascent() - (markupBox->y() + markupBox->lineStyle().fontMetrics().ascent());
        if (markupBox->nodeAtPoint(request, result, locationInContainer, LayoutPoint(mtx, mty), lineTop, lineBottom, hitTestAction)) {
            blockFlow().updateHitTestResult(result, locationInContainer.point() - LayoutSize(mtx, mty));
            return true;
        }
    }

    LayoutRect boundsRect(adjustedLocation, LayoutSize(m_logicalWidth, m_height));
    if (visibleToHitTesting() && boundsRect.intersects(HitTestLocation::rectForPoint(locationInContainer.point(), 0, 0, 0, 0))) {
        blockFlow().updateHitTestResult(result, locationInContainer.point() - toLayoutSize(adjustedLocation));
        if (!result.addNodeToRectBasedTestResult(blockFlow().element(), request, locationInContainer, boundsRect))
            return true;
    }

    return false;
}
Ejemplo n.º 12
0
void CCSlot::_updateMesh() 
{
    const auto meshDisplay = static_cast<DBCCSprite*>(this->_meshDisplay);
    const auto hasFFD = !this->_ffdVertices.empty();

    const auto displayVertices = meshDisplay->getPolygonInfoModify().triangles.verts;
    cocos2d::Rect boundsRect(999999.f, 999999.f, -999999.f, -999999.f);

    if (this->_meshData->skinned)
    {
        std::size_t iF = 0;
        for (std::size_t i = 0, l = this->_meshData->vertices.size(); i < l; i += 2)
        {
            const auto iH = unsigned(i / 2);

            const auto& boneIndices = this->_meshData->boneIndices[iH];
            const auto& boneVertices = this->_meshData->boneVertices[iH];
            const auto& weights = this->_meshData->weights[iH];

            float xG = 0.f, yG = 0.f;
            for (std::size_t iB = 0, lB = boneIndices.size(); iB < lB; ++iB)
            {
                const auto bone = this->_meshBones[boneIndices[iB]];
                const auto matrix = bone->globalTransformMatrix;
                const auto weight = weights[iB];

                float xL = 0.f, yL = 0.f;
                if (hasFFD)
                {
                    xL = boneVertices[iB * 2] + this->_ffdVertices[iF];
                    yL = boneVertices[iB * 2 + 1] + this->_ffdVertices[iF + 1];
                }
                else
                {
                    xL = boneVertices[iB * 2];
                    yL = boneVertices[iB * 2 + 1];
                }

                xG += (matrix->a * xL + matrix->c * yL + matrix->tx) * weight;
                yG += (matrix->b * xL + matrix->d * yL + matrix->ty) * weight;

                iF += 2;
            }

            auto& vertices = displayVertices[iH];
            auto& vertex = vertices.vertices;

            vertex.set(xG, -yG, 0.f);

            if (boundsRect.origin.x > xG)
            {
                boundsRect.origin.x = xG;
            }

            if (boundsRect.size.width < xG)
            {
                boundsRect.size.width = xG;
            }

            if (boundsRect.origin.y > -yG)
            {
                boundsRect.origin.y = -yG;
            }

            if (boundsRect.size.height < -yG)
            {
                boundsRect.size.height = -yG;
            }
        }
    }
    else if (hasFFD)
    {
        const auto& vertices = _meshData->vertices;
        for (std::size_t i = 0, l = this->_meshData->vertices.size(); i < l; i += 2)
        {
            const auto iH = unsigned(i / 2);
            const auto xG = vertices[i] + _ffdVertices[i];
            const auto yG = vertices[i + 1] + _ffdVertices[i + 1];

            auto& vertices = displayVertices[iH];
            auto& vertex = vertices.vertices;

            vertex.set(xG, -yG, 0.f);

            if (boundsRect.origin.x > xG)
            {
                boundsRect.origin.x = xG;
            }

            if (boundsRect.size.width < xG)
            {
                boundsRect.size.width = xG;
            }

            if (boundsRect.origin.y > -yG)
            {
                boundsRect.origin.y = -yG;
            }

            if (boundsRect.size.height < -yG)
            {
                boundsRect.size.height = -yG;
            }
        }
    }

    boundsRect.size.width -= boundsRect.origin.x;
    boundsRect.size.height -= boundsRect.origin.y;
    
    cocos2d::Rect* rect = (cocos2d::Rect*)&meshDisplay->getPolygonInfo().rect;
    rect->origin = boundsRect.origin; // copy
    rect->size = boundsRect.size; // copy
    meshDisplay->setContentSize(boundsRect.size);
}
Ejemplo n.º 13
0
float TouchTracker::Calibrator::differenceFromTemplateTouchWithMask(const MLSignal& in, Vec2 pos, const MLSignal& mask)
{
	static float maskThresh = 0.001f;
	static MLSignal a2(kTemplateSize, kTemplateSize);
	static MLSignal b(kTemplateSize, kTemplateSize);
	static MLSignal b2(kTemplateSize, kTemplateSize);

	float r = 0.f;
	int height = in.getHeight();
	int width = in.getWidth();
	MLRect boundsRect(0, 0, width, height);
	
	// use linear interpolated z value from input
	float linearZ = in.getInterpolatedLinear(pos)*getZAdjust(pos);
	linearZ = clamp(linearZ, 0.00001f, 1.f);
	float z1 = 1./linearZ;	
	const MLSignal& a = getTemplate(pos);
	
	// get normalized input values surrounding touch
	int tr = kTemplateRadius;
	b.clear();
	for(int j=0; j < kTemplateSize; ++j)
	{
		for(int i=0; i < kTemplateSize; ++i)
		{
			Vec2 vInPos = pos + Vec2((float)i - tr,(float)j - tr);			
			if (boundsRect.contains(vInPos) && (mask.getInterpolatedLinear(vInPos) < maskThresh))
			{
				float inVal = in.getInterpolatedLinear(vInPos);
				inVal *= z1;
				b(i, j) = inVal;
			}
		}
	}
	
	int tests = 0;
	float sum = 0.;

	// add differences in z from template
	a2.copy(a);
	b2.copy(b);
	a2.partialDiffX();
	b2.partialDiffX();
	for(int j=0; j < kTemplateSize; ++j)
	{
		for(int i=0; i < kTemplateSize; ++i)
		{
			if(b(i, j) > 0.)
			{
				float d = a2(i, j) - b2(i, j);
				sum += d*d;
				tests++;
			}
		}
	}

	// get RMS difference
	if(tests > 0)
	{
		r = sqrtf(sum / tests);
	}	
	return r;
}
Ejemplo n.º 14
0
void ContentLayerChromium::updateContents()
{
    RenderLayerBacking* backing = static_cast<RenderLayerBacking*>(m_owner->client());
    if (!backing || backing->paintingGoesToWindow())
        return;

    ASSERT(drawsContent());

    ASSERT(layerRenderer());

    void* pixels = 0;
    IntRect dirtyRect;
    IntRect updateRect;
    IntSize requiredTextureSize;
    IntSize bitmapSize;

    // FIXME: Remove this test when tiled layers are implemented.
    if (requiresClippedUpdateRect()) {
        // A layer with 3D transforms could require an arbitrarily large number
        // of texels to be repainted, so ignore these layers until tiling is
        // implemented.
        if (!drawTransform().isIdentityOrTranslation()) {
            m_skipsDraw = true;
            return;
        }

        calculateClippedUpdateRect(dirtyRect, m_largeLayerDrawRect);
        if (!layerRenderer()->checkTextureSize(m_largeLayerDrawRect.size())) {
            m_skipsDraw = true;
            return;
        }

        // If the portion of the large layer that's visible hasn't changed
        // then we don't need to update it, _unless_ its contents have changed
        // in which case we only update the dirty bits.
        if (m_largeLayerDirtyRect == dirtyRect) {
            if (!m_dirtyRect.intersects(dirtyRect))
                return;
            dirtyRect.intersect(IntRect(m_dirtyRect));
            updateRect = dirtyRect;
            requiredTextureSize = m_largeLayerDirtyRect.size();
        } else {
            m_largeLayerDirtyRect = dirtyRect;
            requiredTextureSize = dirtyRect.size();
            updateRect = IntRect(IntPoint(0, 0), dirtyRect.size());
        }
    } else {
        dirtyRect = IntRect(m_dirtyRect);
        IntRect boundsRect(IntPoint(0, 0), m_bounds);
        requiredTextureSize = m_bounds;
        // If the texture needs to be reallocated then we must redraw the entire
        // contents of the layer.
        if (requiredTextureSize != m_allocatedTextureSize)
            dirtyRect = boundsRect;
        else {
            // Clip the dirtyRect to the size of the layer to avoid drawing
            // outside the bounds of the backing texture.
            dirtyRect.intersect(boundsRect);
        }
        updateRect = dirtyRect;
    }

    if (dirtyRect.isEmpty())
        return;

#if PLATFORM(SKIA)
    const SkBitmap* skiaBitmap = 0;
    OwnPtr<skia::PlatformCanvas> canvas;
    OwnPtr<PlatformContextSkia> skiaContext;
    OwnPtr<GraphicsContext> graphicsContext;

    canvas.set(new skia::PlatformCanvas(dirtyRect.width(), dirtyRect.height(), false));
    skiaContext.set(new PlatformContextSkia(canvas.get()));

    // This is needed to get text to show up correctly.
    // FIXME: Does this take us down a very slow text rendering path?
    skiaContext->setDrawingToImageBuffer(true);

    graphicsContext.set(new GraphicsContext(reinterpret_cast<PlatformGraphicsContext*>(skiaContext.get())));

    // Bring the canvas into the coordinate system of the paint rect.
    canvas->translate(static_cast<SkScalar>(-dirtyRect.x()), static_cast<SkScalar>(-dirtyRect.y()));

    m_owner->paintGraphicsLayerContents(*graphicsContext, dirtyRect);
    const SkBitmap& bitmap = canvas->getDevice()->accessBitmap(false);
    skiaBitmap = &bitmap;
    ASSERT(skiaBitmap);

    SkAutoLockPixels lock(*skiaBitmap);
    SkBitmap::Config skiaConfig = skiaBitmap->config();
    // FIXME: do we need to support more image configurations?
    if (skiaConfig == SkBitmap::kARGB_8888_Config) {
        pixels = skiaBitmap->getPixels();
        bitmapSize = IntSize(skiaBitmap->width(), skiaBitmap->height());
    }
#elif PLATFORM(CG)
    Vector<uint8_t> tempVector;
    int rowBytes = 4 * dirtyRect.width();
    tempVector.resize(rowBytes * dirtyRect.height());
    memset(tempVector.data(), 0, tempVector.size());
    RetainPtr<CGColorSpaceRef> colorSpace(AdoptCF, CGColorSpaceCreateDeviceRGB());
    RetainPtr<CGContextRef> contextCG(AdoptCF, CGBitmapContextCreate(tempVector.data(),
                                                                     dirtyRect.width(), dirtyRect.height(), 8, rowBytes,
                                                                     colorSpace.get(),
                                                                     kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host));
    CGContextTranslateCTM(contextCG.get(), 0, dirtyRect.height());
    CGContextScaleCTM(contextCG.get(), 1, -1);

    GraphicsContext graphicsContext(contextCG.get());

    // Translate the graphics context into the coordinate system of the dirty rect.
    graphicsContext.translate(-dirtyRect.x(), -dirtyRect.y());

    m_owner->paintGraphicsLayerContents(graphicsContext, dirtyRect);

    pixels = tempVector.data();
    bitmapSize = dirtyRect.size();
#else
#error "Need to implement for your platform."
#endif

    unsigned textureId = m_contentsTexture;
    if (!textureId)
        textureId = layerRenderer()->createLayerTexture();

    if (pixels)
        updateTextureRect(pixels, bitmapSize, requiredTextureSize, updateRect, textureId);
}
Ejemplo n.º 15
0
NetPrefsServerView::NetPrefsServerView(BRect bounds, const char* name, BMessenger target)
	: BView(bounds, name, B_FOLLOW_ALL_SIDES, B_WILL_DRAW), fEntryWin(NULL), fNetWin(target)
{
	SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	BRect boundsRect(Bounds());
	BBox* mainBox(new BBox(bounds.InsetByCopy(-1, -1), NULL, B_FOLLOW_ALL_SIDES));
	AddChild(mainBox);
	fSelectTitleString = new BStringView(BRect(0, 0, 0, 0), NULL, "Select servers for");
	fSelectTitleString->ResizeToPreferred();
	mainBox->AddChild(fSelectTitleString);
	fSelectTitleString->MoveTo(11, 11);
	fServerList = new BColumnListView(BRect(0, 0, boundsRect.Width() - 10, boundsRect.Height() / 2),
									  "fServerList", B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW,
									  B_PLAIN_BORDER);
	fServerList->SetSelectionMessage(new BMessage(M_SERVER_ITEM_SELECTED));
	mainBox->AddChild(fServerList);
	fServerList->MoveTo(5, fSelectTitleString->Frame().bottom + 3);
	BStringColumn* status(new BStringColumn(S_PREFSERVER_STATUS_COLUMN,
											be_plain_font->StringWidth("Status") * 2, 0,
											bounds.Width(), 0, B_ALIGN_CENTER));
	fServerList->AddColumn(status, 0);
	BStringColumn* data(new BStringColumn(S_PREFSERVER_SERVER_COLUMN,
										  be_plain_font->StringWidth("Server") * 2, 0,
										  bounds.Width(), 0));
	fServerList->AddColumn(data, 1);
	BStringColumn* port(new BStringColumn(
		S_PREFSERVER_PORT_COLUMN, be_plain_font->StringWidth("Port") * 2, 0, bounds.Width(), 0));
	fServerList->AddColumn(port, 2);
	fAddButton = new BButton(BRect(0, 0, 0, 0), NULL, S_PREFSERVER_ADD_BUTTON B_UTF8_ELLIPSIS,
							 new BMessage(M_SERVER_ADD_ITEM));
	fRemoveButton = new BButton(BRect(0, 0, 0, 0), NULL, S_PREFSERVER_REMOVE_BUTTON,
								new BMessage(M_SERVER_REMOVE_ITEM));
	fEditButton = new BButton(BRect(0, 0, 0, 0), NULL, S_PREFSERVER_EDIT_BUTTON B_UTF8_ELLIPSIS,
							  new BMessage(M_SERVER_EDIT_ITEM));
	fAddButton->ResizeToPreferred();
	fRemoveButton->ResizeToPreferred();
	fEditButton->ResizeToPreferred();
	fRemoveButton->MoveTo(fServerList->Frame().right - fRemoveButton->Frame().Width(),
						  fServerList->Frame().bottom + 5);
	mainBox->AddChild(fRemoveButton);
	fAddButton->MoveTo(fRemoveButton->Frame().left - (fAddButton->Frame().Width() + 5),
					   fRemoveButton->Frame().top);
	mainBox->AddChild(fAddButton);
	fEditButton->MoveTo(fAddButton->Frame().left - (fEditButton->Frame().Width() + 15),
						fAddButton->Frame().top);
	mainBox->AddChild(fEditButton);
	BStringView* legend1 = new BStringView(BRect(0, 0, 0, 0), "str1", S_PREFSERVER_DESC1);
	legend1->ResizeToPreferred();
	mainBox->AddChild(legend1);
	legend1->MoveTo(fServerList->Frame().left + 5, fAddButton->Frame().bottom + 5);
	BStringView* legend2 = new BStringView(BRect(0, 0, 0, 0), "str1", S_PREFSERVER_DESC2);
	legend2->ResizeToPreferred();
	mainBox->AddChild(legend2);
	legend2->MoveTo(legend1->Frame().left, legend1->Frame().bottom);
	BStringView* legend3 = new BStringView(BRect(0, 0, 0, 0), "str1", S_PREFSERVER_DESC3);
	legend3->ResizeToPreferred();
	mainBox->AddChild(legend3);
	legend3->MoveTo(legend2->Frame().left, legend2->Frame().bottom);
	fLegend4 = new BStringView(BRect(0, 0, 0, 0), "str1", S_PREFSERVER_DESC4);
	fLegend4->ResizeToPreferred();
	mainBox->AddChild(fLegend4);
	fLegend4->MoveTo(legend3->Frame().left, legend3->Frame().bottom);
	fOkButton = new BButton(BRect(0, 0, 0, 0), NULL, S_PREFSERVER_OK_BUTTON,
							new BMessage(B_QUIT_REQUESTED));
	fOkButton->ResizeToPreferred();
	mainBox->AddChild(fOkButton);
	fOkButton->MoveTo(fServerList->Frame().right - fOkButton->Frame().Width(),
					  fLegend4->Frame().bottom + 5);
}
void QQuickTrailEmitter::emitWindow(int timeStamp)
{
    if (m_system == 0)
        return;
    if (!m_enabled && !m_pulseLeft && m_burstQueue.isEmpty())
        return;
    if (m_followCount != m_system->groupData[m_system->groupIds[m_follow]]->size()){
        qreal oldPPS = m_particlesPerSecond;
        recalcParticlesPerSecond();
        if (m_particlesPerSecond != oldPPS)
            return;//system may need to update
    }

    if (m_pulseLeft){
        m_pulseLeft -= timeStamp - m_lastTimeStamp * 1000.;
        if (m_pulseLeft < 0){
            timeStamp += m_pulseLeft;
            m_pulseLeft = 0;
        }
    }

    //TODO: Implement startTime and velocityFromMovement
    qreal time = timeStamp / 1000.;
    qreal particleRatio = 1. / m_particlesPerParticlePerSecond;
    qreal pt;
    qreal maxLife = (m_particleDuration + m_particleDurationVariation)/1000.0;

    //Have to map it into this system, because particlesystem automaps it back
    QPointF offset = m_system->mapFromItem(this, QPointF(0, 0));
    qreal sizeAtEnd = m_particleEndSize >= 0 ? m_particleEndSize : m_particleSize;

    int gId = m_system->groupIds[m_follow];
    int gId2 = m_system->groupIds[m_group];
    for (int i=0; i<m_system->groupData[gId]->data.count(); i++) {
        QQuickParticleData *d = m_system->groupData[gId]->data[i];
        if (!d->stillAlive()){
            m_lastEmission[i] = time; //Should only start emitting when it returns to life
            continue;
        }
        pt = m_lastEmission[i];
        if (pt < d->t)
            pt = d->t;
        if (pt + maxLife < time)//We missed so much, that we should skip emiting particles that are dead by now
            pt = time - maxLife;

        if ((width() || height()) && !effectiveExtruder()->contains(QRectF(offset.x(), offset.y(), width(), height()),QPointF(d->curX(), d->curY()))){
            m_lastEmission[d->index] = time;//jump over this time period without emitting, because it's outside
            continue;
        }

        QList<QQuickParticleData*> toEmit;

        while (pt < time || !m_burstQueue.isEmpty()){
            QQuickParticleData* datum = m_system->newDatum(gId2, !m_overwrite);
            if (datum){//else, skip this emission
                datum->e = this;//###useful?

                // Particle timestamp
                datum->t = pt;
                datum->lifeSpan =
                        (m_particleDuration
                         + ((rand() % ((m_particleDurationVariation*2) + 1)) - m_particleDurationVariation))
                        / 1000.0;

                // Particle position
                // Note that burst location doesn't get used for follow emitter
                qreal followT =  pt - d->t;
                qreal followT2 = followT * followT * 0.5;
                qreal eW = m_emitterXVariation < 0 ? d->curSize() : m_emitterXVariation;
                qreal eH = m_emitterYVariation < 0 ? d->curSize() : m_emitterYVariation;
                //Subtract offset, because PS expects this in emitter coordinates
                QRectF boundsRect(d->x - offset.x() + d->vx * followT + d->ax * followT2 - eW/2,
                                  d->y - offset.y() + d->vy * followT + d->ay * followT2 - eH/2,
                                  eW, eH);

                QQuickParticleExtruder* effectiveEmissionExtruder = m_emissionExtruder ? m_emissionExtruder : m_defaultEmissionExtruder;
                const QPointF &newPos = effectiveEmissionExtruder->extrude(boundsRect);
                datum->x = newPos.x();
                datum->y = newPos.y();

                // Particle velocity
                const QPointF &velocity = m_velocity->sample(newPos);
                datum->vx = velocity.x()
                    + m_velocity_from_movement * d->vx;
                datum->vy = velocity.y()
                    + m_velocity_from_movement * d->vy;

                // Particle acceleration
                const QPointF &accel = m_acceleration->sample(newPos);
                datum->ax = accel.x();
                datum->ay = accel.y();

                // Particle size
                float sizeVariation = -m_particleSizeVariation
                        + rand() / float(RAND_MAX) * m_particleSizeVariation * 2;

                float size = qMax((qreal)0.0, m_particleSize + sizeVariation);
                float endSize = qMax((qreal)0.0, sizeAtEnd + sizeVariation);

                datum->size = size * float(m_enabled);
                datum->endSize = endSize * float(m_enabled);

                toEmit << datum;

                m_system->emitParticle(datum);
            }
            if (!m_burstQueue.isEmpty()){
                m_burstQueue.first().first--;
                if (m_burstQueue.first().first <= 0)
                    m_burstQueue.pop_front();
            }else{
                pt += particleRatio;
            }
        }

        foreach (QQuickParticleData* d, toEmit)
            m_system->emitParticle(d);

        if (isEmitConnected() || isEmitFollowConnected()) {
            v8::HandleScope handle_scope;
            v8::Context::Scope scope(QQmlEnginePrivate::getV8Engine(qmlEngine(this))->context());
            v8::Handle<v8::Array> array = v8::Array::New(toEmit.size());
            for (int i=0; i<toEmit.size(); i++)
                array->Set(i, toEmit[i]->v8Value().toHandle());

            if (isEmitFollowConnected())
                emitFollowParticles(QQmlV8Handle::fromHandle(array), d->v8Value());//A chance for many arbitrary JS changes
            else if (isEmitConnected())
                emitParticles(QQmlV8Handle::fromHandle(array));//A chance for arbitrary JS changes
        }
        m_lastEmission[d->index] = pt;
    }

    m_lastTimeStamp = time;
}
Ejemplo n.º 17
0
void GuiFormCtrl::onRender(Point2I offset, const RectI &updateRect)
{
   // Fill in the control's child area
   RectI boundsRect(offset, getExtent());
   boundsRect.point.y += mThumbSize.y;
   boundsRect.extent.y -= mThumbSize.y;

   // draw the border of the form if specified
   if (mProfile->mOpaque)
      GFX->getDrawUtil()->drawRectFill(boundsRect, mProfile->mFillColor);

   if (mProfile->mBorder)
      renderBorder(boundsRect, mProfile);

   // If we don't have a child, put some text in the child area
   if( empty() )
   {
      GFX->getDrawUtil()->setBitmapModulation(ColorI(0,0,0));
      renderJustifiedText(boundsRect.point, boundsRect.extent, "[none]");
   }

   S32 textWidth = 0;

   // Draw our little bar, too
   if (mProfile->mBitmapArrayRects.size() >= 5)
   {
      //GFX->getDrawUtil()->clearBitmapModulation();     // Copyright (C) 2013 WinterLeaf Entertainment LLC.

      S32 barStart = offset.x + textWidth;
      S32 barTop   = mThumbSize.y / 2 + offset.y - mProfile->mBitmapArrayRects[3].extent.y / 2;

      Point2I barOffset(barStart, barTop);

      // Draw the start of the bar...
      GFX->getDrawUtil()->drawBitmapStretchSR(mProfile->mTextureObject ,RectI(barOffset, mProfile->mBitmapArrayRects[2].extent), mProfile->mBitmapArrayRects[2] );

      // Now draw the middle...
      barOffset.x += mProfile->mBitmapArrayRects[2].extent.x;

      S32 barMiddleSize = (getExtent().x - (barOffset.x - offset.x)) - mProfile->mBitmapArrayRects[4].extent.x + 1;

      if (barMiddleSize > 0)
      {
         // We have to do this inset to prevent nasty stretching artifacts
         RectI foo = mProfile->mBitmapArrayRects[3];
         foo.inset(1,0);

         GFX->getDrawUtil()->drawBitmapStretchSR(
            mProfile->mTextureObject,
            RectI(barOffset, Point2I(barMiddleSize, mProfile->mBitmapArrayRects[3].extent.y)),
            foo
            );
      }

      // And the end
      barOffset.x += barMiddleSize;

      GFX->getDrawUtil()->drawBitmapStretchSR( mProfile->mTextureObject, RectI(barOffset, mProfile->mBitmapArrayRects[4].extent),
         mProfile->mBitmapArrayRects[4]);

      GFX->getDrawUtil()->setBitmapModulation((mMouseOver ? mProfile->mFontColorHL : mProfile->mFontColor));
      renderJustifiedText(Point2I(mThumbSize.x, 0) + offset, Point2I(getWidth() - mThumbSize.x - mProfile->mBitmapArrayRects[4].extent.x, mThumbSize.y), (mUseSmallCaption ? mSmallCaption : mCaption) );

   }

   // Render the children
   renderChildControls(offset, updateRect);
}
Ejemplo n.º 18
0
void GuiColorPickerCtrl::onRender(Point2I offset, const RectI& updateRect)
{
   if (mStateBlock.isNull())
   {
      GFXStateBlockDesc desc;
      desc.setBlend(true, GFXBlendSrcAlpha, GFXBlendInvSrcAlpha);
      desc.setZReadWrite(false);
      desc.zWriteEnable = false;
      desc.setCullMode(GFXCullNone);
      mStateBlock = GFX->createStateBlock(desc);
   }

   RectI boundsRect(offset, getExtent());
   renderColorBox(boundsRect);

   if (mPositionChanged || mBitmap == NULL)
   {
      bool nullBitmap = false;

      if (mPositionChanged == false && mBitmap == NULL)
         nullBitmap = true;

      mPositionChanged = false;
      Point2I extent = getRoot()->getExtent();

      // If we are anything but a pallete, change the pick color
      if (mDisplayMode != pPallet)
      {
         Point2I resolution = getRoot()->getExtent();

         U32 buf_x = offset.x + mSelectorPos.x + 1;
         U32 buf_y = resolution.y - (extent.y - (offset.y + mSelectorPos.y + 1));

         GFXTexHandle bb( resolution.x, resolution.y, GFXFormatR8G8B8A8, &GFXDefaultRenderTargetProfile, avar("%s() - bb (line %d)", __FUNCTION__, __LINE__) );

         Point2I tmpPt(buf_x, buf_y);

         GFXTarget *targ = GFX->getActiveRenderTarget();
         targ->resolveTo(bb);

         if (mBitmap)
         {
            delete mBitmap;
            mBitmap = NULL;
         }

         mBitmap = new GBitmap(bb.getWidth(), bb.getHeight());

         bb.copyToBmp(mBitmap);

         if (!nullBitmap)
         {
            if (mSelectColor)
            {
               Point2I pos = findColor(mSetColor, offset, resolution, *mBitmap);
               mSetColor = mSetColor.BLACK;
               mSelectColor = false;
               setSelectorPos(pos);
            }
            else
            {
               ColorI tmp;
               mBitmap->getColor(buf_x, buf_y, tmp);

               mPickColor = (ColorF)tmp;

               // Now do onAction() if we are allowed
               if (mActionOnMove)
                  onAction();
            }
         }
      }
   }

   //render the children
   renderChildControls(offset, updateRect);
}
Ejemplo n.º 19
0
void CTTCheckBtnGroup::DrawGradient(CDC* pDC, CRect rect)
{
	Color gdipBaseColor, gdipLightColor;

	COLORREF baseColor = m_ColorMap.GetColor(Press, BackgroundTopGradientStart);
	HLSColor hlsBaseColor = RgbToHls(baseColor);
	if (hlsBaseColor.L > 0.8)
	{
	
		COLORREF darkColor = GetLumColor(baseColor, -0.3);

		gdipBaseColor.SetFromCOLORREF(baseColor);
		gdipLightColor.SetFromCOLORREF(darkColor);
	}
	else
	{
		COLORREF lightColor = GetLumColor(baseColor, 0.3);

		gdipBaseColor.SetFromCOLORREF(baseColor);
		gdipLightColor.SetFromCOLORREF(lightColor);
	}	

	Graphics graphics(pDC->GetSafeHdc());
	graphics.SetSmoothingMode(SmoothingModeAntiAlias);
	graphics.SetInterpolationMode(InterpolationModeHighQualityBicubic);

	// Draw frag rectangle
	Rect boundsRect(rect.left, rect.top, rect.Width(), rect.Height());

	GraphicsPath path;
	GetRoundRectPath(&path, boundsRect, 8);
	
	Rect upperRect(boundsRect);
	upperRect.Height = boundsRect.Height / 2;

	Rect lowerRect(boundsRect);
	lowerRect.Y = upperRect.GetBottom() - 1;
	lowerRect.Height = boundsRect.Height - upperRect.Height;

	
	Rect upGradRect(upperRect);
	upGradRect.Inflate(0, 1);

	Rect loGradRect(lowerRect);
	loGradRect.Inflate(0, 1);

	LinearGradientBrush brush1(upGradRect, gdipLightColor, gdipBaseColor, LinearGradientMode::LinearGradientModeVertical);
	LinearGradientBrush brush2(loGradRect, gdipBaseColor, gdipBaseColor, LinearGradientMode::LinearGradientModeVertical);

	//SolidBrush brush(baseColor);

	//graphics.FillRectangle(&brush, upperRect);
	//graphics.FillPath(&brush1, &path);

	Region wholeRgn(&path);

	Region upperRgn(upperRect);
	upperRgn.Intersect(&wholeRgn);

	Region lowerRgn(lowerRect);
	lowerRgn.Intersect(&wholeRgn);

	graphics.FillRegion(&brush1, &upperRgn);
	graphics.FillRegion(&brush2, &lowerRgn);

	//SolidBrush brush(gdipFragColor);
	//graphics.FillPath(&brush, &path);
}
Ejemplo n.º 20
0
void CCSlot::_updateFrame()
{
    const auto frameDisplay = (DBCCSprite*)(this->_rawDisplay);

    if (this->_display && this->_displayIndex >= 0)
    {
        const unsigned displayIndex = this->_displayIndex;
        const auto rawDisplayData = displayIndex < this->_displayDataSet->displays.size() ? this->_displayDataSet->displays[displayIndex] : nullptr;
        const auto replacedDisplayData = displayIndex < this->_replacedDisplayDataSet.size() ? this->_replacedDisplayDataSet[displayIndex] : nullptr;
        const auto currentDisplayData = replacedDisplayData ? replacedDisplayData : rawDisplayData;
        const auto currentTextureData = static_cast<CCTextureData*>(currentDisplayData->textureData);

        if (currentTextureData)
        {
            if (!currentTextureData->texture)
            {
                const auto textureAtlasTexture = static_cast<CCTextureAtlasData*>(currentTextureData->parent)->texture;
                if (textureAtlasTexture)
                {
                    cocos2d::Rect rect(currentTextureData->region.x, currentTextureData->region.y, currentTextureData->region.width, currentTextureData->region.height);
                    cocos2d::Vec2 offset(0.f, 0.f);
                    cocos2d::Size originSize(currentTextureData->region.width, currentTextureData->region.height);

                    /*if (currentTextureData->frame) 
                    {
                        offset.setPoint(-currentTextureData->frame->x, -currentTextureData->frame->y);
                        originSize.setSize(currentTextureData->frame->width, currentTextureData->frame->height);
                    }*/

                    currentTextureData->texture = cocos2d::SpriteFrame::createWithTexture(textureAtlasTexture, rect, currentTextureData->rotated, offset, originSize); // TODO multiply textureAtlas
                    currentTextureData->texture->retain();
                }
            }

            const auto currentTexture = this->_armature->_replacedTexture ? static_cast<cocos2d::Texture2D*>(this->_armature->_replacedTexture) : (currentTextureData->texture ? currentTextureData->texture->getTexture() : nullptr);

            if (currentTexture)
            {
                if (this->_meshData && this->_display == this->_meshDisplay)
                {
                    const auto& region = currentTextureData->region;
                    const auto& textureAtlasSize = currentTextureData->texture->getTexture()->getContentSizeInPixels();
                    auto displayVertices = new cocos2d::V3F_C4B_T2F[(unsigned)(this->_meshData->uvs.size() / 2)]; // does cocos2dx release it?
                    auto vertexIndices = new unsigned short[this->_meshData->vertexIndices.size()]; // does cocos2dx release it?
                    cocos2d::Rect boundsRect(999999.f, 999999.f, -999999.f, -999999.f);

                    for (std::size_t i = 0, l = this->_meshData->uvs.size(); i < l; i += 2)
                    {
                        const auto iH = (unsigned)(i / 2);
                        const auto x = this->_meshData->vertices[i];
                        const auto y = this->_meshData->vertices[i + 1];
                        cocos2d::V3F_C4B_T2F vertexData;
                        vertexData.vertices.set(x, -y, 0.f);
                        vertexData.texCoords.u = (region.x + this->_meshData->uvs[i] * region.width) / textureAtlasSize.width;
                        vertexData.texCoords.v = (region.y + this->_meshData->uvs[i + 1] * region.height) / textureAtlasSize.height;
                        vertexData.colors = cocos2d::Color4B::WHITE;
                        displayVertices[iH] = vertexData;

                        if (boundsRect.origin.x > x)
                        {
                            boundsRect.origin.x = x;
                        }

                        if (boundsRect.size.width < x) 
                        {
                            boundsRect.size.width = x;
                        }

                        if (boundsRect.origin.y > -y)
                        {
                            boundsRect.origin.y = -y;
                        }

                        if (boundsRect.size.height < -y)
                        {
                            boundsRect.size.height = -y;
                        }
                    }

                    boundsRect.size.width -= boundsRect.origin.x;
                    boundsRect.size.height -= boundsRect.origin.y;

                    for (std::size_t i = 0, l = this->_meshData->vertexIndices.size(); i < l; ++i)
                    {
                        vertexIndices[i] = this->_meshData->vertexIndices[i];
                    }

                    // In cocos2dx render meshDisplay and frameDisplay are the same display
                    frameDisplay->setSpriteFrame(currentTextureData->texture); // polygonInfo will be override
                    if (currentTexture != currentTextureData->texture->getTexture())
                    {
                        frameDisplay->setTexture(currentTexture); // Relpace texture // polygonInfo will be override
                    }

                    //
                    cocos2d::PolygonInfo polygonInfo;
                    auto& triangles = polygonInfo.triangles;
                    triangles.verts = displayVertices;
                    triangles.indices = vertexIndices;
                    triangles.vertCount = (unsigned)(this->_meshData->uvs.size() / 2);
                    triangles.indexCount = (unsigned)(this->_meshData->vertexIndices.size());
                    polygonInfo.rect = boundsRect; // Copy
                    frameDisplay->setPolygonInfo(polygonInfo);
                    frameDisplay->setContentSize(boundsRect.size);

                    if (this->_meshData->skinned)
                    {
                        frameDisplay->setScale(1.f, 1.f);
                        frameDisplay->setRotationSkewX(0.f);
                        frameDisplay->setRotationSkewY(0.f);
                        frameDisplay->setPosition(0.f, 0.f);
                    }

                    frameDisplay->setAnchorPoint(cocos2d::Vec2::ZERO);
                }
                else
                {
                    cocos2d::Vec2 pivot(currentDisplayData->pivot.x, currentDisplayData->pivot.y);

                    const auto& rectData = currentTextureData->frame ? *currentTextureData->frame : currentTextureData->region;
                    auto width = rectData.width;
                    auto height = rectData.height;
                    if (!currentTextureData->frame && currentTextureData->rotated)
                    {
                        width = rectData.height;
                        height = rectData.width;
                    }

                    if (currentDisplayData->isRelativePivot)
                    {
                        pivot.x *= width;
                        pivot.y *= height;
                    }

                    if (currentTextureData->frame)
                    {
                        pivot.x += currentTextureData->frame->x;
                        pivot.y += currentTextureData->frame->y;
                    }

                    if (rawDisplayData && rawDisplayData != currentDisplayData)
                    {
                        pivot.x += rawDisplayData->transform.x - currentDisplayData->transform.x;
                        pivot.y += rawDisplayData->transform.y - currentDisplayData->transform.y;
                    }

                    pivot.x = pivot.x / currentTextureData->region.width;
                    pivot.y = 1.f - pivot.y / currentTextureData->region.height;

                    frameDisplay->setSpriteFrame(currentTextureData->texture); // polygonInfo will be override

                    if (currentTexture != currentTextureData->texture->getTexture())
                    {
                        frameDisplay->setTexture(currentTexture); // Relpace texture // polygonInfo will be override
                    }

                    frameDisplay->setAnchorPoint(pivot);
                }

                this->_updateVisible();

                return;
            }
        }
    }

    frameDisplay->setTexture(nullptr);
    frameDisplay->setTextureRect(cocos2d::Rect::ZERO);
    frameDisplay->setAnchorPoint(cocos2d::Vec2::ZERO);
    frameDisplay->setVisible(false);
}