<commit_before>/***************************************************************************

 NBitmap.mcc - New Bitmap MUI Custom Class
 Copyright (C) 2006 by <NAME>
 Copyright (C) 2007-2008 by NList Open Source Team

 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.

 NList classes Support Site:  http://www.sf.net/projects/nlist-classes

 $Id$

***************************************************************************/

#include <proto/graphics.h>
#include <graphics/gfxbase.h>

#include "Chunky2Bitmap.h"

#include "private.h"

struct BitMap *Chunky2Bitmap(APTR chunky, ULONG width, ULONG height, ULONG depth)
{
  struct BitMap *bm = NULL;

  ENTER();

  if(chunky != NULL && width > 0 && height > 0)
  {
    if((bm = AllocBitMap(width, height, min(8, depth), BMF_CLEAR|BMF_MINPLANES, NULL)) != NULL)
    {
      struct BitMap *tempBM;

      if((tempBM = AllocBitMap(width, 1, min(8, depth), BMF_CLEAR, NULL)) != NULL)
      {
        struct RastPort remapRP;
        struct RastPort tempRP;
        ULONG y;
        char *chunkyPtr = chunky;
        #if !defined(__amigaos4__) && !defined(__MORPHOS__) && !defined(__AROS__)
        BOOL useWPL8 = (GfxBase->LibNode.lib_Version > 40);
        #endif // !__amigaos4 && !__MORPHOS__ && !__AROS__

        InitRastPort(&remapRP);
        remapRP.BitMap = bm;

        InitRastPort(&tempRP);
        tempRP.BitMap = tempBM;

        for(y = 0; y < height; y++)
        {
          #if defined(__amigaos4__) || defined(__MORPHOS__) || defined(__AROS__)<commit_msg>* nbitmap_mcc/Chunky2Bitmap.c: added a comment about the broken WPL8() function<commit_after>/***************************************************************************

 NBitmap.mcc - New Bitmap MUI Custom Class
 Copyright (C) 2006 by <NAME>
 Copyright (C) 2007-2008 by NList Open Source Team

 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.

 NList classes Support Site:  http://www.sf.net/projects/nlist-classes

 $Id$

***************************************************************************/

#include <proto/graphics.h>
#include <graphics/gfxbase.h>

#include "Chunky2Bitmap.h"

#include "private.h"

struct BitMap *Chunky2Bitmap(APTR chunky, ULONG width, ULONG height, ULONG depth)
{
  struct BitMap *bm = NULL;

  ENTER();

  if(chunky != NULL && width > 0 && height > 0)
  {
    if((bm = AllocBitMap(width, height, min(8, depth), BMF_CLEAR|BMF_MINPLANES, NULL)) != NULL)
    {
      struct BitMap *tempBM;

      if((tempBM = AllocBitMap(width, 1, min(8, depth), BMF_CLEAR, NULL)) != NULL)
      {
        struct RastPort remapRP;
        struct RastPort tempRP;
        ULONG y;
        char *chunkyPtr = chunky;
        #if !defined(__amigaos4__) && !defined(__MORPHOS__) && !defined(__AROS__)
        // WritePixelLine8() is broken on plain OS3.1 systems, don't use it!
        BOOL useWPL8 = (GfxBase->LibNode.lib_Version > 40);
        #endif // !__amigaos4 && !__MORPHOS__ && !__AROS__

        InitRastPort(&remapRP);
        remapRP.BitMap = bm;

        InitRastPort(&tempRP);
        tempRP.BitMap = tempBM;

        for(y = 0; y < height; y++)
        {
          #if defined(__amigaos4__) || defined(__MORPHOS__) || defined(__AROS__)
{'fraction_non_alphanumeric': 0.16932515337423312, 'fraction_numerical': 0.014969325153374234, 'mean_word_length': 3.549107142857143, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6482690', 'n_tokens_mistral': 1277, 'n_tokens_neox': 1198, 'n_words': 404}