Add override to force bitmap rendering
R=robertphillips@google.com
Author: krajcevski@google.com
Review URL: https://codereview.chromium.org/462203002
diff --git a/src/gpu/GrClipMaskManager.cpp b/src/gpu/GrClipMaskManager.cpp
index 0f79402..7cafdf7 100644
--- a/src/gpu/GrClipMaskManager.cpp
+++ b/src/gpu/GrClipMaskManager.cpp
@@ -1058,7 +1058,7 @@
SkMatrix matrix;
matrix.setTranslate(SkIntToScalar(-clipSpaceIBounds.fLeft),
SkIntToScalar(-clipSpaceIBounds.fTop));
- helper.init(maskSpaceIBounds, &matrix);
+ helper.init(maskSpaceIBounds, &matrix, false);
helper.clear(kAllIn_InitialState == initialState ? 0xFF : 0x00);
diff --git a/src/gpu/GrSWMaskHelper.cpp b/src/gpu/GrSWMaskHelper.cpp
index e8910b4..b7b2d1a 100644
--- a/src/gpu/GrSWMaskHelper.cpp
+++ b/src/gpu/GrSWMaskHelper.cpp
@@ -106,6 +106,8 @@
SkXfermode* mode = SkXfermode::Create(op_to_mode(op));
+ SkASSERT(kNone_CompressionMode == fCompressionMode);
+
paint.setXfermode(mode);
paint.setAntiAlias(antiAlias);
paint.setColor(SkColorSetARGB(alpha, alpha, alpha, alpha));
@@ -156,7 +158,8 @@
}
bool GrSWMaskHelper::init(const SkIRect& resultBounds,
- const SkMatrix* matrix) {
+ const SkMatrix* matrix,
+ bool allowCompression) {
if (NULL != matrix) {
fMatrix = *matrix;
} else {
@@ -169,7 +172,8 @@
SkIRect bounds = SkIRect::MakeWH(resultBounds.width(),
resultBounds.height());
- if (fContext->getOptions().fDrawPathToCompressedTexture &&
+ if (allowCompression &&
+ fContext->getOptions().fDrawPathToCompressedTexture &&
choose_compressed_fmt(fContext->getGpu()->caps(), &fCompressedFormat)) {
fCompressionMode = kCompress_CompressionMode;
}
diff --git a/src/gpu/GrSWMaskHelper.h b/src/gpu/GrSWMaskHelper.h
index ccd2df8..f8cce8b 100644
--- a/src/gpu/GrSWMaskHelper.h
+++ b/src/gpu/GrSWMaskHelper.h
@@ -49,8 +49,9 @@
// set up the internal state in preparation for draws. Since many masks
// may be accumulated in the helper during creation, "resultBounds"
// allows the caller to specify the region of interest - to limit the
- // amount of work.
- bool init(const SkIRect& resultBounds, const SkMatrix* matrix);
+ // amount of work. allowCompression should be set to false if you plan on using
+ // your own texture to draw into, and not a scratch texture via getTexture().
+ bool init(const SkIRect& resultBounds, const SkMatrix* matrix, bool allowCompression = true);
// Draw a single rect into the accumulation bitmap using the specified op
void draw(const SkRect& rect, SkRegion::Op op,