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

Side by Side Diff: src/gpu/SkGpuDevice_drawTexture.cpp

Issue 1454183002: Fix has_aligned_samples helper for SkGpuDevice::drawTextureProducer (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2015 Google Inc. 2 * Copyright 2015 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkGpuDevice.h" 8 #include "SkGpuDevice.h"
9 9
10 #include "GrBlurUtils.h" 10 #include "GrBlurUtils.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 } 52 }
53 } 53 }
54 54
55 ////////////////////////////////////////////////////////////////////////////// 55 //////////////////////////////////////////////////////////////////////////////
56 // Helper functions for dropping src rect constraint in bilerp mode. 56 // Helper functions for dropping src rect constraint in bilerp mode.
57 57
58 static const SkScalar kColorBleedTolerance = 0.001f; 58 static const SkScalar kColorBleedTolerance = 0.001f;
59 59
60 static bool has_aligned_samples(const SkRect& srcRect, const SkRect& transformed Rect) { 60 static bool has_aligned_samples(const SkRect& srcRect, const SkRect& transformed Rect) {
61 // detect pixel disalignment 61 // detect pixel disalignment
62 if (SkScalarAbs(SkScalarFraction(transformedRect.left())) < kColorBleedToler ance && 62 if (SkScalarAbs(SkScalarRoundToScalar(transformedRect.left()) - transformedR ect.left()) < kColorBleedTolerance &&
63 SkScalarAbs(SkScalarFraction(transformedRect.top())) < kColorBleedTolera nce && 63 SkScalarAbs(SkScalarRoundToScalar(transformedRect.top()) - transformedR ect.top()) < kColorBleedTolerance &&
64 SkScalarAbs(transformedRect.width() - srcRect.width()) < kColorBleedTole rance && 64 SkScalarAbs(transformedRect.width() - srcRect.width()) < kColorBleedTo lerance &&
65 SkScalarAbs(transformedRect.height() - srcRect.height()) < kColorBleedTo lerance) { 65 SkScalarAbs(transformedRect.height() - srcRect.height()) < kColorBleedTo lerance) {
66 return true; 66 return true;
67 } 67 }
68 return false; 68 return false;
69 } 69 }
70 70
71 static bool may_color_bleed(const SkRect& srcRect, 71 static bool may_color_bleed(const SkRect& srcRect,
72 const SkRect& transformedRect, 72 const SkRect& transformedRect,
73 const SkMatrix& m, 73 const SkMatrix& m,
74 bool isMSAA) { 74 bool isMSAA) {
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 rec, 260 rec,
261 rrect)) { 261 rrect)) {
262 return; 262 return;
263 } 263 }
264 SkPath rectPath; 264 SkPath rectPath;
265 rectPath.addRect(clippedDstRect); 265 rectPath.addRect(clippedDstRect);
266 GrBlurUtils::drawPathWithMaskFilter(this->context(), fDrawContext, fRenderTa rget, fClip, 266 GrBlurUtils::drawPathWithMaskFilter(this->context(), fDrawContext, fRenderTa rget, fClip,
267 rectPath, &grPaint, viewMatrix, mf, pain t.getPathEffect(), 267 rectPath, &grPaint, viewMatrix, mf, pain t.getPathEffect(),
268 GrStrokeInfo::FillInfo()); 268 GrStrokeInfo::FillInfo());
269 } 269 }
OLDNEW
« 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