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

Unified Diff: gm/clippedbitmapshaders.cpp

Issue 37003005: use the supplied matrix instead of the texture w/h div for the bicubic GPU effect (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: add option to clippedbitmap to demonstrate bug this fixes Created 7 years, 2 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 | src/gpu/effects/GrBicubicEffect.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/clippedbitmapshaders.cpp
diff --git a/gm/clippedbitmapshaders.cpp b/gm/clippedbitmapshaders.cpp
index 02d07bf01e5068f926cf9ae1b423c87d76196874..d7eb3b6e9836829c7038adc21147a8c82938b7d9 100644
--- a/gm/clippedbitmapshaders.cpp
+++ b/gm/clippedbitmapshaders.cpp
@@ -45,12 +45,13 @@ static const SkScalar SLIDE_SIZE = 300;
class ClippedBitmapShadersGM : public GM {
public:
- ClippedBitmapShadersGM(SkShader::TileMode mode)
- : fMode(mode) {
+ ClippedBitmapShadersGM(SkShader::TileMode mode, bool hq=false)
+ : fMode(mode), fHQ(hq) {
}
protected:
SkShader::TileMode fMode;
+ bool fHQ;
virtual SkString onShortName() {
SkString descriptor;
@@ -68,13 +69,16 @@ protected:
SkASSERT(false);
}
descriptor.prepend("clipped-bitmap-shaders-");
+ if (fHQ) {
+ descriptor.append("-hq");
+ }
return descriptor;
}
virtual SkISize onISize() {
return SkISize::Make(300, 300);
}
-
+
virtual void onDraw(SkCanvas* canvas) {
SkBitmap bmp = create_bitmap();
SkShader* shader = SkShader::CreateBitmapShader(
@@ -87,6 +91,10 @@ protected:
s.postTranslate(SLIDE_SIZE / 2, SLIDE_SIZE / 2);
shader->setLocalMatrix(s);
paint.setShader(shader)->unref();
+
+ if (fHQ) {
+ paint.setFilterLevel(SkPaint::kHigh_FilterLevel);
+ }
SkScalar margin = (SLIDE_SIZE / 3 - RECT_SIZE) / 2;
for (int i = 0; i < 3; i++) {
@@ -115,4 +123,10 @@ private:
DEF_GM( return new ClippedBitmapShadersGM(SkShader::kRepeat_TileMode); )
DEF_GM( return new ClippedBitmapShadersGM(SkShader::kMirror_TileMode); )
DEF_GM( return new ClippedBitmapShadersGM(SkShader::kClamp_TileMode); )
+
+DEF_GM( return new ClippedBitmapShadersGM(SkShader::kRepeat_TileMode, true); )
+DEF_GM( return new ClippedBitmapShadersGM(SkShader::kMirror_TileMode, true); )
+DEF_GM( return new ClippedBitmapShadersGM(SkShader::kClamp_TileMode, true); )
+
+
}
« no previous file with comments | « no previous file | src/gpu/effects/GrBicubicEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698