You need only a regex to catch the class from content, check if the class for you size is one of the assigned class and if so add to output, something like:
function my_custom_img_caption_shortcode($a, $attr, $content = null) {
extract( shortcode_atts( array(
'id' => '', 'align' => 'alignnone', 'width' => '', 'caption' => ''
), $attr) );
if ( 1 > (int) $width || empty($caption) ) return $content;
if ( $id ) $id = 'id="' . esc_attr($id) . '" ';
// set the initial class output
$class="wp-caption";
// use a preg match to catch the img class attribute
preg_match('/<img.*class[ \t]*=[ \t]*["\']([^"\']*)["\'][^>]+>/', $content, $matches);
$class_attr = isset($matches[1]) && $matches[1] ? $matches[1] : false;
// if the class attribute is not empty get an array of all classes
if ( $class_attr ) {
foreach ( explode(' ', $class_attr) as $aclass ) {
if ( strpos($aclass, 'size-') === 0 ) $class .= ' ' . $aclass;
}
}
$class .= ' ' . esc_attr($align);
return sprintf (
'<div %sclass="%s" style="width:%dpx">%s<p class="wp-caption-text">%s</p></div>',
$id, $class, (10 + (int)$width), do_shortcode($content), $caption
);
}