aboutsummaryrefslogtreecommitdiffhomepage
path: root/samplecode/SampleTextureDomain.cpp
diff options
context:
space:
mode:
authorGravatar junov@google.com <junov@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-06-27 20:48:23 +0000
committerGravatar junov@google.com <junov@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-06-27 20:48:23 +0000
commitd935cfbd79f7b78e1957c09a279eed1d7acd8b70 (patch)
treed25ead22c78b51aec4aca0faa1b5e7aa329334c1 /samplecode/SampleTextureDomain.cpp
parent21031e9ee8bf0a4e996030e42a0efbcc555d5f71 (diff)
Adding support for shadows when drawing bitmaps with skia gpu device
Added code to handle this case in SkGpuDevice::drawBitmap Added test to cover this use case in SampleTextureDomain.cpp BUG=http://code.google.com/p/chromium/issues/detail?id=83440 REVIEW=http://codereview.appspot.com/4530068/ git-svn-id: http://skia.googlecode.com/svn/trunk@1730 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'samplecode/SampleTextureDomain.cpp')
-rwxr-xr-xsamplecode/SampleTextureDomain.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/samplecode/SampleTextureDomain.cpp b/samplecode/SampleTextureDomain.cpp
index 1810723c06..1f895e5d91 100755
--- a/samplecode/SampleTextureDomain.cpp
+++ b/samplecode/SampleTextureDomain.cpp
@@ -1,6 +1,7 @@
#include "SampleCode.h"
#include "SkCanvas.h"
#include "SkDevice.h"
+#include "SkBlurMaskFilter.h"
namespace {
SkBitmap make_bitmap() {
@@ -68,6 +69,27 @@ protected:
srcRect.setXYWH(1, 1, 3, 3);
dstRect.setXYWH(405.0f, 5.0f, 305.0f, 305.0f);
canvas->drawBitmapRect(deviceBitmap, &srcRect, dstRect, &paint);
+
+ // Test that bitmap blurring using a subrect
+ // renders correctly
+ srcRect.setXYWH(1, 1, 3, 3);
+ dstRect.setXYWH(5.0f, 405.0f, 305.0f, 305.0f);
+ SkMaskFilter* mf = SkBlurMaskFilter::Create(
+ 5,
+ SkBlurMaskFilter::kNormal_BlurStyle,
+ SkBlurMaskFilter::kHighQuality_BlurFlag);
+ paint.setMaskFilter(mf)->unref();
+ canvas->drawBitmapRect(deviceBitmap, &srcRect, dstRect, &paint);
+
+ // Blur and a rotation + NULL src rect
+ // This should not trigger the texture domain code
+ // but it will test a code path in SkGpuDevice::drawBitmap
+ // that handles blurs with rects transformed to non-
+ // orthogonal rects. It also tests the NULL src rect handling
+ dstRect.setXYWH(-150.0f, -150.0f, 300.0f, 300.0f);
+ canvas->translate(550, 550);
+ canvas->rotate(45);
+ canvas->drawBitmapRect(fBM, NULL, dstRect, &paint);
}
private:
typedef SkView INHERITED;