~ubuntu-branches/ubuntu/saucy/gnash/saucy-proposed

« back to all changes in this revision

Viewing changes to libcore/asobj/flash/display/BitmapData_as.cpp

  • Committer: Package Import Robot
  • Author(s): Micah Gersten
  • Date: 2012-03-04 03:19:06 UTC
  • mfrom: (1.1.18) (3.1.24 sid)
  • Revision ID: package-import@ubuntu.com-20120304031906-p6q5rnb0xhgpof7o
Tags: 0.8.10-3ubuntu1
* Merge from Debian testing (FFe: LP: #940876), remaining changes:
  - Use mozilla-flashplugin as the alternative for now
  - Change xulrunner-dev build dep to firefox-dev
* Drop the plugin API porting patch, this has been fixed upstream
  - drop debian/patches*
* Drop the following change as we want Adobe's player to take priority
  if it's installed
  - Set alternative priority to 50 so that it matches Adobe Flash's priority

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
// BitmapData_as.cpp:  ActionScript "BitmapData" class, for Gnash.
2
2
//
3
 
//   Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010,
4
 
//   2011 Free Software Foundation, Inc
 
3
//   Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
 
4
//   Free Software Foundation, Inc
5
5
//
6
6
// This program is free software; you can redistribute it and/or modify
7
7
// it under the terms of the GNU General Public License as published by
644
644
 
645
645
    Renderer* base = getRunResources(*_owner).renderer();
646
646
    if (!base) {
647
 
        log_debug(_("BitmapData.draw() called without an active renderer"));
 
647
        log_debug("BitmapData.draw() called without an active renderer");
648
648
        return;
649
649
    }
650
650
 
651
651
    Renderer::Internal in(*base, im);
652
652
    Renderer* internal = in.renderer();
653
653
    if (!internal) {
654
 
        log_debug(_("Current renderer does not support internal rendering"));
 
654
        log_debug("Current renderer does not support internal rendering");
655
655
        return;
656
656
    }
657
657
 
714
714
{
715
715
    BitmapData_as* ptr = ensure<ThisIsNative<BitmapData_as> >(fn);
716
716
    UNUSED(ptr);
717
 
    LOG_ONCE( log_unimpl (__FUNCTION__) );
 
717
    LOG_ONCE(log_unimpl(__FUNCTION__) );
718
718
    return as_value();
719
719
}
720
720
 
756
756
{
757
757
    BitmapData_as* ptr = ensure<ThisIsNative<BitmapData_as> >(fn);
758
758
    UNUSED(ptr);
759
 
    LOG_ONCE( log_unimpl (__FUNCTION__) );
 
759
    LOG_ONCE(log_unimpl(__FUNCTION__) );
760
760
    return as_value();
761
761
}
762
762
 
813
813
    // nothing happens.
814
814
    if (!oneBitSet(destchans)) {
815
815
        IF_VERBOSE_ASCODING_ERRORS(
816
 
            log_aserror("BitmapData.copyChannel(). Multiple "
817
 
                "destination channels are not supported");
 
816
            log_aserror(_("BitmapData.copyChannel(). Multiple "
 
817
                          "destination channels are not supported"));
818
818
        );
819
819
        return as_value();
820
820
    }
839
839
    if (sourceW == 0 || sourceH == 0) {
840
840
        // The source rect does not overlap with source bitmap
841
841
        IF_VERBOSE_ASCODING_ERRORS(
842
 
            log_aserror("BitmapData.copyChannel(): no part of source rectangle"
843
 
                "overlaps with the source BitmapData");
 
842
            log_aserror(_("BitmapData.copyChannel(): no part of source rectangle"
 
843
                          "overlaps with the source BitmapData"));
844
844
        );
845
845
        return as_value();
846
846
    }
853
853
    if (destW == 0 || destH == 0) {
854
854
        // The target rect does not overlap with source bitmap
855
855
        IF_VERBOSE_ASCODING_ERRORS(
856
 
            log_aserror("BitmapData.copyChannel(): destination area is "
857
 
                "wholly outside the destination BitmapData");
 
856
            log_aserror(_("BitmapData.copyChannel(): destination area is "
 
857
                          "wholly outside the destination BitmapData"));
858
858
        );
859
859
        return as_value();
860
860
    }
911
911
        return as_value();
912
912
    }
913
913
    if (fn.nargs > 3) {
914
 
        LOG_ONCE(log_unimpl("BitmapData.copyPixels(): arguments after "
915
 
                    "the first three are discarded"));
 
914
        LOG_ONCE(log_unimpl(_("BitmapData.copyPixels(): arguments after "
 
915
                              "the first three are discarded")));
916
916
    }
917
917
 
918
918
    as_object* o = toObject(fn.arg(0), getVM(fn));
