Author: fredkiefer
Date: Sun Jun 19 13:32:32 2016
New Revision: 39879
URL: http://svn.gna.org/viewcvs/gnustep?rev=39879&view=rev
Log:
Speed up window display for opal backing store.
Added:
libs/opal/trunk/Source/OpalGraphics/CGImage-private.h
Modified:
libs/opal/trunk/ChangeLog
libs/opal/trunk/Source/OpalGraphics/CGBitmapContext.m
libs/opal/trunk/Source/OpalGraphics/CGImage.m
Modified: libs/opal/trunk/ChangeLog
URL:
http://svn.gna.org/viewcvs/gnustep/libs/opal/trunk/ChangeLog?rev=39879&r1=39878&r2=39879&view=diff
==============================================================================
--- libs/opal/trunk/ChangeLog (original)
+++ libs/opal/trunk/ChangeLog Sun Jun 19 13:32:32 2016
@@ -1,3 +1,12 @@
+2016-06-19 Fred Kiefer <[email protected]>
+
+ * Source/OpalGraphics/CGImage-private.h
+ Add private header file.
+ * Source/OpalGraphics/CGImage.m
+ Extract code for private header file.
+ * Source/OpalGraphics/CGBitmapContext.m
+ Set the surface of image directly.
+
2015-12-13 Fred Kiefer <[email protected]>
* Tests/GNUmakefile
Modified: libs/opal/trunk/Source/OpalGraphics/CGBitmapContext.m
URL:
http://svn.gna.org/viewcvs/gnustep/libs/opal/trunk/Source/OpalGraphics/CGBitmapContext.m?rev=39879&r1=39878&r2=39879&view=diff
==============================================================================
--- libs/opal/trunk/Source/OpalGraphics/CGBitmapContext.m (original)
+++ libs/opal/trunk/Source/OpalGraphics/CGBitmapContext.m Sun Jun 19
13:32:32 2016
@@ -24,6 +24,7 @@
#include "CoreGraphics/CGBitmapContext.h"
#include "CGContext-private.h"
+#include "CGImage-private.h"
#import "OPImageConversion.h"
@@ -436,7 +437,7 @@
kCGRenderingIntentDefault
);
- //img->surf = cairo_get_target(ctx->ct);
+ img->surf = cairo_surface_reference(cairo_get_target(ctx->ct));
CGDataProviderRelease(dp);
OPRESTORELOGGING()
return img;
Added: libs/opal/trunk/Source/OpalGraphics/CGImage-private.h
URL:
http://svn.gna.org/viewcvs/gnustep/libs/opal/trunk/Source/OpalGraphics/CGImage-private.h?rev=39879&view=auto
==============================================================================
--- libs/opal/trunk/Source/OpalGraphics/CGImage-private.h (added)
+++ libs/opal/trunk/Source/OpalGraphics/CGImage-private.h Sun Jun 19
13:32:32 2016
@@ -0,0 +1,53 @@
+/** <title>CGImage</title>
+
+ <abstract>C Interface to graphics drawing library</abstract>
+
+ Copyright <copy>(C) 2010,2016 Free Software Foundation, Inc.</copy>
+
+ Author: Eric Wasylishen <[email protected]>
+ Date: June, 2010
+ Author: BALATON Zoltan <[email protected]>
+ Date: 2006
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#include "CoreGraphics/CGImage.h"
+#include "CGDataProvider-private.h"
+#include <cairo.h>
+
+@interface CGImage : NSObject
+{
+@public
+ bool ismask;
+ size_t width;
+ size_t height;
+ size_t bitsPerComponent;
+ size_t bitsPerPixel;
+ size_t bytesPerRow;
+ CGDataProviderRef dp;
+ CGFloat *decode;
+ bool shouldInterpolate;
+ /* alphaInfo is always AlphaNone for mask */
+ CGBitmapInfo bitmapInfo;
+ /* cspace and intent are only set for image */
+ CGColorSpaceRef cspace;
+ CGColorRenderingIntent intent;
+ /* used for CGImageCreateWithImageInRect */
+ CGRect crop;
+ cairo_surface_t *surf;
+}
+@end
+
Modified: libs/opal/trunk/Source/OpalGraphics/CGImage.m
URL:
http://svn.gna.org/viewcvs/gnustep/libs/opal/trunk/Source/OpalGraphics/CGImage.m?rev=39879&r1=39878&r2=39879&view=diff
==============================================================================
--- libs/opal/trunk/Source/OpalGraphics/CGImage.m (original)
+++ libs/opal/trunk/Source/OpalGraphics/CGImage.m Sun Jun 19 13:32:32 2016
@@ -24,7 +24,8 @@
#include "CoreGraphics/CGImage.h"
#include "CoreGraphics/CGImageSource.h"
-#include "CGDataProvider-private.h"
+//#include "CGDataProvider-private.h"
+#include "CGImage-private.h"
#import <Foundation/NSString.h>
#import <Foundation/NSDictionary.h>
#include <stdlib.h>
@@ -45,29 +46,6 @@
(int)(((unsigned char*)data)[2]),
(int)(((unsigned char*)data)[3]));
}
-
-@interface CGImage : NSObject
-{
-@public
- bool ismask;
- size_t width;
- size_t height;
- size_t bitsPerComponent;
- size_t bitsPerPixel;
- size_t bytesPerRow;
- CGDataProviderRef dp;
- CGFloat *decode;
- bool shouldInterpolate;
- /* alphaInfo is always AlphaNone for mask */
- CGBitmapInfo bitmapInfo;
- /* cspace and intent are only set for image */
- CGColorSpaceRef cspace;
- CGColorRenderingIntent intent;
- /* used for CGImageCreateWithImageInRect */
- CGRect crop;
- cairo_surface_t *surf;
-}
-@end
@implementation CGImage
@@ -294,9 +272,10 @@
rect = CGRectIntersection(rect, CGRectMake(0, 0, image->width,
image->height));
new->crop = rect;
- // TODO: Implement data provider to crop the data from the source image
- // TODO: Share underlying cairo surface!
- new->surf = image->surf;
+ if (image->surf)
+ {
+ new->surf = cairo_surface_reference(image->surf);
+ }
return new;
}
_______________________________________________
Gnustep-cvs mailing list
[email protected]
https://mail.gna.org/listinfo/gnustep-cvs