Program: 110296
Project: 110296
Buggy source:
/** 
 * Draws the provided   {@link Cue} into a canvas with the specified styling.<p> A call to this method is able to use cached results of calculations made during the previous call, and so an instance of this class is able to optimize repeated calls to this method in which the same parameters are passed.
 * @param cue The cue to draw.
 * @param applyEmbeddedStyles Whether styling embedded within the cue should be applied.
 * @param style The style to use when drawing the cue text.
 * @param textSizePx The text size to use when drawing the cue text, in pixels.
 * @param bottomPaddingFraction The bottom padding fraction to apply when {@link Cue#line} is{@link Cue#DIMEN_UNSET}, as a fraction of the viewport height
 * @param canvas The canvas into which to draw.
 * @param cueBoxLeft The left position of the enclosing cue box.
 * @param cueBoxTop The top position of the enclosing cue box.
 * @param cueBoxRight The right position of the enclosing cue box.
 * @param cueBoxBottom The bottom position of the enclosing cue box.
 */
public void draw(Cue cue,boolean applyEmbeddedStyles,CaptionStyleCompat style,float textSizePx,float bottomPaddingFraction,Canvas canvas,int cueBoxLeft,int cueBoxTop,int cueBoxRight,int cueBoxBottom){
  boolean isTextCue=cue.bitmap == null;
  CharSequence cueText=null;
  Bitmap cueBitmap=null;
  if (isTextCue) {
    cueText=cue.text;
    if (TextUtils.isEmpty(cueText)) {
      return;
    }
    if (!applyEmbeddedStyles) {
      cueText=cueText.toString();
      windowColor=style.windowColor;
    }
  }
 else {
    cueBitmap=cue.bitmap;
  }
  if (areCharSequencesEqual(this.cueText,cueText) && Util.areEqual(this.cueTextAlignment,cue.textAlignment) && this.cueBitmap == cueBitmap && this.cueLine == cue.line && this.cueLineType == cue.lineType && Util.areEqual(this.cueLineAnchor,cue.lineAnchor) && this.cuePosition == cue.position && Util.areEqual(this.cuePositionAnchor,cue.positionAnchor) && this.cueSize == cue.size && this.applyEmbeddedStyles == applyEmbeddedStyles && this.foregroundColor == style.foregroundColor && this.backgroundColor == style.backgroundColor && this.windowColor == style.windowColor && this.edgeType == style.edgeType && this.edgeColor == style.edgeColor && Util.areEqual(this.textPaint.getTypeface(),style.typeface) && this.textSizePx == textSizePx && this.bottomPaddingFraction == bottomPaddingFraction && this.parentLeft == cueBoxLeft && this.parentTop == cueBoxTop && this.parentRight == cueBoxRight && this.parentBottom == cueBoxBottom) {
    drawLayout(canvas,isTextCue);
    return;
  }
  this.cueText=cueText;
  this.cueTextAlignment=cue.textAlignment;
  this.cueBitmap=cueBitmap;
  this.cueLine=cue.line;
  this.cueLineType=cue.lineType;
  this.cueLineAnchor=cue.lineAnchor;
  this.cuePosition=cue.position;
  this.cuePositionAnchor=cue.positionAnchor;
  this.cueSize=cue.size;
  this.applyEmbeddedStyles=applyEmbeddedStyles;
  this.foregroundColor=style.foregroundColor;
  this.backgroundColor=style.backgroundColor;
  this.windowColor=windowColor;
  this.edgeType=style.edgeType;
  this.edgeColor=style.edgeColor;
  this.textPaint.setTypeface(style.typeface);
  this.textSizePx=textSizePx;
  this.bottomPaddingFraction=bottomPaddingFraction;
  this.parentLeft=cueBoxLeft;
  this.parentTop=cueBoxTop;
  this.parentRight=cueBoxRight;
  this.parentBottom=cueBoxBottom;
  if (isTextCue) {
    setupTextLayout();
  }
 else {
    setupBitmapLayout();
  }
  drawLayout(canvas,isTextCue);
}

