Verified Commit 54e2a23a authored by Lee Salzman's avatar Lee Salzman Committed by ma1
Browse files

Bug 2045185. a=RyanVM DONTBUILD

parent 4ceae3b0
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@
#include "skia/src/core/SkWriteBuffer.h"
#include "skia/src/shaders/SkEmptyShader.h"
#include "Blur.h"
#include "DataSurfaceHelpers.h"
#include "Logging.h"
#include "Tools.h"
#include "PathHelpers.h"
@@ -1814,12 +1815,16 @@ bool DrawTargetSkia::Init(const IntSize& aSize, SurfaceFormat aFormat) {
  }
  SkSurfaceProps props(0, GetSkPixelGeometry());

  size_t bufSize = BufferSizeFromStrideAndHeight(stride.value(), info.height());
  if (!bufSize) {
    return false;
  }

  if (aFormat == SurfaceFormat::A8) {
    // Skia does not fully allocate the last row according to stride.
    // Since some of our algorithms (i.e. blur) depend on this, we must allocate
    // the bitmap pixels manually.
    CheckedInt<size_t> size = stride;
    size *= info.height();
    CheckedInt<size_t> size = bufSize;
    // We need to leave room for an additional 3 bytes for a potential overrun
    // in our blurring code.
    size += 3;