| Filename | /home/ocbnet/domain/ocbnet.ch/vhost/webmerge/htdocs/webmerge/scripts/modules/OCBNET/Spritesets/Corner.pm |
| Statements | Executed 823 statements in 54.5ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 48 | 1 | 1 | 50.7ms | 60.7ms | OCBNET::Spritesets::Corner::layout |
| 48 | 4 | 1 | 2.42ms | 8.73ms | OCBNET::Spritesets::Corner::new |
| 64 | 2 | 1 | 701µs | 701µs | OCBNET::Spritesets::Corner::isRight |
| 64 | 2 | 1 | 677µs | 677µs | OCBNET::Spritesets::Corner::isBottom |
| 1 | 1 | 1 | 84µs | 184µs | OCBNET::Spritesets::Corner::BEGIN@10 |
| 1 | 1 | 1 | 59µs | 92µs | OCBNET::Spritesets::Corner::BEGIN@11 |
| 1 | 1 | 1 | 50µs | 444µs | OCBNET::Spritesets::Corner::BEGIN@16 |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | ################################################################################################### | ||||
| 2 | # Copyright 2013 by Marcel Greter | ||||
| 3 | # This file is part of Webmerge (GPL3) | ||||
| 4 | #################################################################################################### | ||||
| 5 | # this block can only contain one sprite | ||||
| 6 | #################################################################################################### | ||||
| 7 | package OCBNET::Spritesets::Corner; | ||||
| 8 | #################################################################################################### | ||||
| 9 | |||||
| 10 | 2 | 164µs | 2 | 285µs | # spent 184µs (84+100) within OCBNET::Spritesets::Corner::BEGIN@10 which was called:
# once (84µs+100µs) by OCBNET::Spritesets::BEGIN@27 at line 10 # spent 184µs making 1 call to OCBNET::Spritesets::Corner::BEGIN@10
# spent 100µs making 1 call to strict::import |
| 11 | 2 | 183µs | 2 | 124µs | # spent 92µs (59+33) within OCBNET::Spritesets::Corner::BEGIN@11 which was called:
# once (59µs+33µs) by OCBNET::Spritesets::BEGIN@27 at line 11 # spent 92µs making 1 call to OCBNET::Spritesets::Corner::BEGIN@11
# spent 33µs making 1 call to warnings::import |
| 12 | |||||
| 13 | #################################################################################################### | ||||
| 14 | |||||
| 15 | # a container is also a block | ||||
| 16 | 2 | 1.45ms | 2 | 839µs | # spent 444µs (50+395) within OCBNET::Spritesets::Corner::BEGIN@16 which was called:
# once (50µs+395µs) by OCBNET::Spritesets::BEGIN@27 at line 16 # spent 444µs making 1 call to OCBNET::Spritesets::Corner::BEGIN@16
# spent 395µs making 1 call to base::import |
| 17 | |||||
| 18 | #################################################################################################### | ||||
| 19 | |||||
| 20 | # create a new object | ||||
| 21 | # ****************************************************************************** | ||||
| 22 | sub new | ||||
| 23 | # spent 8.73ms (2.42+6.32) within OCBNET::Spritesets::Corner::new which was called 48 times, avg 182µs/call:
# 12 times (712µs+1.57ms) by OCBNET::Spritesets::Canvas::new at line 93 of webmerge/scripts/modules/OCBNET/Spritesets/Canvas.pm, avg 190µs/call
# 12 times (566µs+1.60ms) by OCBNET::Spritesets::Canvas::new at line 94 of webmerge/scripts/modules/OCBNET/Spritesets/Canvas.pm, avg 180µs/call
# 12 times (573µs+1.57ms) by OCBNET::Spritesets::Canvas::new at line 96 of webmerge/scripts/modules/OCBNET/Spritesets/Canvas.pm, avg 179µs/call
# 12 times (568µs+1.57ms) by OCBNET::Spritesets::Canvas::new at line 95 of webmerge/scripts/modules/OCBNET/Spritesets/Canvas.pm, avg 178µs/call | ||||
| 24 | |||||
| 25 | # get package name, parent and options | ||||
| 26 | 48 | 187µs | my ($pckg, $parent, $right, $bottom) = @_; | ||
| 27 | |||||
| 28 | # get object by calling super class | ||||
| 29 | 48 | 1.32ms | 48 | 6.32ms | my $self = $pckg->SUPER::new($parent); # spent 6.32ms making 48 calls to OCBNET::Spritesets::Container::new, avg 132µs/call |
| 30 | |||||
| 31 | # set the options for the corner | ||||
| 32 | 48 | 147µs | $self->{'is-right'} = $right; | ||
| 33 | 48 | 73µs | $self->{'is-bottom'} = $bottom; | ||
| 34 | |||||
| 35 | # return object | ||||
| 36 | 48 | 698µs | return $self; | ||
| 37 | |||||
| 38 | } | ||||
| 39 | |||||
| 40 | #################################################################################################### | ||||
| 41 | |||||
| 42 | # getter methods for the specific options | ||||
| 43 | # ****************************************************************************** | ||||
| 44 | 64 | 43.1ms | sub isRight { return $_[0]->{'is-right'}; } | ||
| 45 | 64 | 1.05ms | sub isBottom { return $_[0]->{'is-bottom'}; } | ||
| 46 | |||||
| 47 | #################################################################################################### | ||||
| 48 | |||||
| 49 | # calculate positions and dimensions | ||||
| 50 | # ****************************************************************************** | ||||
| 51 | sub layout | ||||
| 52 | # spent 60.7ms (50.7+9.98) within OCBNET::Spritesets::Corner::layout which was called 48 times, avg 1.26ms/call:
# 48 times (50.7ms+9.98ms) by OCBNET::Spritesets::Canvas::Layout::layout at line 108 of webmerge/scripts/modules/OCBNET/Spritesets/Canvas/Layout.pm, avg 1.26ms/call | ||||
| 53 | |||||
| 54 | # get our object | ||||
| 55 | 48 | 145µs | my ($self) = @_; | ||
| 56 | |||||
| 57 | # do nothing if empty | ||||
| 58 | 48 | 744µs | 48 | 717µs | return if $self->empty; # spent 717µs making 48 calls to OCBNET::Spritesets::Container::empty, avg 15µs/call |
| 59 | |||||
| 60 | # check if we really only have one child | ||||
| 61 | 32 | 443µs | 32 | 397µs | die "illegal state" if $self->length != 1; # spent 397µs making 32 calls to OCBNET::Spritesets::Container::length, avg 12µs/call |
| 62 | |||||
| 63 | # get the only sprite in the corner | ||||
| 64 | 32 | 172µs | my $sprite = $self->{'children'}->[0]; | ||
| 65 | |||||
| 66 | # remove unnecessary paddings | ||||
| 67 | 32 | 549µs | 48 | 572µs | $sprite->paddingTop = 0 if not $self->isBottom; # spent 373µs making 32 calls to OCBNET::Spritesets::Corner::isBottom, avg 12µs/call
# spent 198µs making 16 calls to OCBNET::Spritesets::Block::paddingTop, avg 12µs/call |
| 68 | 32 | 590µs | 48 | 623µs | $sprite->paddingLeft = 0 if not $self->isRight; # spent 386µs making 32 calls to OCBNET::Spritesets::Corner::isRight, avg 12µs/call
# spent 236µs making 16 calls to OCBNET::Spritesets::Block::paddingLeft, avg 15µs/call |
| 69 | 32 | 475µs | 48 | 477µs | $sprite->paddingRight = 0 if $self->isRight; # spent 315µs making 32 calls to OCBNET::Spritesets::Corner::isRight, avg 10µs/call
# spent 162µs making 16 calls to OCBNET::Spritesets::Block::paddingRight, avg 10µs/call |
| 70 | 32 | 481µs | 48 | 502µs | $sprite->paddingBottom = 0 if $self->isBottom; # spent 304µs making 32 calls to OCBNET::Spritesets::Corner::isBottom, avg 9µs/call
# spent 199µs making 16 calls to OCBNET::Spritesets::Block::paddingBottom, avg 12µs/call |
| 71 | |||||
| 72 | # fix position to zero | ||||
| 73 | 32 | 379µs | 32 | 350µs | $sprite->left = 0; # spent 350µs making 32 calls to OCBNET::Spritesets::Block::left, avg 11µs/call |
| 74 | 32 | 335µs | 32 | 331µs | $sprite->top = 0; # spent 331µs making 32 calls to OCBNET::Spritesets::Block::top, avg 10µs/call |
| 75 | |||||
| 76 | # use the dimension of the sprite | ||||
| 77 | 32 | 666µs | 64 | 3.03ms | $self->width = $sprite->outerWidth; # spent 2.70ms making 32 calls to OCBNET::Spritesets::Block::outerWidth, avg 84µs/call
# spent 325µs making 32 calls to OCBNET::Spritesets::Block::width, avg 10µs/call |
| 78 | 32 | 645µs | 64 | 2.99ms | $self->height = $sprite->outerHeight; # spent 2.67ms making 32 calls to OCBNET::Spritesets::Block::outerHeight, avg 83µs/call
# spent 317µs making 32 calls to OCBNET::Spritesets::Block::height, avg 10µs/call |
| 79 | |||||
| 80 | # return success | ||||
| 81 | 32 | 515µs | return $self; | ||
| 82 | |||||
| 83 | } | ||||
| 84 | # EO sub layout | ||||
| 85 | |||||
| 86 | |||||
| 87 | #################################################################################################### | ||||
| 88 | #################################################################################################### | ||||
| 89 | 1 | 12µs | 1; |