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

Unified Diff: src/gpu/SkGpuDevice.cpp

Issue 99203011: Use GrTextureDomain in GrBicubicEffect to perform non-bleeding HQ filter drawBitmap. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: add initializer list for dummy rectangle to fix warnings Created 7 years 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 | src/gpu/effects/GrBicubicEffect.h » ('j') | 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 ce02f2c55fc97fa76beba1068cc36ae9277b44c6..27c98efb8bccb46fe4692eec789f02d42af116e7 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -1196,8 +1196,7 @@ void SkGpuDevice::drawBitmapCommon(const SkDraw& draw,
break;
case SkPaint::kHigh_FilterLevel: {
// Minification can look bad with the bicubic effect.
- if (fContext->getMatrix().getMinStretch() >= SK_Scalar1 &&
- (flags & SkCanvas::kBleed_DrawBitmapRectFlag)) {
+ if (fContext->getMatrix().getMinStretch() >= SK_Scalar1) {
// We will install an effect that does the filtering in the shader.
textureFilterMode = GrTextureParams::kNone_FilterMode;
tileFilterPad = GrBicubicEffect::kFilterTexelPad;
@@ -1280,8 +1279,6 @@ void SkGpuDevice::drawTiledBitmap(const SkBitmap& bitmap,
// but stay within the bitmap bounds
iClampRect = SkIRect::MakeWH(bitmap.width(), bitmap.height());
} else {
- SkASSERT(!bicubic); // Bicubic is not supported with non-bleed yet.
-
// In texture-domain/clamp mode we only want to expand the
// tile on edges interior to "srcRect" (i.e., we want to
// not bleed across the original clamped edges)
@@ -1379,12 +1376,11 @@ void SkGpuDevice::internalDrawBitmap(const SkBitmap& bitmap,
bool needsTextureDomain = false;
if (!(flags & SkCanvas::kBleed_DrawBitmapRectFlag) &&
- params.filterMode() != GrTextureParams::kNone_FilterMode) {
- SkASSERT(!bicubic);
- // Need texture domain if drawing a sub rect.
+ (bicubic || params.filterMode() != GrTextureParams::kNone_FilterMode)) {
+ // Need texture domain if drawing a sub rect
needsTextureDomain = srcRect.width() < bitmap.width() ||
srcRect.height() < bitmap.height();
- if (needsTextureDomain && fContext->getMatrix().rectStaysRect()) {
+ if (!bicubic && needsTextureDomain && fContext->getMatrix().rectStaysRect()) {
const SkMatrix& matrix = fContext->getMatrix();
// sampling is axis-aligned
SkRect transformedRect;
@@ -1420,11 +1416,15 @@ void SkGpuDevice::internalDrawBitmap(const SkBitmap& bitmap,
top = bottom = SkScalarHalf(paintRect.top() + paintRect.bottom());
}
textureDomain.setLTRB(left, top, right, bottom);
- effect.reset(GrTextureDomainEffect::Create(texture,
- SkMatrix::I(),
- textureDomain,
- GrTextureDomain::kClamp_Mode,
- params.filterMode()));
+ if (bicubic) {
+ effect.reset(GrBicubicEffect::Create(texture, SkMatrix::I(), textureDomain));
+ } else {
+ effect.reset(GrTextureDomainEffect::Create(texture,
+ SkMatrix::I(),
+ textureDomain,
+ GrTextureDomain::kClamp_Mode,
+ params.filterMode()));
+ }
} else if (bicubic) {
SkASSERT(GrTextureParams::kNone_FilterMode == params.filterMode());
SkShader::TileMode tileModes[2] = { params.getTileModeX(), params.getTileModeY() };
« no previous file with comments | « no previous file | src/gpu/effects/GrBicubicEffect.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698