/////////////////////////////////////////////////// // // Functions no longer in use // BOOL MacOpPluginAdapter::ConvertPlatformRegionToRect(NPRegion invalidRegion, NPRect &invalidRect) { #ifdef NS4P_COMPONENT_PLUGINS return FALSE; #else // NS4P_COMPONENT_PLUGINS #ifndef NP_NO_QUICKDRAW if (m_plugin_window->GetDrawingModel() == NPDrawingModelQuickDraw) { Rect r; GetRegionBounds((RgnHandle)invalidRegion, &r); invalidRect.left = r.left; invalidRect.top = r.top; invalidRect.bottom = r.bottom; invalidRect.right = r.right; return TRUE; } #endif CGRect bounds = CGPathGetBoundingBox((CGPathRef)invalidRegion); invalidRect.left = bounds.origin.x; invalidRect.top = bounds.origin.y; invalidRect.right = bounds.origin.x+bounds.size.width; invalidRect.bottom = bounds.origin.y+bounds.size.height; return TRUE; #endif // NS4P_COMPONENT_PLUGINS }
FloatRect Path::fastBoundingRect() const { if (isNull()) return CGRectZero; CGRect bound = CGPathGetBoundingBox(m_path); return CGRectIsNull(bound) ? CGRectZero : bound; }
//XXX: what should these functions return for an empty path? // currently they return CGRectNull {inf,inf, 0, 0} Rect PathCG::GetBounds(const Matrix &aTransform) const { //XXX: are these bounds tight enough Rect bounds = CGRectToRect(CGPathGetBoundingBox(mPath)); //XXX: currently this returns the bounds of the transformed bounds // this is strictly looser than the bounds of the transformed path return aTransform.TransformBounds(bounds); }
JNIEXPORT void JNICALL OS_NATIVE(CGPathGetBoundingBox) (JNIEnv *env, jclass that, jint arg0, jobject arg1) { CGRect _arg1, *lparg1=NULL; OS_NATIVE_ENTER(env, that, CGPathGetBoundingBox_FUNC); if (arg1) if ((lparg1 = getCGRectFields(env, arg1, &_arg1)) == NULL) goto fail; *lparg1 = CGPathGetBoundingBox((CGPathRef)arg0); fail: if (arg1 && lparg1) setCGRectFields(env, arg1, lparg1); OS_NATIVE_EXIT(env, that, CGPathGetBoundingBox_FUNC); }
void TIPGradientAxialFillPath( CGContextRef theContext, TIPGradientRef theGradient, CGPathRef thePath, float angle) { CGRect boundingRect = CGPathGetBoundingBox(thePath); CGPoint startPoint; CGPoint endPoint; TIPGradientFindEndpointsForRotation(boundingRect,angle,&startPoint,&endPoint); // CoreGraphics Calls CGContextSaveGState(theContext); CGColorSpaceRef colorSpace = CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB); CGShadingRef myCGShading = CGShadingCreateAxial(colorSpace,startPoint,endPoint,theGradient->gradientFunction,FALSE,FALSE); CGContextAddPath(theContext,thePath); CGContextClip(theContext); CGContextDrawShading(theContext,myCGShading); CGShadingRelease(myCGShading); CGColorSpaceRelease(colorSpace); CGContextRestoreGState(theContext); }
FloatRect Path::boundingRect() const { return CGPathGetBoundingBox(m_path); }