961
961
    if (sourceW == 0 || sourceH == 0) {
962
962
        // The source rect does not overlap with source bitmap
963
963
        IF_VERBOSE_ASCODING_ERRORS(
964
 
            log_aserror("BitmapData.copyPixels(): no part of source rectangle"
965
 
                "overlaps with the source BitmapData");
 
964
            log_aserror(_("BitmapData.copyPixels(): no part of source rectangle"
 
965
                          "overlaps with the source BitmapData"));
966
966
        );
967
967
        return as_value();
968
968
    }
975
975
    if (destW == 0 || destH == 0) {
976
976
        // The target rect does not overlap with source bitmap
977
977
        IF_VERBOSE_ASCODING_ERRORS(
978
 
            log_aserror("BitmapData.copyPixels(): destination area is "
979
 
                "wholly outside the destination BitmapData");
 
978
            log_aserror(_("BitmapData.copyPixels(): destination area is "
 
979
                          "wholly outside the destination BitmapData"));
980
980
        );
981
981
        return as_value();
982
982
    }
1061
1061
        IF_VERBOSE_ASCODING_ERRORS(
1062
1062
            std::ostringstream ss;
1063
1063
            fn.dump_args(ss);
1064
 
            log_aserror("BitmapData.draw(%s) requires at least one argument",
 
1064
            log_aserror(_("BitmapData.draw(%s) requires at least one argument"),
1065
1065
                ss.str());
1066
1066
        );
1067
1067
        return as_value();
1073
1073
 
1074
1074
        BitmapData_as* bitmap;
1075
1075
        if (isNativeType(o, bitmap)) {
1076
 
            LOG_ONCE(log_unimpl("BitmapData.draw() with BitmapData argument"));
 
1076
            LOG_ONCE(log_unimpl(_("BitmapData.draw() with BitmapData argument")));
1077
1077
            return as_value();
1078
1078
        }
1079
1079
 
1080
1080
        IF_VERBOSE_ASCODING_ERRORS(
1081
1081
            std::ostringstream ss;
1082
1082
            fn.dump_args(ss);
1083
 
            log_aserror("BitmapData.draw(%s): first argument must be a "
1084
 
                "MovieClip", ss.str());
 
1083
            log_aserror(_("BitmapData.draw(%s): first argument must be a "
 
1084
                          "MovieClip"), ss.str());
1085
1085
        );
1086
1086
        return as_value();
1087
1087
    }
1117
1117
        IF_VERBOSE_ASCODING_ERRORS(
1118
1118
            std::ostringstream ss;
1119
1119
            fn.dump_args(ss);
1120
 
            log_aserror("BitmapData.fillRect(%s): needs an object", ss.str());
 
1120
            log_aserror(_("BitmapData.fillRect(%s): needs an object"), ss.str());
1121
1121
        );
1122
1122
        return as_value();
1123
1123
    }
1154
1154
 
1155
1155
    if (ptr->disposed()) {
1156
1156
        IF_VERBOSE_ASCODING_ERRORS(
1157
 
            log_aserror("floodFill called on disposed BitmapData!");
 
1157
            log_aserror(_("floodFill called on disposed BitmapData!"));
1158
1158
        );
1159
1159
        return as_value();
1160
1160
    }
1180
1180
{
1181
1181
    BitmapData_as* ptr = ensure<ThisIsNative<BitmapData_as> >(fn);
1182
1182
    UNUSED(ptr);
1183
 
    LOG_ONCE( log_unimpl (__FUNCTION__) );
 
1183
    LOG_ONCE(log_unimpl(__FUNCTION__) );
1184
1184
    return as_value();
1185
1185
}
1186
1186
 
1189
1189
{
1190
1190
    BitmapData_as* ptr = ensure<ThisIsNative<BitmapData_as> >(fn);
1191
1191
    UNUSED(ptr);
1192
 
    LOG_ONCE( log_unimpl (__FUNCTION__) );
 
1192
    LOG_ONCE(log_unimpl(__FUNCTION__) );
1193
1193
    return as_value();
1194
1194
}
1195
1195
 
1228
1228
 
1229
1229
    if (ptr->disposed()) {
1230
1230
        IF_VERBOSE_ASCODING_ERRORS(
1231
 
            log_aserror("getPixel32 called on disposed BitmapData!");
 
1231
            log_aserror(_("getPixel32 called on disposed BitmapData!"));
1232
1232
        );
1233
1233
        return as_value();
1234
1234
    }
1247
1247
{
1248
1248
    BitmapData_as* ptr = ensure<ThisIsNative<BitmapData_as> >(fn);
1249
1249
    UNUSED(ptr);
1250
 
    LOG_ONCE( log_unimpl (__FUNCTION__) );
 
1250
    LOG_ONCE(log_unimpl(__FUNCTION__) );
1251
1251
    return as_value();
1252
1252
}
1253
1253
 
