Index: gm/imagealphathreshold.cpp |
diff --git a/gm/imagemagnifier.cpp b/gm/imagealphathreshold.cpp |
similarity index 63% |
copy from gm/imagemagnifier.cpp |
copy to gm/imagealphathreshold.cpp |
index ae639d3b538b162b64a40b5604d041ddaea5d553..307c9c8c431449ffc0af5fe54971922d9612527b 100644 |
--- a/gm/imagemagnifier.cpp |
+++ b/gm/imagealphathreshold.cpp |
@@ -1,12 +1,12 @@ |
/* |
- * Copyright 2012 Google Inc. |
+ * Copyright 2013 Google Inc. |
* |
* Use of this source code is governed by a BSD-style license that can be |
* found in the LICENSE file. |
*/ |
#include "gm.h" |
-#include "SkMagnifierImageFilter.h" |
+#include "SkAlphaThresholdFilter.h" |
#include "SkRandom.h" |
#define WIDTH 500 |
@@ -14,20 +14,19 @@ |
namespace skiagm { |
-class ImageMagnifierGM : public GM { |
+class ImageAlphaThresholdGM : public GM { |
public: |
- ImageMagnifierGM() { |
+ ImageAlphaThresholdGM() { |
this->setBGColor(0xFF000000); |
} |
protected: |
virtual uint32_t onGetFlags() const SK_OVERRIDE { |
- // Skip tiled drawing until https://code.google.com/p/skia/issues/detail?id=781 is fixed. |
return this->INHERITED::onGetFlags() | GM::kSkipTiled_Flag; |
} |
virtual SkString onShortName() SK_OVERRIDE { |
- return SkString("imagemagnifier"); |
+ return SkString("imagealphathreshold"); |
} |
virtual SkISize onISize() SK_OVERRIDE { |
@@ -35,13 +34,19 @@ protected: |
} |
virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { |
+ SkIRect rects[2]; |
+ rects[0] = SkIRect::MakeXYWH(SkIntToScalar(0), SkIntToScalar(150), |
+ SkIntToScalar(WIDTH), |
+ SkIntToScalar(HEIGHT - 300)); |
+ rects[1] = SkIRect::MakeXYWH(SkIntToScalar(150), SkIntToScalar(0), |
+ SkIntToScalar(WIDTH - 300), |
+ SkIntToScalar(HEIGHT)); |
+ SkRegion region; |
+ region.setRects(rects, 2); |
Wez
2013/12/17 06:39:04
So we need to plumb through the window shape throu
Zachary Kuznia
2013/12/18 00:06:27
Yes. I have a CL in Chromium that does this; I'll
|
+ |
SkPaint paint; |
paint.setImageFilter( |
- new SkMagnifierImageFilter( |
- SkRect::MakeXYWH(SkIntToScalar(100), SkIntToScalar(100), |
- SkIntToScalar(WIDTH / 2), |
- SkIntToScalar(HEIGHT / 2)), |
- 100))->unref(); |
+ new SkAlphaThresholdFilter(region, 0, .2))->unref(); |
canvas->saveLayer(NULL, &paint); |
paint.setAntiAlias(true); |
const char* str = "The quick brown fox jumped over the lazy dog."; |
@@ -63,7 +68,7 @@ private: |
////////////////////////////////////////////////////////////////////////////// |
-static GM* MyFactory(void*) { return new ImageMagnifierGM; } |
+static GM* MyFactory(void*) { return new ImageAlphaThresholdGM; } |
static GMRegistry reg(MyFactory); |
} |