Author: mlytwyn Date: Wed Oct 5 22:16:53 2016 New Revision: 40130 URL: http://svn.gna.org/viewcvs/gnustep?rev=40130&view=rev Log: Merge with trunk revision 40072
Added: libs/gui/branches/gnustep_testplant_branch/Source/NSBitmapImageRepPrivate.h Modified: libs/gui/branches/gnustep_testplant_branch/Source/NSButton.m libs/gui/branches/gnustep_testplant_branch/Source/NSButtonCell.m libs/gui/branches/gnustep_testplant_branch/Source/NSCell.m Added: libs/gui/branches/gnustep_testplant_branch/Source/NSBitmapImageRepPrivate.h URL: http://svn.gna.org/viewcvs/gnustep/libs/gui/branches/gnustep_testplant_branch/Source/NSBitmapImageRepPrivate.h?rev=40130&view=auto ============================================================================== --- libs/gui/branches/gnustep_testplant_branch/Source/NSBitmapImageRepPrivate.h (added) +++ libs/gui/branches/gnustep_testplant_branch/Source/NSBitmapImageRepPrivate.h Wed Oct 5 22:16:53 2016 @@ -0,0 +1,54 @@ +/** <title>NSBitmapImageRepPrivate.h</title> + + <abstract>The private methods of the NSBitmapImageRep classes.</abstract> + + Copyright (C) 2016 Free Software Foundation, Inc. + + Author: Fred Kiefer <fredkie...@gmx.de> + Date: Jun 2016 + + This file is part of the GNUstep GUI Library. + + 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 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; see the file COPYING.LIB. + If not, see <http://www.gnu.org/licenses/> or write to the + Free Software Foundation, 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ +#import "AppKit/NSBitmapImageRep.h" +#include "nsimage-tiff.h" + +@interface NSBitmapImageRep (GSPrivate) +// GNUstep extension ++ (BOOL) _bitmapIsTIFF: (NSData *)data; ++ (NSArray*) _imageRepsWithTIFFData: (NSData *)imageData; +- (NSBitmapImageRep *) _initBitmapFromTIFF: (NSData *)imageData; +- (NSBitmapImageRep *) _initFromTIFFImage: (TIFF *)image number: (int)imageNumber; +- (void) _fillTIFFInfo: (NSTiffInfo*)info + usingCompression: (NSTIFFCompression)type + factor: (float)factor; + +// Internal ++ (int) _localFromCompressionType: (NSTIFFCompression)type; ++ (NSTIFFCompression) _compressionTypeFromLocal: (int)type; +- (void) _premultiply; +- (void) _unpremultiply; +- (NSBitmapImageRep *) _convertToFormatBitsPerSample: (NSInteger)bps + samplesPerPixel: (NSInteger)spp + hasAlpha: (BOOL)alpha + isPlanar: (BOOL)isPlanar + colorSpaceName: (NSString*)colorSpaceName + bitmapFormat: (NSBitmapFormat)bitmapFormat + bytesPerRow: (NSInteger)rowBytes + bitsPerPixel: (NSInteger)pixelBits; +@end Modified: libs/gui/branches/gnustep_testplant_branch/Source/NSButton.m URL: http://svn.gna.org/viewcvs/gnustep/libs/gui/branches/gnustep_testplant_branch/Source/NSButton.m?rev=40130&r1=40129&r2=40130&view=diff ============================================================================== --- libs/gui/branches/gnustep_testplant_branch/Source/NSButton.m (original) +++ libs/gui/branches/gnustep_testplant_branch/Source/NSButton.m Wed Oct 5 22:16:53 2016 @@ -36,7 +36,6 @@ #import "AppKit/NSButtonCell.h" #import "AppKit/NSEvent.h" #import "AppKit/NSWindow.h" -#import "GNUstepGUI/GSTheme.h" // // class variables Modified: libs/gui/branches/gnustep_testplant_branch/Source/NSButtonCell.m URL: http://svn.gna.org/viewcvs/gnustep/libs/gui/branches/gnustep_testplant_branch/Source/NSButtonCell.m?rev=40130&r1=40129&r2=40130&view=diff ============================================================================== --- libs/gui/branches/gnustep_testplant_branch/Source/NSButtonCell.m (original) +++ libs/gui/branches/gnustep_testplant_branch/Source/NSButtonCell.m Wed Oct 5 22:16:53 2016 @@ -683,7 +683,7 @@ returns NO</p>*/ - (BOOL) isOpaque { -#if 0 +#if 0 // Testplant-MAL-10052016: keeping branch code... // May not be opaque, due to themes return NO; #else @@ -807,6 +807,7 @@ [self setAlignment: NSLeftTextAlignment]; [self setBordered: NO]; [self setBezeled: NO]; + // Testplant-MAL-10052016: keeping branch code... [self setBezelStyle:NSRegularSquareBezelStyle]; [self setImageDimsWhenDisabled: NO]; break; @@ -1506,6 +1507,7 @@ return s; } +// Testplant-MAL-10052016: keeping branch code... - (NSRect)insetFrame:(NSRect)frame withMargins:(GSThemeMargins)margins { NSRect result = frame; @@ -1555,6 +1557,7 @@ border = [[GSTheme theme] buttonMarginsForCell: self style: _bezel_style state: buttonState]; + // Testplant-MAL-10052016: keeping branch code... interiorFrame = [self insetFrame:theRect withMargins:border]; /* Pushed in buttons contents are displaced to the bottom right 1px. */ @@ -1567,6 +1570,7 @@ } else { + // Testplant-MAL-10052016: keeping branch code... GSThemeMargins margins = [[GSTheme theme] buttonMarginsForCell: self style: _bezel_style state: GSThemeNormalState]; Modified: libs/gui/branches/gnustep_testplant_branch/Source/NSCell.m URL: http://svn.gna.org/viewcvs/gnustep/libs/gui/branches/gnustep_testplant_branch/Source/NSCell.m?rev=40130&r1=40129&r2=40130&view=diff ============================================================================== --- libs/gui/branches/gnustep_testplant_branch/Source/NSCell.m (original) +++ libs/gui/branches/gnustep_testplant_branch/Source/NSCell.m Wed Oct 5 22:16:53 2016 @@ -2003,18 +2003,11 @@ return NSInsetRect(theRect, borderSize.width, borderSize.height); } -/**<p>The GNUstep implementation returns -drawingRectForBounds:</p> +/**<p>Frame the image gets drawn in</p> */ - (NSRect) imageRectForBounds: (NSRect)theRect { - return [self drawingRectForBounds: theRect]; -} - -/** <p>TODO</p> - */ -- (NSRect) titleRectForBounds: (NSRect)theRect -{ - if (_cell.type == NSTextCellType) + if (_cell.type == NSImageCellType) { NSRect frame = [self drawingRectForBounds: theRect]; @@ -2025,6 +2018,30 @@ frame.size.width -= 6; frame.origin.y += 1; frame.size.height -= 2; +} + return frame; + } + else + { + return theRect; + } +} + +/** <p>Frame the title gets drawn in</p> + */ +- (NSRect) titleRectForBounds: (NSRect)theRect +{ + if (_cell.type == NSTextCellType) + { + NSRect frame = [self drawingRectForBounds: theRect]; + + // Add spacing between border and inside + if (_cell.is_bordered || _cell.is_bezeled) + { + frame.origin.x += 3; + frame.size.width -= 6; + frame.origin.y += 1; + frame.size.height -= 2; } return frame; } @@ -2074,18 +2091,6 @@ */ - (void) drawInteriorWithFrame: (NSRect)cellFrame inView: (NSView*)controlView { - NSRect drawingRect = [self drawingRectForBounds: cellFrame]; - - //FIXME: Check if this is also neccessary for images, - // Add spacing between border and inside - if (_cell.is_bordered || _cell.is_bezeled) - { - drawingRect.origin.x += 3; - drawingRect.size.width -= 6; - drawingRect.origin.y += 1; - drawingRect.size.height -= 2; - } - switch (_cell.type) { case NSTextCellType: @@ -2093,7 +2098,7 @@ [self _drawEditorWithFrame: cellFrame inView: controlView]; else [self _drawAttributedText: [self _drawAttributedString] - inFrame: drawingRect]; + inFrame: [self titleRectForBounds: cellFrame]]; break; case NSImageCellType: @@ -2101,12 +2106,20 @@ { NSSize size; NSPoint position; + NSRect drawingRect = [self imageRectForBounds: cellFrame]; + NSRect rect; size = [_cell_image size]; position.x = MAX(NSMidX(drawingRect) - (size.width/2.),0.); position.y = MAX(NSMidY(drawingRect) - (size.height/2.),0.); - - [_cell_image drawInRect: NSMakeRect(position.x, position.y, size.width, size.height) + rect = NSMakeRect(position.x, position.y, size.width, size.height); + + if (nil != controlView) + { + rect = [controlView centerScanRect: rect]; + } + + [_cell_image drawInRect: rect fromRect: NSZeroRect operation: NSCompositeSourceOver fraction: 1.0 _______________________________________________ Gnustep-cvs mailing list Gnustep-cvs@gna.org https://mail.gna.org/listinfo/gnustep-cvs