Beispiel #1
0
  @Override
  protected synchronized void onSizeChanged(int w, int h, int oldw, int oldh) {

    // update pixel conversion values
    PixelUtils.init(getContext());

    // disable hardware acceleration if it's not explicitly supported
    // by the current Plot implementation. this check only applies to
    // honeycomb and later environments.
    if (Build.VERSION.SDK_INT >= 11) {
      if (!isHwAccelerationSupported() && isHardwareAccelerated()) {
        setLayerType(View.LAYER_TYPE_SOFTWARE, null);
      }
    }

    // pingPong is only used in background rendering mode.
    if (renderMode == RenderMode.USE_BACKGROUND_THREAD) {
      pingPong.resize(h, w);
    }

    RectF cRect = new RectF(0, 0, w, h);
    RectF mRect = boxModel.getMarginatedRect(cRect);
    RectF pRect = boxModel.getPaddedRect(mRect);

    layout(new DisplayDimensions(cRect, mRect, pRect));
    super.onSizeChanged(w, h, oldw, oldh);
    if (renderThread != null && !renderThread.isAlive()) {
      renderThread.start();
    }
  }
Beispiel #2
0
 public RectF getPaddedRect(RectF widgetMarginRect) {
   return boxModel.getPaddedRect(widgetMarginRect);
 }