1256
1256
{
1257
1257
    BitmapData_as* ptr = ensure<ThisIsNative<BitmapData_as> >(fn);
1258
1258
    UNUSED(ptr);
1259
 
    LOG_ONCE( log_unimpl (__FUNCTION__) );
 
1259
    LOG_ONCE(log_unimpl(__FUNCTION__) );
1260
1260
    return as_value();
1261
1261
}
1262
1262
 
1303
1303
{
1304
1304
    BitmapData_as* ptr = ensure<ThisIsNative<BitmapData_as> >(fn);
1305
1305
    UNUSED(ptr);
1306
 
    LOG_ONCE( log_unimpl (__FUNCTION__) );
 
1306
    LOG_ONCE(log_unimpl(__FUNCTION__) );
1307
1307
    return as_value();
1308
1308
}
1309
1309
 
1358
1358
    }
1359
1359
 
1360
1360
    if (stitch) {
1361
 
        LOG_ONCE(log_unimpl("BitmapData.perlinNoise() stitch value"));
 
1361
        LOG_ONCE(log_unimpl(_("BitmapData.perlinNoise() stitch value")));
1362
1362
    }
1363
1363
 
1364
1364
    if (!octave || (!channels && !greyscale)) {
1433
1433
{
1434
1434
    BitmapData_as* ptr = ensure<ThisIsNative<BitmapData_as> >(fn);
1435
1435
    UNUSED(ptr);
1436
 
    LOG_ONCE( log_unimpl (__FUNCTION__) );
 
1436
    LOG_ONCE(log_unimpl(__FUNCTION__) );
1437
1437
    return as_value();
1438
1438
}
1439
1439
 
1442
1442
{
1443
1443
    BitmapData_as* ptr = ensure<ThisIsNative<BitmapData_as> >(fn);
1444
1444
    UNUSED(ptr);
1445
 
    LOG_ONCE( log_unimpl (__FUNCTION__) );
 
1445
    LOG_ONCE(log_unimpl(__FUNCTION__) );
1446
1446
    return as_value();
1447
1447
}
1448
1448
 
1499
1499
{
1500
1500
    BitmapData_as* ptr = ensure<ThisIsNative<BitmapData_as> >(fn);
1501
1501
    UNUSED(ptr);
1502
 
    LOG_ONCE( log_unimpl (__FUNCTION__) );
 
1502
    LOG_ONCE(log_unimpl(__FUNCTION__) );
1503
1503
    return as_value();
1504
1504
}
1505
1505
 
1508
1508
{
1509
1509
    BitmapData_as* ptr = ensure<ThisIsNative<BitmapData_as> >(fn);
1510
1510
    UNUSED(ptr);
1511
 
    LOG_ONCE( log_unimpl (__FUNCTION__) );
 
1511
    LOG_ONCE(log_unimpl(__FUNCTION__) );
1512
1512
    return as_value();
1513
1513
}
1514
1514
 
1559
1559
 
1560
1560
    if (!rectCtor) {
1561
1561
        IF_VERBOSE_ASCODING_ERRORS(
1562
 
            log_aserror("Failed to construct flash.geom.Rectangle!");
 
1562
            log_aserror(_("Failed to construct flash.geom.Rectangle!"));
1563
1563
        );
1564
1564
        return -1;
1565
1565
    }
1581
1581
 
1582
1582
    if (!fn.nargs) {
1583
1583
        IF_VERBOSE_ASCODING_ERRORS(
1584
 
            log_aserror("BitmapData.loadBitmap requires one argument");
 
1584
            log_aserror(_("BitmapData.loadBitmap requires one argument"));
1585
1585
        );
1586
1586
        return as_value();
1587
1587
    }
1646
1646
    as_object* ptr = ensure<ValidThis>(fn);
1647
1647
    if (fn.nargs < 2) {
1648
1648
        IF_VERBOSE_ASCODING_ERRORS(
1649
 
             log_aserror("BitmapData constructor requires at least two "
1650
 
                 "arguments. Will not construct a BitmapData");
 
1649
             log_aserror(_("BitmapData constructor requires at least two "
 
1650
                           "arguments. Will not construct a BitmapData"));
1651
1651
        );
1652
1652
        throw ActionTypeError();
1653
1653
    }
1660
1660
    
1661
1661
    if (width > 2880 || height > 2880 || width < 1 || height < 1) {
1662
1662
        IF_VERBOSE_ASCODING_ERRORS(
1663
 
             log_aserror("BitmapData width and height must be between "
1664
 
                 "1 and 2880. Will not construct a BitmapData");
 
1663
             log_aserror(_("BitmapData width and height must be between "
 
1664
                           "1 and 2880. Will not construct a BitmapData"));
1665
1665
        );
1666
1666
        throw ActionTypeError();
1667
1667
    }