Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(235)

Unified Diff: src/gpu/SkGpuDevice.cpp

Issue 1237623012: Fix textureDomain/bleed prevention in msaa (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/SkGpuDevice.cpp
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index 9cf5b25d7814a2063f378e4ac47603e73c06abe1..fb0fffd65c4a48b56590b0664fc3b570027e1f08 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -845,13 +845,18 @@ static bool has_aligned_samples(const SkRect& srcRect,
static bool may_color_bleed(const SkRect& srcRect,
const SkRect& transformedRect,
- const SkMatrix& m) {
+ const SkMatrix& m,
+ bool isMSAA) {
// Only gets called if has_aligned_samples returned false.
// So we can assume that sampling is axis aligned but not texel aligned.
SkASSERT(!has_aligned_samples(srcRect, transformedRect));
SkRect innerSrcRect(srcRect), innerTransformedRect,
outerTransformedRect(transformedRect);
- innerSrcRect.inset(SK_ScalarHalf, SK_ScalarHalf);
+ if (isMSAA) {
+ innerSrcRect.inset(SK_Scalar1, SK_Scalar1);
+ } else {
+ innerSrcRect.inset(SK_ScalarHalf, SK_ScalarHalf);
+ }
m.mapRect(&innerTransformedRect, innerSrcRect);
// The gap between outerTransformedRect and innerTransformedRect
@@ -872,7 +877,8 @@ static bool needs_texture_domain(const SkBitmap& bitmap,
const SkRect& srcRect,
GrTextureParams &params,
const SkMatrix& contextMatrix,
- bool bicubic) {
+ bool bicubic,
+ bool isMSAA) {
bool needsTextureDomain = false;
GrTexture* tex = bitmap.getTexture();
int width = tex ? tex->width() : bitmap.width();
@@ -891,7 +897,8 @@ static bool needs_texture_domain(const SkBitmap& bitmap,
params.setFilterMode(GrTextureParams::kNone_FilterMode);
needsTextureDomain = false;
} else {
- needsTextureDomain = may_color_bleed(srcRect, transformedRect, contextMatrix);
+ needsTextureDomain = may_color_bleed(srcRect, transformedRect,
+ contextMatrix, isMSAA);
}
}
}
@@ -1072,7 +1079,8 @@ void SkGpuDevice::drawBitmapCommon(const SkDraw& draw,
srcRect,
params,
viewM,
- doBicubic);
+ doBicubic,
+ fRenderTarget->isUnifiedMultisampled());
this->internalDrawBitmap(bitmap,
viewM,
srcRect,
@@ -1153,11 +1161,10 @@ void SkGpuDevice::drawTiledBitmap(const SkBitmap& bitmap,
// now offset it to make it "local" to our tmp bitmap
tileR.offset(-offset.fX, -offset.fY);
GrTextureParams paramsTemp = params;
- bool needsTextureDomain = needs_texture_domain(bitmap,
- srcRect,
- paramsTemp,
- viewM,
- bicubic);
+ bool needsTextureDomain = needs_texture_domain(
+ bitmap, srcRect, paramsTemp,
+ viewM, bicubic,
+ fRenderTarget->isUnifiedMultisampled());
this->internalDrawBitmap(tmpB,
viewM,
tileR,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698