Fixed version (ground truth):
/** 
 * Draws the provided   {@link Cue} into a canvas with the specified styling.<p> A call to this method is able to use cached results of calculations made during the previous call, and so an instance of this class is able to optimize repeated calls to this method in which the same parameters are passed.
 * @param cue The cue to draw.
 * @param applyEmbeddedStyles Whether styling embedded within the cue should be applied.
 * @param style The style to use when drawing the cue text.
 * @param textSizePx The text size to use when drawing the cue text, in pixels.
 * @param bottomPaddingFraction The bottom padding fraction to apply when {@link Cue#line} is{@link Cue#DIMEN_UNSET}, as a fraction of the viewport height
 * @param canvas The canvas into which to draw.
 * @param cueBoxLeft The left position of the enclosing cue box.
 * @param cueBoxTop The top position of the enclosing cue box.
 * @param cueBoxRight The right position of the enclosing cue box.
 * @param cueBoxBottom The bottom position of the enclosing cue box.
 */
public void draw(Cue cue,boolean applyEmbeddedStyles,CaptionStyleCompat style,float textSizePx,float bottomPaddingFraction,Canvas canvas,int cueBoxLeft,int cueBoxTop,int cueBoxRight,int cueBoxBottom){
  boolean isTextCue=cue.bitmap == null;
  CharSequence cueText=null;
  Bitmap cueBitmap=null;
  int windowColor=Color.BLACK;
  if (isTextCue) {
    cueText=cue.text;
    if (TextUtils.isEmpty(cueText)) {
      return;
    }
    windowColor=cue.windowColorSet ? cue.windowColor : style.windowColor;
    if (!applyEmbeddedStyles) {
      cueText=cueText.toString();
      windowColor=style.windowColor;
    }
  }
 else {
    cueBitmap=cue.bitmap;
  }
  if (areCharSequencesEqual(this.cueText,cueText) && Util.areEqual(this.cueTextAlignment,cue.textAlignment) && this.cueBitmap == cueBitmap && this.cueLine == cue.line && this.cueLineType == cue.lineType && Util.areEqual(this.cueLineAnchor,cue.lineAnchor) && this.cuePosition == cue.position && Util.areEqual(this.cuePositionAnchor,cue.positionAnchor) && this.cueSize == cue.size && this.applyEmbeddedStyles == applyEmbeddedStyles && this.foregroundColor == style.foregroundColor && this.backgroundColor == style.backgroundColor && this.windowColor == windowColor && this.edgeType == style.edgeType && this.edgeColor == style.edgeColor && Util.areEqual(this.textPaint.getTypeface(),style.typeface) && this.textSizePx == textSizePx && this.bottomPaddingFraction == bottomPaddingFraction && this.parentLeft == cueBoxLeft && this.parentTop == cueBoxTop && this.parentRight == cueBoxRight && this.parentBottom == cueBoxBottom) {
    drawLayout(canvas,isTextCue);
    return;
  }
  this.cueText=cueText;
  this.cueTextAlignment=cue.textAlignment;
  this.cueBitmap=cueBitmap;
  this.cueLine=cue.line;
  this.cueLineType=cue.lineType;
  this.cueLineAnchor=cue.lineAnchor;
  this.cuePosition=cue.position;
  this.cuePositionAnchor=cue.positionAnchor;
  this.cueSize=cue.size;
  this.applyEmbeddedStyles=applyEmbeddedStyles;
  this.foregroundColor=style.foregroundColor;
  this.backgroundColor=style.backgroundColor;
  this.windowColor=windowColor;
  this.edgeType=style.edgeType;
  this.edgeColor=style.edgeColor;
  this.textPaint.setTypeface(style.typeface);
  this.textSizePx=textSizePx;
  this.bottomPaddingFraction=bottomPaddingFraction;
  this.parentLeft=cueBoxLeft;
  this.parentTop=cueBoxTop;
  this.parentRight=cueBoxRight;
  this.parentBottom=cueBoxBottom;
  if (isTextCue) {
    setupTextLayout();
  }
 else {
    setupBitmapLayout();
  }
  drawLayout(canvas,isTextCue);
}